summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorSerguei Katkov <serguei.katkov@azul.com>2018-06-04 02:52:36 +0000
committerSerguei Katkov <serguei.katkov@azul.com>2018-06-04 02:52:36 +0000
commitd894fb4288f1739a17a51d8334f578f321f98206 (patch)
treeda55886888aafc90eff86f197ec0440fce76e59e /llvm/lib/Transforms
parent23d66ae1e4866db2f009ef7f9781174f9eebdfd1 (diff)
downloadbcm5719-llvm-d894fb4288f1739a17a51d8334f578f321f98206.tar.gz
bcm5719-llvm-d894fb4288f1739a17a51d8334f578f321f98206.zip
[InstCombine] Fix div handling
When we optimize select basing on fact that div by 0 is undef we should not traverse the instruction which are not guaranteed to transfer execution to next instruction. Guard intrinsic is an example. Reviewers: spatel, craig.topper Reviewed By: spatel Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D47576 llvm-svn: 333864
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
index 15c412a76bb..a62581e0981 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
@@ -581,9 +581,9 @@ bool InstCombiner::simplifyDivRemOfSelectWithZeroOp(BinaryOperator &I) {
Type *CondTy = SelectCond->getType();
while (BBI != BBFront) {
--BBI;
- // If we found a call to a function, we can't assume it will return, so
+ // If we found an instruction that we can't assume will return, so
// information from below it cannot be propagated above it.
- if (isa<CallInst>(BBI) && !isa<IntrinsicInst>(BBI))
+ if (!isGuaranteedToTransferExecutionToSuccessor(&*BBI))
break;
// Replace uses of the select or its condition with the known values.
OpenPOWER on IntegriCloud