[llvm] [PowerPC] Ensure MI peephole knows about instr modified by combineRLWINM() (PR #97134)

Chen Zheng via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 15 18:36:04 PDT 2024


================
@@ -1291,6 +1291,10 @@ bool PPCMIPeephole::simplifyCode() {
           addRegToUpdate(OrigOp1Reg);
           if (MI.getOperand(1).isReg())
             addRegToUpdate(MI.getOperand(1).getReg());
+          if (ToErase && ToErase->getOperand(1).isReg())
+            for (auto UseReg: ToErase->explicit_uses())
+              if (UseReg.isReg())
+                addRegToUpdate(UseReg.getReg());
----------------
chenzheng1030 wrote:

We have `recomputeLVForDyingInstr()` to recompute the liveness for  operands of`ToErase` instructions. But this function only does the computation for the defs and the regs added by `addRegToUpdate()`.

For now, it is OK we fix this case by adding the use operands of `ToErase` to the update container at this place. If we continue to meet new issues, we may need to revisit the way we recompute the liveness for `ToErase` instructions.

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


More information about the llvm-commits mailing list