[PATCH] D13390: SCEV: handle constant condition for select/branch
Mehdi AMINI via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 2 10:27:10 PDT 2015
joker.eph created this revision.
joker.eph added a reviewer: sanjoy.
joker.eph added a subscriber: llvm-commits.
http://reviews.llvm.org/D13390
Files:
lib/Analysis/ScalarEvolution.cpp
Index: lib/Analysis/ScalarEvolution.cpp
===================================================================
--- lib/Analysis/ScalarEvolution.cpp
+++ lib/Analysis/ScalarEvolution.cpp
@@ -3890,9 +3890,16 @@
Value *FalseVal) {
// Try to match some simple smax or umax patterns.
auto *ICI = dyn_cast<ICmpInst>(Cond);
- if (!ICI)
+ if (!ICI) {
+ // If this is not an integer condition, it might still be a constant
+ if (auto *CI = dyn_cast<ConstantInt>(Cond)) {
+ if (CI->isOne())
+ return getSCEV(TrueVal);
+ else
+ return getSCEV(FalseVal);
+ }
return getUnknown(I);
-
+ }
Value *LHS = ICI->getOperand(0);
Value *RHS = ICI->getOperand(1);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13390.36375.patch
Type: text/x-patch
Size: 742 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151002/fa236b0a/attachment.bin>
More information about the llvm-commits
mailing list