[InstCombine] Negator: while there, add detection for cycles during negation
authorRoman Lebedev <lebedev.ri@gmail.com>
Wed, 17 Jun 2020 19:33:44 +0000 (22:33 +0300)
committerRoman Lebedev <lebedev.ri@gmail.com>
Wed, 17 Jun 2020 19:47:20 +0000 (22:47 +0300)
commit84b4f5a6a6bc834c325edef7baec335b81b6e367
treefdb93b21fff0f873e8ab46874e165507f6f38154
parente3d8cb1e1d227c61576914e42435b5e71d442631
[InstCombine] Negator: while there, add detection for cycles during negation

I don't have any testcases showing it happening,
and i haven't succeeded in creating one,
but i'm also not positive it can't ever happen,
and i recall having something that looked like
that in the very beginning of Negator creation.

But since we now already have a negation cache,
we can now detect such cases practically for free.

Let's do so instead of "relying" on stack overflow :D
llvm/lib/Transforms/InstCombine/InstCombineNegator.cpp