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

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 17 03:05:21 PDT 2021


nikic added a comment.

In D102615#2824097 <https://reviews.llvm.org/D102615#2824097>, @mkazantsev wrote:

>> This is surprising to me -- why does this require changes to InstSimplify?
>
> InstSimplify does not provide public API for this:
>
>   const SCEV *LHSS = getSCEVOnFirstIteration(LHS, L, SE, FirstIterSCEV);
>   const SCEV *RHSS = getSCEVOnFirstIteration(RHS, L, SE, FirstIterSCEV);
>   S = SE.getAddExpr(LHSS, RHSS);
>
> It has `SimplifyAddInst` that works with custom arguments, but it's currently static within the cpp file. I'd need to expose all of them. At least this, maybe more.

The public API is `SimplifyBinOp()`, which works for all binary operators. See https://github.com/llvm/llvm-project/commit/5aa9bbc50a1fed1364caaa7edc9273fb38de990d for usage in this context. InstSimplify lacks an API that works generically overall instructions (with operands provided separately), but it exposes a couple of these high-level functions.


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

https://reviews.llvm.org/D102615



More information about the llvm-commits mailing list