[InstCombine] avoid infinite loops with select/icmp transforms
authorSanjay Patel <spatel@rotateright.com>
Tue, 4 May 2021 15:43:01 +0000 (11:43 -0400)
committerSanjay Patel <spatel@rotateright.com>
Tue, 4 May 2021 15:54:06 +0000 (11:54 -0400)
commita6f79b56711e009440d00685e36c1fb919659202
tree5b5238074512861584840822b9eb3a6464e732c9
parent73686247ac3e60c91fa5943c98956093df5e49ff
[InstCombine] avoid infinite loops with select/icmp transforms

This fixes https://llvm.org/PR48900 , but as seen in the
regression tests prevents some optimizations.

There are a few options to restore those (switch to min/max
intrinsics, add larger pattern matching for select with
dominating condition, improve CVP), but we need to prevent
the bug 1st.
llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
llvm/test/Transforms/InstCombine/icmp-dom.ll