[PATCH] D13458: [SCEV] Pick backedge values for phi nodes correctly
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 8 09:54:41 PDT 2015
reames added a subscriber: reames.
reames accepted this revision.
reames added a reviewer: reames.
reames added a comment.
This revision is now accepted and ready to land.
LGTM.
================
Comment at: lib/Analysis/ScalarEvolution.cpp:5745
@@ +5744,3 @@
+ // NonLatch is the preheader, or something equivalent.
+ BasicBlock *NonLatch = Latch == PN->getIncomingBlock(0)
+ ? PN->getIncomingBlock(1)
----------------
This line should probably be below the following comment.
================
Comment at: lib/Analysis/ScalarEvolution.cpp:5759
@@ -5747,3 +5758,3 @@
auto *StartCST =
- dyn_cast<Constant>(PHI->getIncomingValue(!SecondIsBackedge));
+ dyn_cast<Constant>(PHI->getIncomingValueForBlock(NonLatch));
if (!StartCST) continue;
----------------
Please put a comment that says not all phis have to list their arguments in the same order. This is subtle and easily confused.
http://reviews.llvm.org/D13458
More information about the llvm-commits
mailing list