diff options
author | Duncan Sands <baldrick@free.fr> | 2010-11-17 04:18:45 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2010-11-17 04:18:45 +0000 |
commit | a0c5244e8575ae91af318af09353ff34ac6bca1e (patch) | |
tree | b8639cf826d763b829fd40049a3dcef9cf4b5525 /lib | |
parent | 6ac3386e100db376895dbc4a324d56d0ecd666d2 (diff) | |
download | external_llvm-a0c5244e8575ae91af318af09353ff34ac6bca1e.zip external_llvm-a0c5244e8575ae91af318af09353ff34ac6bca1e.tar.gz external_llvm-a0c5244e8575ae91af318af09353ff34ac6bca1e.tar.bz2 |
Have ScalarEvolution use SimplifyInstruction rather than hasConstantValue.
While there, add a note about an inefficiency I noticed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119458 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Analysis/ScalarEvolution.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index e9cfc56..d3e04f8 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -69,6 +69,7 @@ #include "llvm/Operator.h" #include "llvm/Analysis/ConstantFolding.h" #include "llvm/Analysis/Dominators.h" +#include "llvm/Analysis/InstructionSimplify.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/ValueTracking.h" #include "llvm/Assembly/Writer.h" @@ -2874,7 +2875,10 @@ const SCEV *ScalarEvolution::createNodeForPHI(PHINode *PN) { // PHI's incoming blocks are in a different loop, in which case doing so // risks breaking LCSSA form. Instcombine would normally zap these, but // it doesn't have DominatorTree information, so it may miss cases. - if (Value *V = PN->hasConstantValue(DT)) { + if (Value *V = SimplifyInstruction(PN, TD, DT)) { + // TODO: The following check is suboptimal. For example, it is pointless + // if V is a constant. Since the problematic case is if V is defined inside + // a deeper loop, it would be better to check for that directly. bool AllSameLoop = true; Loop *PNLoop = LI->getLoopFor(PN->getParent()); for (size_t i = 0, e = PN->getNumIncomingValues(); i != e; ++i) |