[llvm] SCEV: teach isImpliedViaOperations about samesign (PR #124270)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 29 02:17:35 PST 2025


artagnon wrote:

> Further reduced case:

Yes, after loop-simplify. 
 
> Before:
> Loop %.lr.ph: backedge-taken count is (-1 + (1 smax {(-1 + %0),+,-1}<nsw><%.lr.ph4>))<nsw>
> Loop %.lr.ph: constant max backedge-taken count is i32 2147483646
> Loop %.lr.ph: symbolic max backedge-taken count is (-1 + (1 smax {(-1 + %0),+,-1}<nsw><%.lr.ph4>))<nsw>
> Loop %.lr.ph: Trip multiple is 1
> Loop %.lr.ph4: backedge-taken count is (-1 + %0)
> Loop %.lr.ph4: constant max backedge-taken count is i32 2147483646
> Loop %.lr.ph4: symbolic max backedge-taken count is (-1 + %0)
> Loop %.lr.ph4: Trip multiple is 1

> After:
> Loop %.lr.ph: backedge-taken count is {(-2 + %0),+,-1}<nw><%.lr.ph4>
> Loop %.lr.ph: constant max backedge-taken count is i32 2147483646
> Loop %.lr.ph: symbolic max backedge-taken count is {(-2 + %0),+,-1}<nw><%.lr.ph4>
> Loop %.lr.ph: Trip multiple is 1
> Loop %.lr.ph4: backedge-taken count is (-1 + %0)
> Loop %.lr.ph4: constant max backedge-taken count is i32 2147483646
> Loop %.lr.ph4: symbolic max backedge-taken count is (-1 + %0)
> Loop %.lr.ph4: Trip multiple is 1

Isn't the symbolic-BTC and BTC more refined? Have to think about why this introduces a regression.

https://github.com/llvm/llvm-project/pull/124270


More information about the llvm-commits mailing list