[llvm-dev] [SCEV][ScalarEvolution] SE limitation impacting LV

Sanjoy Das via llvm-dev llvm-dev at lists.llvm.org
Thu Nov 23 12:03:41 PST 2017

On Wed, Nov 22, 2017 at 4:23 PM, Friedman, Eli <efriedma at codeaurora.org> wrote:
> The PHI node %18 is equivalent to a recurrence, so in theory SCEV could
> analyze it... but it would be complicated to prove that.  Specifically, it
> would have to prove %17 - 1 == %18, which means proving the relationship
> between %bc.resume.val and %bc.resume.val1.  There isn't any code in SCEV to
> do that sort of analysis.


>>         > SCEV is fairly conservative around PHI nodes that aren't
>> recurrences and aren't obviously equivalent to a min-max branch-phi idiom.
>> Is that the limitation you're running into here?
>>   Yes, that's exactly the problem. The problematic PHI nodes
>> (%bc.resume.val and %bc.resume.val1) aren't either recurrences or related to
>> min-max idioms. I have a tentative fix for the LV bug and I just wanted to
>> know if this is something that should also be fixed at SCEV level to report
>> a bug accordingly. Your previous comment sounds like "this is a well-known
>> limitation in SCEV" so maybe there is nothing new to report.


However, feel free to send patches if there are specific cases you
want SCEV to handle (design-wise a limited amount of ad-hoc logic here
seems fine to me:

-- Sanjoy

More information about the llvm-dev mailing list