[PATCH] D80206: [IR] Clean up dead instructions after simplifying a conditional branch
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 11 03:37:55 PDT 2020
fhahn added inline comments.
================
Comment at: llvm/lib/Transforms/Utils/Local.cpp:107
/// basic block must have their PHI nodes updated.
/// Also calls RecursivelyDeleteTriviallyDeadInstructions() on any branch/switch
/// conditions and indirectbr addresses this might make dead if
----------------
Might be good to mention the change in behavior in the doc-comment (not sure why there's one here, should also be updated in the headeR)
================
Comment at: llvm/lib/Transforms/Utils/Local.cpp:476
for (; S != E; ++S) {
- auto *I = cast<Instruction>(DeadInsts[S]);
- if (!isInstructionTriviallyDead(I)) {
+ auto *I = dyn_cast<Instruction>(DeadInsts[S]);
+ if (!I || !isInstructionTriviallyDead(I)) {
----------------
Why change this to a dyn_cast? Looks like only Instructions are added in `removePredecessor`?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D80206/new/
https://reviews.llvm.org/D80206
More information about the llvm-commits
mailing list