[llvm] [InstCombine] Replace an integer comparison of a `phi` node with multiple `ucmp`/`scmp` operands and a constant with `phi` of individual comparisons of original intrinsic's arguments (PR #107769)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 11 10:19:29 PDT 2024
nikic wrote:
> > Worth noting that as implemented, the one-use check is also load-bearing for correctness, not just profitability. Otherwise we'd have to make sure we handle multi-edges correctly.
>
> I don't think I quite understand the problem, can you give an example of a test case where removing the one-use check would cause issues?
Something like this: https://llvm.godbolt.org/z/zEfdK4b3W The tricky part is that a predecessors occurs two times in the phi, and the value must be the same for both. So if we clone the instruction two times, we'd get a verifier error. To support this case we would need to make sure that we only clone once per duplicate predecessor.
With the one-use limitation, this is a problem we can ignore for now.
https://github.com/llvm/llvm-project/pull/107769
More information about the llvm-commits
mailing list