[llvm] [LLVM] Improve the DemandedBits Analysis (PR #148853)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 15 09:44:38 PDT 2025
https://github.com/dtcxzyw commented:
Can you provide the alive2 proof? See also https://llvm.org/docs/InstCombineContributorGuide.html#proofs.
You can use an extra integer parameter as the source of garbage bits:
```
define i32 @src(i32 %x, i32 %y, i32 noundef %z) {
%div = udiv i32 %x, %y
ret i32 %div
}
define i32 @tgt(i32 %x, i32 %y, i32 noundef %z) {
%demanded_mask = ...
%demanded_mask_inv = xor %demanded_mask, -1
%x_demanded = and i32 %x, %demanded_mask
%x_garbage = and i32 %z, %demanded_mask_inv
%x_new = or disjoint %x_demanded, %x_garbage
%div = udiv i32 %x_new, %y
ret i32 %div
}
```
https://github.com/llvm/llvm-project/pull/148853
More information about the llvm-commits
mailing list