@@ -262,6 +262,17 @@ struct DemandedFields {
262262 VLZeroness = true ;
263263 }
264264
265+ // Make this the result of demanding both the fields in this and B.
266+ void doUnion (const DemandedFields &B) {
267+ VLAny |= B.VLAny ;
268+ VLZeroness |= B.VLZeroness ;
269+ SEW = std::max (SEW, B.SEW );
270+ LMUL |= B.LMUL ;
271+ SEWLMULRatio |= B.SEWLMULRatio ;
272+ TailPolicy |= B.TailPolicy ;
273+ MaskPolicy |= B.MaskPolicy ;
274+ }
275+
265276#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
266277 // / Support for debugging, callable in GDB: V->dump()
267278 LLVM_DUMP_METHOD void dump () const {
@@ -1547,16 +1558,6 @@ void RISCVInsertVSETVLI::doPRE(MachineBasicBlock &MBB) {
15471558 AvailableInfo, OldExit);
15481559}
15491560
1550- static void doUnion (DemandedFields &A, DemandedFields B) {
1551- A.VLAny |= B.VLAny ;
1552- A.VLZeroness |= B.VLZeroness ;
1553- A.SEW = std::max (A.SEW , B.SEW );
1554- A.LMUL |= B.LMUL ;
1555- A.SEWLMULRatio |= B.SEWLMULRatio ;
1556- A.TailPolicy |= B.TailPolicy ;
1557- A.MaskPolicy |= B.MaskPolicy ;
1558- }
1559-
15601561// Return true if we can mutate PrevMI to match MI without changing any the
15611562// fields which would be observed.
15621563static bool canMutatePriorConfig (const MachineInstr &PrevMI,
@@ -1606,7 +1607,7 @@ bool RISCVCoalesceVSETVLI::coalesceVSETVLIs(MachineBasicBlock &MBB) {
16061607 for (MachineInstr &MI : make_range (MBB.rbegin (), MBB.rend ())) {
16071608
16081609 if (!isVectorConfigInstr (MI)) {
1609- doUnion (Used, getDemanded (MI, MRI, ST));
1610+ Used. doUnion (getDemanded (MI, MRI, ST));
16101611 if (MI.isCall () || MI.isInlineAsm () ||
16111612 MI.modifiesRegister (RISCV::VL, /* TRI=*/ nullptr ) ||
16121613 MI.modifiesRegister (RISCV::VTYPE, /* TRI=*/ nullptr ))
0 commit comments