OSDN Git Service

[InstCombine] avoid creating an extra instruction in zext fold and possible inf-loop
authorSanjay Patel <spatel@rotateright.com>
Sat, 13 Mar 2021 13:26:27 +0000 (08:26 -0500)
committerTom Stellard <tstellar@redhat.com>
Tue, 30 Mar 2021 21:28:12 +0000 (14:28 -0700)
commitff2cf8fafa5ad9a76e59fa086d969d4e2ecc3a39
tree3f2489df82598976afdec93c536c95c3cfeb1722
parent5b3480610383ba281ef0c7918a6c097058a408d4
[InstCombine] avoid creating an extra instruction in zext fold and possible inf-loop

The structure of this fold is suspect vs. most of instcombine
because it creates instructions and tries to delete them
immediately after.

If we don't have the operand types for the icmps, then we are
not behaving as assumed. And as shown in PR49475, we can inf-loop.

(cherry picked from commit 4224a36957420744756d6a6450eb6502a1bfadc3)
llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
llvm/test/Transforms/InstCombine/zext-or-icmp.ll