[InstCombine] Relax one-use check for icmp of gep fold
commit4a2a6397f11da7c15a73d19fb1e6c9dcd1ceb5af
authorNikita Popov <npopov@redhat.com>
Fri, 8 Dec 2023 14:40:32 +0000 (8 15:40 +0100)
committerNikita Popov <npopov@redhat.com>
Fri, 8 Dec 2023 14:45:58 +0000 (8 15:45 +0100)
tree332b42db22e1eaeff717e0e3889e1335076492cd
parentcf029a22bd0c87bb475ee0440e9085bb96c7e011
[InstCombine] Relax one-use check for icmp of gep fold

Instead of checking whether the GEP as a whole is constant, only
check whether it has constant incides. This matches what we do in
other places in this code.

This has little practical impact, because it is mostly already
handled through other cases anyway. We see a difference for
non-inbounds equality comparisons.
llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
llvm/test/Transforms/InstCombine/icmp-gep.ll