[llvm] [InstCombine] Simplify and/or of icmp eq with op replacement (PR #70335)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 2 08:08:53 PDT 2023
nikic wrote:
I believe the problem is this:
```llvm
define i1 @test(ptr %arg, ptr %arg2) {
%icmp = icmp eq ptr %arg, %arg2
%call = call i1 @llvm.is.constant.i1(i1 %icmp)
%and = and i1 %call, %icmp
ret i1 %and
}
declare i1 @llvm.is.constant.i1(i1)
```
The `is.constant` check gets folded away. I'd normally say this is just a QoI issue, but it seems that the libstdc++ implementation relies on this in some way I don't fully understand (there is a specialization of `std::distance` on `std::list` for getting the size of the full list, and then that is used in `_Finalize_merge` where we are currently in the process of updating list sizes, or something like that).
So I guess we should exclude llvm.is.constant from being folded by simplifyWithOpReplaced.
https://github.com/llvm/llvm-project/pull/70335
More information about the llvm-commits
mailing list