summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@codeaurora.org>2014-09-26 20:05:35 +0000
committerChad Rosier <mcrosier@codeaurora.org>2014-09-26 20:05:35 +0000
commit7b974b73ae0d0a2533431b3f22845ee9aeb3d837 (patch)
tree739501b4d607eb499a09214763fe0530f3c98d5c /llvm/lib
parent7e38e429b7360ffac1f0853bb8023f9dd88b9fea (diff)
downloadbcm5719-llvm-7b974b73ae0d0a2533431b3f22845ee9aeb3d837.tar.gz
bcm5719-llvm-7b974b73ae0d0a2533431b3f22845ee9aeb3d837.zip
[IndVar] Don't widen loop compare unless IV user is sign extended.
PR21030 llvm-svn: 218539
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/IndVarSimplify.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
index 7cc34e1ad86..68a134ebfd8 100644
--- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -650,7 +650,7 @@ namespace {
struct WideIVInfo {
PHINode *NarrowIV;
Type *WidestNativeType; // Widest integer type created [sz]ext
- bool IsSigned; // Was an sext user seen before a zext?
+ bool IsSigned; // Was a sext user seen before a zext?
WideIVInfo() : NarrowIV(nullptr), WidestNativeType(nullptr),
IsSigned(false) {}
@@ -936,7 +936,11 @@ bool WidenIV::WidenLoopCompare(NarrowIVDefUse DU) {
if (!Cmp)
return false;
- bool IsSigned = CmpInst::isSigned(Cmp->getPredicate());
+ // Must be a signed compare.
+ if (!CmpInst::isSigned(Cmp->getPredicate()))
+ return false;
+
+ // Must be a signed IV user.
if (!IsSigned)
return false;
OpenPOWER on IntegriCloud