summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorRenato Golin <renato.golin@linaro.org>2015-06-05 18:24:12 +0000
committerRenato Golin <renato.golin@linaro.org>2015-06-05 18:24:12 +0000
commit3dabb233845f4385e649377d85a21b667a8ed8de (patch)
tree7f4b6ccda69fca21f2b578e3e2ffc409714ca1e4 /llvm/lib
parentb20fbb8b15881e1bc6167b5590e0d68d7b076598 (diff)
downloadbcm5719-llvm-3dabb233845f4385e649377d85a21b667a8ed8de.tar.gz
bcm5719-llvm-3dabb233845f4385e649377d85a21b667a8ed8de.zip
Revert "[InstCombine] Rephrase fix to SimplifyWithOpReplaced"
This reverts commit r239141. This commit was an attempt to reintroduce a previous patch that broke many self-hosting bots with clang timeouts, but it still has slowdown issues, at least on ARM, increasing the compilation time (stage 2, clang's) by 5x. llvm-svn: 239175
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp26
1 files changed, 4 insertions, 22 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
index 68ddb27ec4a..d2fbcdd3991 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
@@ -598,24 +598,6 @@ Instruction *InstCombiner::visitSelectInstWithICmp(SelectInst &SI,
}
}
- // 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.
- auto StripBinOpFlags = [](Value *V) {
- if (auto *B = dyn_cast<BinaryOperator>(V)) {
- if (isa<OverflowingBinaryOperator>(B)) {
- B->setHasNoSignedWrap(false);
- B->setHasNoUnsignedWrap(false);
- }
- if (isa<PossiblyExactOperator>(B))
- B->setIsExact(false);
- }
- return V;
- };
-
// If we have an equality comparison then we know the value in one of the
// arms of the select. See if substituting this value into the arm and
// simplifying the result yields the same value as the other arm.
@@ -624,23 +606,23 @@ Instruction *InstCombiner::visitSelectInstWithICmp(SelectInst &SI,
TrueVal ||
SimplifyWithOpReplaced(FalseVal, CmpRHS, CmpLHS, TLI, DL, DT, AC) ==
TrueVal)
- return ReplaceInstUsesWith(SI, StripBinOpFlags(FalseVal));
+ return ReplaceInstUsesWith(SI, FalseVal);
if (SimplifyWithOpReplaced(TrueVal, CmpLHS, CmpRHS, TLI, DL, DT, AC) ==
FalseVal ||
SimplifyWithOpReplaced(TrueVal, CmpRHS, CmpLHS, TLI, DL, DT, AC) ==
FalseVal)
- return ReplaceInstUsesWith(SI, StripBinOpFlags(FalseVal));
+ return ReplaceInstUsesWith(SI, FalseVal);
} else if (Pred == ICmpInst::ICMP_NE) {
if (SimplifyWithOpReplaced(TrueVal, CmpLHS, CmpRHS, TLI, DL, DT, AC) ==
FalseVal ||
SimplifyWithOpReplaced(TrueVal, CmpRHS, CmpLHS, TLI, DL, DT, AC) ==
FalseVal)
- return ReplaceInstUsesWith(SI, StripBinOpFlags(TrueVal));
+ return ReplaceInstUsesWith(SI, TrueVal);
if (SimplifyWithOpReplaced(FalseVal, CmpLHS, CmpRHS, TLI, DL, DT, AC) ==
TrueVal ||
SimplifyWithOpReplaced(FalseVal, CmpRHS, CmpLHS, TLI, DL, DT, AC) ==
TrueVal)
- return ReplaceInstUsesWith(SI, StripBinOpFlags(TrueVal));
+ return ReplaceInstUsesWith(SI, TrueVal);
}
// NOTE: if we wanted to, this is where to detect integer MIN/MAX
OpenPOWER on IntegriCloud