[PATCH] D83160: [InstCombine] Lower infinite combine loop detection thresholds

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 4 11:17:05 PDT 2020


lebedev.ri added a comment.

In D83160#2131473 <https://reviews.llvm.org/D83160#2131473>, @kuhar wrote:

> Overall, I think this is a good direction, but I'd like to understand better why InstCombine needs more than a few iterations and how 'fix' these cases without bailing out after a fixed number of iterations.
>  I'd be interested to find out if we can make an IR pattern generator that forces InstCombine to run N iterations. Are there any algorithmic guarantees of the current implementation which we could use to show that InstCombine doesn't go into an infinite loop?


@nikic can say more, but the general idea is that instcombine traditionally didn't pay much attention
to adding instructions-to-be-revisited back into worklist after changing something,
so we wouldn't revisit some instructions until we do the next iteration with worklist containing all function's instructions.

The main fix is to ensure that we consistently replenish worklist.
The fix is NOT to bailout after a number of iterations.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83160/new/

https://reviews.llvm.org/D83160





More information about the llvm-commits mailing list