[llvm-commits] [llvm] r139517 - in /llvm/trunk: lib/Transforms/Scalar/ test/Transforms/IndVarSimplify/ test/Transforms/LoopUnroll/

Tobias Grosser tobias at grosser.es
Mon Sep 12 13:31:45 PDT 2011


On 09/12/2011 09:19 PM, Andrew Trick wrote:
> On Sep 12, 2011, at 11:48 AM, Tobias Grosser wrote:
>
>> On 09/12/2011 07:28 PM, Andrew Trick wrote:
>>> Author: atrick
>>> Date: Mon Sep 12 13:28:44 2011
>>> New Revision: 139517
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=139517&view=rev
>>> Log:
>>> Rename -disable-iv-rewrite to -enable-iv-rewrite=false in preparation for default change.
>>
>> Hi Andrew,
>>
>> this is interesting. This suggest that LLVM does not need canonical induction variables any more or that they are created somewhere else.
>>
>> Can you explain why we do not need this anymore and if there would be another preferable way to get something similar. (I use in Polly canonical induction variables)
>>
>> Cheers
>> Tobi
>
> That's good to know. I hadn't planned on removing the "feature", although it would clean things up quite a bit. We just can't guarantee the best code will be generated with canonical IVs.
OK, but even disabling it by default will be a problem for us (as we would
need to enable it explicitly and it just shows that Polly is here not up to
date). This does not mean you should not disable it, it just means here 
is a problem I need to reason about.

> In general we want IR to be in canonical form as long as we can do so while retaining other important properties, and the transformation doesn't obviously pessimize the code. With IVs this is tricky. That's why ScalarEvolution represents canonical IVs in an expression database. Please use SCEV if this is what you need.
We use SCEV extensively and it actually works great.

> At the IR level, it's not even clear to me how to ideally define canonical IVs. Not strength reduced at all, fully strength reduced? Either way, downstream passes should not have a strong dependence on the form of IV.
Alright.

> Which properties of LLVM's current canonical IVs do you rely on? Single phi for all IVs? Loop counter counting up from zero? Straight line array index computation?
The first two. A single IV, counting from zero upwards in steps of one.

> I don't know much about Polly, but there's no question that dependence analysis should make use of SCEV.
I fully agree. We do not use it for any analysis, but for final code 
generation. Here it seemed a lot simpler to rewrite based on canonical 
induction variables. I will have another look and see if we can find an 
approach that does not rely on the induction variables being
canonical.

Thanks for your explanation
Tobi



More information about the llvm-commits mailing list