[llvm] [BDCE] Handle multi-use `select` of `and`s on demanded bits (PR #79688)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 27 03:15:13 PST 2024
================
@@ -125,6 +125,33 @@ static bool bitTrackingDCE(Function &F, DemandedBits &DB) {
}
}
+ // Simplify select of ands when the mask does not affect the demanded bits.
+ if (SelectInst *SI = dyn_cast<SelectInst>(&I)) {
+ APInt Demanded = DB.getDemandedBits(SI);
+ if (!Demanded.isAllOnes()) {
+ for (Use &U : I.operands()) {
----------------
dtcxzyw wrote:
```suggestion
for (Use &U : I.operands().drop_front()) {
```
https://github.com/llvm/llvm-project/pull/79688
More information about the llvm-commits
mailing list