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

Andrew Trick atrick at apple.com
Mon Sep 12 13:19:34 PDT 2011


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.

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.

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.

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?

I don't know much about Polly, but there's no question that dependence analysis should make use of SCEV.

-Andy



More information about the llvm-commits mailing list