summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-06-05 09:31:20 +0000
committerDaniel Jasper <djasper@google.com>2015-06-05 09:31:20 +0000
commit917fa5ee66afc6bb9518aef058b830714fab2267 (patch)
tree30312ba1c160b0ec439495ad5174acdfcde20c45 /llvm/lib/Transforms
parent3b0f304517fa4cd28fe2bb7440004a180557330c (diff)
downloadbcm5719-llvm-917fa5ee66afc6bb9518aef058b830714fab2267.tar.gz
bcm5719-llvm-917fa5ee66afc6bb9518aef058b830714fab2267.zip
Revert "[InstCombine] Don't miscompile safe increment idiom"
This is breaking a lot of build bots and is causing very long-running compiles (infinite loops)? Likely, we shouldn't return nullptr? llvm-svn: 239139
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp24
1 files changed, 3 insertions, 21 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
index 4dec1542495..d2fbcdd3991 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
@@ -292,28 +292,10 @@ static Value *SimplifyWithOpReplaced(Value *V, Value *Op, Value *RepOp,
// If this is a binary operator, try to simplify it with the replaced op.
if (BinaryOperator *B = dyn_cast<BinaryOperator>(I)) {
- Value *Simplified = nullptr;
if (B->getOperand(0) == Op)
- Simplified =
- SimplifyBinOp(B->getOpcode(), RepOp, B->getOperand(1), DL, TLI);
- if (!Simplified && B->getOperand(1) == Op)
- Simplified =
- SimplifyBinOp(B->getOpcode(), B->getOperand(0), RepOp, DL, TLI);
- if (Simplified) {
- // Consider:
- // %cmp = icmp eq i32 %x, 2147483647
- // %add = add nsw i32 %x, 1
- // %sel = select i1 %cmp, i32 -2147483648, i32 %add
- //
- // We can't replace %sel with %add unless we strip away the flags.
- if (isa<OverflowingBinaryOperator>(B)) {
- B->setHasNoSignedWrap(false);
- B->setHasNoUnsignedWrap(false);
- }
- if (isa<PossiblyExactOperator>(B))
- B->setIsExact(false);
- }
- return Simplified;
+ return SimplifyBinOp(B->getOpcode(), RepOp, B->getOperand(1), DL, TLI);
+ if (B->getOperand(1) == Op)
+ return SimplifyBinOp(B->getOpcode(), B->getOperand(0), RepOp, DL, TLI);
}
// Same for CmpInsts.
OpenPOWER on IntegriCloud