[llvm] [BDCE] Handle multi-use `and`/`or` on demanded bits (PR #79688)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 27 19:24:22 PST 2024
================
@@ -125,6 +125,28 @@ static bool bitTrackingDCE(Function &F, DemandedBits &DB) {
}
}
+ // Simplify `and` or `or` when their mask does not affect the demanded bits.
+ if (auto *BO = dyn_cast<BinaryOperator>(&I)) {
+ unsigned Opc = BO->getOpcode();
+ if (Opc == Instruction::And || Opc == Instruction::Or) {
----------------
XChy wrote:
Could you turn it into a switch, please? I think there is room for other operators like `xor`, `add` to be here in the future.
https://github.com/llvm/llvm-project/pull/79688
More information about the llvm-commits
mailing list