[llvm-commits] [PATCH] BasicBlock Autovectorization Pass
Tobias Grosser
tobias at grosser.es
Fri Nov 11 14:55:53 PST 2011
On 11/11/2011 11:36 PM, Hal Finkel wrote:
> On Thu, 2011-11-10 at 23:07 +0100, Tobias Grosser wrote:
>> On 11/08/2011 11:29 PM, Hal Finkel wrote:
>> Talking about this I looked again into ScalarEvolution.
>>
>> To analyze a load, you would do:
>>
>> LoadInst *Load = ...
>> Value *Pointer = Load->getPointer();
>> const SCEV *PointerSCEV = SE->getSCEV(Pointer);
>> const SCEVUnknown *PointerBase =
>> dyn_cast<SCEVUnknown>(SE->getPointerBase(PointerSCEV));
>>
>> if (!PointerBase)
>> return 'Analysis failed'
>>
>> const Value *BaseValue = PointerBase->getValue();
>>
>> You get the offset between two load addresses with SE->getMinusSCEV().
>> The size of an element is SE->getSizeOfExpr().
>>
>
> The AliasAnalysis class has a set of interfaces that can be used to
> preserve the analysis even when some things are changed. Does
> ScalarEvolution have a similar capability?
You can state that your pass preserves ScalarEvolution. In this case all
analysis results are by default preserved and it is your job to
invalidate the scalar evolution for the loops/values where it needs to
be recalculated.
The relevant functions are
ScalarEvolution::forgetValue(Value *)
ScalarEvolution::forgetLoop(Loop *)
Cheers
Tobi
More information about the llvm-commits
mailing list