[InstCombine] reorder folds to reduce chance of infinite loops
authorSanjay Patel <spatel@rotateright.com>
Thu, 13 Sep 2018 16:04:06 +0000 (16:04 +0000)
committerSanjay Patel <spatel@rotateright.com>
Thu, 13 Sep 2018 16:04:06 +0000 (16:04 +0000)
commit6f00fc3317f3fba3d7602fe98889c74127141c8d
tree60a43f3cf3e9952aabfe938e4352b2cc94fefcac
parentf31f596152befc309a83f00f164b8145ca9485b3
[InstCombine] reorder folds to reduce chance of infinite loops

I don't have a test case for this, but it's motivated by
the discussion in D51964, and I've added TODO comments for
the better fix - move simplifications into instsimplify
because that's more efficient and reduces risk of infinite
loops in instcombine caused by transforms trying to do the
opposite folds.

In this case, we know that the transform that tries to move
'not' through min/max can be fooled by the multiple uses
of a value in another min/max, so try to squash the
foldSPFofSPF() patterns first.

llvm-svn: 342147
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp