[polly] independent blocks: when moving values, invalidate SCEV cached info

Tobias Grosser tobias at grosser.es
Mon May 6 00:13:28 PDT 2013


On 05/03/2013 07:52 PM, Sebastian Pop wrote:
> Tobias Grosser wrote:
>> On 05/02/2013 10:57 PM, Sebastian Pop wrote:
>>> Hi,
>>>
>>> IndependentBlocks::moveOperandTree already calls SE->forgetValue() in exactly
>>> one case, however there are other cases where it does not call forgetValue
>>> leading to crashes due to cached SCEVs that refer to values that no longer
>>> exist.  The attached patch adds more calls to forgetValue whenever a value is
>>> moved (and so renamed) to the new code generated for the scop.
>>
>> Hi Sebastian,
>>
>> I understand that we may need to forget more values in the
>> IndependentBlocks pass, but I am currently still wondering if moving
>> a value always invalidates its SCEV.
>
> It is not the scev of the value that we move that should change: it is all the
> other scevs using the value we are moving that have to be recomputed in function
> of code that will remain after removing the original scop.

I see. The patch seems fine then, except some tiny change to the test's 
RUN line.

+; RUN: opt %loadPolly -basicaa -polly-prepare -polly-region-simplify 
-polly-independent %s

-polly-region-simplify is not needed and is actually removed in the most 
recent versions of Polly.

-basicaa and -polly-prepare also do not seem to be needed, hence we 
should remove them.

Finally we should use '< %s' instead of just '%s' to not leave temporary 
files (I missed this for some older test cases, but I believe we should 
now converge to '< %s')

Enable -polly-codegen-scev. In Polly we need this flag to actually 
trigger the bug.

Thanks,
Tobi



More information about the llvm-commits mailing list