summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorMehdi Amini <mehdi.amini@apple.com>2015-10-07 18:14:25 +0000
committerMehdi Amini <mehdi.amini@apple.com>2015-10-07 18:14:25 +0000
commit044cb34bdc76d14086e39a3e5eaff88c7890e9ea (patch)
tree48a8e009c55c594f5d9b721cc954d46f0ebef8b3 /llvm/lib/Analysis
parentdaad571ba479008236227d0635e0400d3b62b1fa (diff)
downloadbcm5719-llvm-044cb34bdc76d14086e39a3e5eaff88c7890e9ea.tar.gz
bcm5719-llvm-044cb34bdc76d14086e39a3e5eaff88c7890e9ea.zip
Revert "Revert "This patch builds on top of D13378 to handle constant condition.""
This reverts commit r249528 and reapply r249431. The fix for the fallout has been commited in r249575. From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 249581
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/ScalarEvolution.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 6386082ca91..3a4de1aec6d 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -3904,6 +3904,11 @@ const SCEV *ScalarEvolution::createNodeForSelectOrPHI(Instruction *I,
Value *Cond,
Value *TrueVal,
Value *FalseVal) {
+ // Handle "constant" branch or select. This can occur for instance when a
+ // loop pass transforms an inner loop and moves on to process the outer loop.
+ if (auto *CI = dyn_cast<ConstantInt>(Cond))
+ return getSCEV(CI->isOne() ? TrueVal : FalseVal);
+
// Try to match some simple smax or umax patterns.
auto *ICI = dyn_cast<ICmpInst>(Cond);
if (!ICI)
OpenPOWER on IntegriCloud