aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/ConstantFold.cpp
diff options
context:
space:
mode:
authorJuneyoung Lee <aqjune@gmail.com>2021-06-24 02:03:07 +0900
committerJuneyoung Lee <aqjune@gmail.com>2021-06-24 02:03:09 +0900
commit2fd3037ac615643fe8058292d2b89bb19a49cb2f (patch)
treeb2fd7b6646dd4f53a2889f21ede614dab8cd4a25 /llvm/lib/IR/ConstantFold.cpp
parent00d3f7cc3c264adc360d0282ba8a27de2a004b94 (diff)
downloadllvm-2fd3037ac615643fe8058292d2b89bb19a49cb2f.zip
llvm-2fd3037ac615643fe8058292d2b89bb19a49cb2f.tar.gz
llvm-2fd3037ac615643fe8058292d2b89bb19a49cb2f.tar.bz2
[ConstantFold] Allow propagation of poison for and/or i1
They were disallowed due to its bad interaction with select i1 -> and/or i1. The transformation is now disabled by D101191, so let's revive this.
Diffstat (limited to 'llvm/lib/IR/ConstantFold.cpp')
-rw-r--r--llvm/lib/IR/ConstantFold.cpp9
1 files changed, 1 insertions, 8 deletions
diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp
index 652ccd3..e292578 100644
--- a/llvm/lib/IR/ConstantFold.cpp
+++ b/llvm/lib/IR/ConstantFold.cpp
@@ -1124,14 +1124,7 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode, Constant *C1,
}
// Binary operations propagate poison.
- // FIXME: Currently, or/and i1 poison aren't folded into poison because
- // it causes miscompilation when combined with another optimization in
- // InstCombine (select i1 -> and/or). The select fold is wrong, but
- // fixing it requires an effort, so temporarily disable this until it is
- // fixed.
- bool PoisonFold = !C1->getType()->isIntegerTy(1) ||
- (Opcode != Instruction::Or && Opcode != Instruction::And);
- if (PoisonFold && (isa<PoisonValue>(C1) || isa<PoisonValue>(C2)))
+ if (isa<PoisonValue>(C1) || isa<PoisonValue>(C2))
return PoisonValue::get(C1->getType());
// Handle scalar UndefValue and scalable vector UndefValue. Fixed-length