[llvm] [RISCV] Minimally modify incoming state in transferBefore (PR #72352)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 19 22:07:21 PST 2023


================
@@ -1013,73 +1015,76 @@ bool RISCVInsertVSETVLI::needVSETVLI(const MachineInstr &MI,
   return true;
 }
 
-// Given an incoming state reaching MI, modifies that state so that it is minimally
-// compatible with MI.  The resulting state is guaranteed to be semantically legal
-// for MI, but may not be the state requested by MI.
+// Given an incoming state reaching MI, minimally modifies that state so that it
+// is compatible with MI. The resulting state is guaranteed to be semantically
+// legal for MI, but may not be the state requested by MI.
 void RISCVInsertVSETVLI::transferBefore(VSETVLIInfo &Info,
                                         const MachineInstr &MI) const {
   uint64_t TSFlags = MI.getDesc().TSFlags;
   if (!RISCVII::hasSEWOp(TSFlags))
     return;
 
-  const VSETVLIInfo NewInfo = computeInfoForInstr(MI, TSFlags, MRI);
+  VSETVLIInfo NewInfo = computeInfoForInstr(MI, TSFlags, MRI);
----------------
lukel97 wrote:

I gave this an attempt, but couldn't figure out a good way of doing so. Mainly because the SEW/LMUL ratio "touch up" has to happen on NewInfo before we actually mutate Info, since CanUseX0X0Form is dependent on said ratio.

We were still essentially mutating NewInfo before this patch, it was just a bit obfuscated because we swapped it into Info first. Any ideas here?

https://github.com/llvm/llvm-project/pull/72352


More information about the llvm-commits mailing list