[PATCH] D126456: [WIP][IPSCCP] Invalidate the Lattice Value of deleted instructions.
Alexandros Lamprineas via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 26 03:47:43 PDT 2022
labrinea added inline comments.
================
Comment at: llvm/lib/Transforms/Utils/SCCPSolver.cpp:1738
+ if (auto *I = dyn_cast<Instruction>(U))
+ if (I != Old && isBlockExecutable(I->getParent()))
+ UseInsts.push_back(I);
----------------
This is something weren't checking before. There can be self-referencing PHI nodes which get replaced and then we are visiting them, which results in a crash.
================
Comment at: llvm/lib/Transforms/Utils/SCCPSolver.cpp:1743-1749
+ // Remove the instruction from Block and Solver.
+ if (auto *I = dyn_cast<Instruction>(Old)) {
+ if (I->isSafeToRemove()) {
+ I->eraseFromParent();
+ removeLatticeValueFor(I);
+ }
+ }
----------------
Also this should happen first and then visit the users, otherwise the solver keeps invalid lattice state in the meantime.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126456/new/
https://reviews.llvm.org/D126456
More information about the llvm-commits
mailing list