[PATCH] D133103: [PowerPC] Improve kill flag computation and add verification after MI peephole

Kamau Bridgeman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 30 00:32:59 PST 2023


kamaub added inline comments.


================
Comment at: llvm/lib/Target/PowerPC/PPCMIPeephole.cpp:848
               RoundInstr->eraseFromParent();
+              addRegToUpdate(RegsToUpdate, ConvReg1);
             }
----------------
Should there be a call to `recomputeLVForDyingInstr()` as well since this `ConvReg1` is a reg of `RoundInstr` which is being `eraseFromParent()` on line 847 and cannot be marked `ToErase` inside the lambda?


================
Comment at: llvm/lib/Target/PowerPC/PPCMIPeephole.cpp:1724
       BI2->getOperand(1).setReg(BI1->getOperand(1).getReg());
       CMPI2->eraseFromParent();
     }
----------------
We add this compare's operands to the RegsToUpdate unconditionally earlier, and now in this code path it is deleted meaning that we could end up attempting to recompute the LV for its VRegs and could hit errors.
If this is the case I think being inside a function means `recomputeLVForDyingInstr()` would have to become a static function in order to catch this corner case =?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133103/new/

https://reviews.llvm.org/D133103



More information about the llvm-commits mailing list