[PATCH] D86808: [MachineDCE] Delete missed dead instructions after deleting PHI
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 28 20:26:01 PDT 2020
efriedma added a comment.
In general, this pass isn't going to see uses before defs; it's not CFG-sensitive at all. This isn't specific to PHI nodes. For virtual registers, maybe we could be doing something like the IR RecursivelyDeleteTriviallyDeadInstructions, to make sure we catch everything? (Well, everything a simple DCE can catch; ADCE is probably overkill.)
That doesn't really extend to physreg defs, though; we don't currently record the information necessary. Not sure if we can do anything about that cheaply.
================
Comment at: llvm/lib/CodeGen/DeadMachineInstructionElim.cpp:156
+ MachineInstr *FeedMI = MRI->getVRegDef(FeedReg);
+ if (!FeedMI || !isDead(FeedMI))
+ continue;
----------------
You can't use isDead() like this: it queries LivePhysRegs, which is only valid for the current MI.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86808/new/
https://reviews.llvm.org/D86808
More information about the llvm-commits
mailing list