summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-04-10 16:32:15 +0000
committerNikita Popov <nikita.ppv@gmail.com>2019-04-10 16:32:15 +0000
commit0a8228fd28eefc058521eb24df001560d556a89e (patch)
tree03dea12bf4b483fa1eaf028388dcfeb87fe1b7e1 /llvm/lib/Transforms
parent7a543c3758254b2e45fe21bd4fa368a92310b274 (diff)
downloadbcm5719-llvm-0a8228fd28eefc058521eb24df001560d556a89e.tar.gz
bcm5719-llvm-0a8228fd28eefc058521eb24df001560d556a89e.zip
[InstCombine] Handle ssubo always overflow
Following D60483 and D60497, this adds support for AlwaysOverflows handling for ssubo. This is the last case we can handle right now. Differential Revision: https://reviews.llvm.org/D60518 llvm-svn: 358100
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index bc99b177a7e..2c7d70e4db4 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -3997,15 +3997,15 @@ bool InstCombiner::OptimizeOverflowCheck(OverflowCheckFlavor OCF, Value *LHS,
if (OR == OverflowResult::NeverOverflows)
return SetResult(Builder.CreateNUWSub(LHS, RHS), Builder.getFalse(),
true);
-
- if (OR == OverflowResult::AlwaysOverflows)
- return SetResult(Builder.CreateSub(LHS, RHS), Builder.getTrue(), true);
} else {
OR = computeOverflowForSignedSub(LHS, RHS, &OrigI);
if (OR == OverflowResult::NeverOverflows)
return SetResult(Builder.CreateNSWSub(LHS, RHS), Builder.getFalse(),
true);
}
+
+ if (OR == OverflowResult::AlwaysOverflows)
+ return SetResult(Builder.CreateSub(LHS, RHS), Builder.getTrue(), true);
break;
}
OpenPOWER on IntegriCloud