[llvm] d672c81 - [InstCombine] use safe transformation by default
Juneyoung Lee via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 7 09:26:03 PST 2021
Author: Juneyoung Lee
Date: 2021-03-08T02:25:29+09:00
New Revision: d672c81126550a1b74ef77adfb7e7d1dd728a61e
URL: https://github.com/llvm/llvm-project/commit/d672c81126550a1b74ef77adfb7e7d1dd728a61e
DIFF: https://github.com/llvm/llvm-project/commit/d672c81126550a1b74ef77adfb7e7d1dd728a61e.diff
LOG: [InstCombine] use safe transformation by default
.. since it will be folded into and/or anyway
Added:
Modified:
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
index 7d9383c346c8..6ad10f90d7ca 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
@@ -2890,11 +2890,7 @@ Instruction *InstCombinerImpl::visitSelectInst(SelectInst &SI) {
// shortening paths for the values (this helps getUnderlyingObjects() for
// example).
if (TrueSI->getFalseValue() == FalseVal && TrueSI->hasOneUse()) {
- // Simply merging into and i1 isn't poison-safe. Do it only when
- // EnableUnsafeSelectTransform is set.
- Value *And = EnableUnsafeSelectTransform ?
- Builder.CreateAnd(CondVal, TrueSI->getCondition()) :
- Builder.CreateLogicalAnd(CondVal, TrueSI->getCondition());
+ Value *And = Builder.CreateLogicalAnd(CondVal, TrueSI->getCondition());
replaceOperand(SI, 0, And);
replaceOperand(SI, 1, TrueSI->getTrueValue());
return &SI;
@@ -2911,11 +2907,7 @@ Instruction *InstCombinerImpl::visitSelectInst(SelectInst &SI) {
}
// select(C0, a, select(C1, a, b)) -> select(C0|C1, a, b)
if (FalseSI->getTrueValue() == TrueVal && FalseSI->hasOneUse()) {
- // Simply merging into or i1 isn't poison-safe. Do it only when
- // EnableUnsafeSelectTransform is set.
- Value *Or = EnableUnsafeSelectTransform ?
- Builder.CreateOr(CondVal, FalseSI->getCondition()) :
- Builder.CreateLogicalOr(CondVal, FalseSI->getCondition());
+ Value *Or = Builder.CreateLogicalOr(CondVal, FalseSI->getCondition());
replaceOperand(SI, 0, Or);
replaceOperand(SI, 2, FalseSI->getFalseValue());
return &SI;
More information about the llvm-commits
mailing list