Issue |
128152
|
Summary |
Power of two assumption optimized away
|
Labels |
new issue
|
Assignees |
|
Reporter |
nikic
|
https://llvm.godbolt.org/z/z3E6641E1
```llvm
; RUN: opt -S -passes=instsimplify < %s
define i1 @foo(i32 %x) {
%ctpop = call i32 @llvm.ctpop.i32(i32 %x)
%cond = icmp eq i32 %ctpop, 1
%ext = zext i1 %cond to i8
call void @llvm.assume(i1 %cond)
%res = icmp eq i32 %x, 0
ret i1 %res
}
```
Results in:
```
define i1 @foo(i32 %x) {
%res = icmp eq i32 %x, 0
ret i1 %res
}
```
Note that the dead `%ext` is relevant.
Without looking into it, I assume that the problem is that we're using https://github.com/llvm/llvm-project/blob/aad74dc971f789b2974fde4181f87ee20db2998d/llvm/lib/Analysis/InstructionSimplify.cpp#L6307-L6310 with an ephemeral value, and the extra use in `%ext` is what makes use currently think it is non-ephemeral.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs