[llvm] [ValueTracking] Handle intrinsics in `computeConstantRange` (PR #100870)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 27 07:22:48 PDT 2024
dtcxzyw wrote:
My original plan is to set range metadata for `ctpop` in InstCombine: https://github.com/llvm/llvm-project/issues/95255#issuecomment-2166944909
https://github.com/llvm/llvm-project/blob/154d00d5d0416c42388d6e82cac96fbc091101d2/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp#L694-L701
```
define i1 @src(i32 noundef %n) {
entry:
%tobool = icmp ne i32 %n, 0
call void @llvm.assume(i1 %tobool)
%0 = tail call i32 @llvm.ctpop.i32(i32 %n)
%cmp = icmp eq i32 %0, 1
ret i1 %cmp
}
define i1 @tgt(i32 noundef %n) {
entry:
%tobool = icmp ne i32 %n, 0
call void @llvm.assume(i1 %tobool)
%0 = tail call range(i32 1, 33) i32 @llvm.ctpop.i32(i32 %n)
%cmp = icmp eq i32 %0, 1
ret i1 %cmp
}
```
Is it ok to infer range metadata for `ctpop` in CVP/SCCP?
https://github.com/llvm/llvm-project/pull/100870
More information about the llvm-commits
mailing list