[PATCH] D23824: [ADCE] Add handling of PHI nodes when removing control flow
David Majnemer via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 23 19:56:10 PDT 2016
majnemer added inline comments.
================
Comment at: lib/Transforms/Scalar/ADCE.cpp:286
@@ -276,2 +285,3 @@
- DEBUG(dbgs() << "work live: "; LiveInst->dump(););
+ if (PHINode *PN = dyn_cast<PHINode>(LiveInst)) {
+ markPhiReachingDefs(PN);
----------------
I'd use `auto *`.
================
Comment at: lib/Transforms/Scalar/ADCE.cpp:329
@@ +328,3 @@
+ auto *Value = PN->getIncomingValue(Idx);
+ if (Instruction *ReachingDef = dyn_cast<Instruction>(Value)) {
+ markLive(ReachingDef);
----------------
Ditto.
================
Comment at: lib/Transforms/Scalar/ADCE.cpp:443
@@ +442,3 @@
+ // Iterate over all live PHINodes.
+ for (auto it = BB->begin(); PHINode *PN = dyn_cast<PHINode>(it); ++it) {
+ if (!isLive(PN))
----------------
Ditto.
https://reviews.llvm.org/D23824
More information about the llvm-commits
mailing list