[PATCH] D102615: [LoopDeletion] Break backedge if we can prove that the loop is exited on 1st iteration (try 3)

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 7 21:13:11 PDT 2021


mkazantsev added a comment.

SCEV is much more powerful in terms of simplification. Imagine the situation when some Phi takes value of `a + b + c` on the 1st iteration (and unknown on all others), then gets subtracted by `a`, then by `b`, and then by `c`, and then the result is compared against zero. If we want `InstSimplify` to do something like this, we will need to re-implement recrusive expression aggregation, simplification, in summary - we will need to re-invent SCEV.

I'm also sceptical about the approach that we are following (cripple the opts to save compile time). I'd rather prefer it to be `isKnownPredicateAt`, maybe under a flag, to use as much power as it can.

If the SCEV's CT impact is still unacceptable, we can cripple it even further to use `isKnownViaNonRecursiveReasoning`, but basically in this case we can just go with `-O0` and stay happy about the results.


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

https://reviews.llvm.org/D102615



More information about the llvm-commits mailing list