1. [InstCombine] make icmp vector canonicalization safe for constant with (details)
Commit a22282be54b309ce7ab0e6bf8595893384971646 by spatel
[InstCombine] make icmp vector canonicalization safe for constant with
undef elements
This is a fix for:
...and as shown there, we have existing test cases that show potential
We could just bail out for vector constants that contain any undef
elements, or we can do as shown here: allow the transform, but replace
the undefs with a safe value.
For most of the tests shown, this results in a full splat constant (no
undefs) which is probably a win for further IR analysis because we
conservatively don't match undefs in most cases. Codegen can probably
recover these kinds of undef lanes via demanded elements analysis if
that's profitable.
Differential Revision:
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
The file was modifiedllvm/test/Transforms/InstCombine/reuse-constant-from-select-in-icmp.ll
The file was modifiedllvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-sle-to-icmp-sle.ll
The file was modifiedllvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-ule-to-icmp-ule.ll
The file was modifiedllvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-uge-to-icmp-ule.ll
The file was modifiedllvm/test/Transforms/InstCombine/icmp-vec.ll
The file was modifiedllvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-eq-to-icmp-ule.ll
The file was modifiedllvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-sge-to-icmp-sle.ll