[llvm-dev] SCEV cannot compute the trip count of Simple loop

Sanjoy Das via llvm-dev llvm-dev at lists.llvm.org
Fri Sep 16 16:05:46 PDT 2016


Hi Kevin,

Kevin Choi wrote:
 > @Sanjoy, what's the issue with <nsw>?

I'll write up something in a central location and share it.

 > Moreover, why can't SCEV detect
 > that x is loop invariant and just take the diff/incr?

Detecting the loop invariance of x is not the problem.  SCEV currently
stumbles on proving that "x + 1" and "x + 3" don't overflow.

If "x + 1" and "x + 3" cannot be proven to overflow then the loop no
longer has a constant trip count of "2".  For instance if "x" is
INT_MAX-1 then the loop will run 0 times.

-- Sanjoy


More information about the llvm-dev mailing list