[llvm] [RISCV] Support postRA vsetvl insertion pass (PR #70549)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 8 20:54:29 PDT 2024
================
@@ -48,6 +50,44 @@ static cl::opt<bool> UseStrictAsserts(
namespace {
+// For the SSA form, we could just use the getVRegDef to take Reaching
+// definition. For the non-SSA, we retrieve reaching definition for specific
+// register from LiveInterval/VNInfo.
+template <typename T>
+static T *getReachingDefMI(Register Reg, T *MI, const MachineRegisterInfo *MRI,
+ const LiveIntervals *LIS) {
+ if (MRI->isSSA())
+ return MRI->getVRegDef(Reg);
+
+ if (!MI)
+ return MRI->getUniqueVRegDef(Reg);
----------------
topperc wrote:
You can use `getUniqueVRegDef` for SSA too. So we can merge these two conditions.
```
if (MRI->isSSA() || !MI)
return MRI->getUniqueVRegDef(Reg);
```
https://github.com/llvm/llvm-project/pull/70549
More information about the llvm-commits
mailing list