[InstCombine] avoid crash on fold of icmp with cast operand
authorSanjay Patel <spatel@rotateright.com>
Wed, 18 May 2022 13:07:07 +0000 (09:07 -0400)
committerSanjay Patel <spatel@rotateright.com>
Wed, 18 May 2022 13:16:30 +0000 (09:16 -0400)
commit990cc49ca0ca216b3901beb015e5c00d2da40bf2
treef03b10f088f87d7e1360243b2c595a555a364847
parentbe6d7cc93c45fff4c891c4b4952a7acca2439bc2
[InstCombine] avoid crash on fold of icmp with cast operand

We could do better by inserting a bitcast from scalar int
to vector int or using an insertelement (the alternate test
does not crash because there's an independent fold like that).

But this doesn't seem like a likely pattern, so just bail out
for now.

Fixes issue #55516.
llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
llvm/test/Transforms/InstCombine/cast-int-icmp-eq-0.ll