[llvm] r235311 - Recognize n/1 in the SCEV divide function

Brendon Cahoon bcahoon at codeaurora.org
Mon Apr 20 14:27:08 PDT 2015


This is needed for correctness, in my opinion.   And, I agree, that it
certainly seems there are similar potential issues in the divide() code,
though I don't have any test cases.

The final result of divide() does generate a N = D * Q + R, but there is no
check that R is < D.  I'm not quite sure what is the best way to enforce
this constraint? I believe the problem is that the "default" action of the
SCEVDivision visitor functions is to set the Quotient to 0 and the Remainder
to the Numerator.  Then, these values are used/combined in other visitor
functions as the SCEVs for the Numerator and Denominator are traversed,
which generates a final quotient and remainder.

-----Original Message-----
From: Nick Lewycky [mailto:nicholas at mxc.ca] 
Sent: Monday, April 20, 2015 3:38 PM
To: Brendon Cahoon
Cc: llvm-commits at cs.uiuc.edu
Subject: Re: [llvm] r235311 - Recognize n/1 in the SCEV divide function

Wait, this is needed for correctness? Are you sure this isn't papering over
a bug in the divide() code?





More information about the llvm-commits mailing list