[llvm-commits] [PATCH] BasicBlock Autovectorization Pass

Hal Finkel hfinkel at anl.gov
Fri Nov 11 15:11:23 PST 2011


On Fri, 2011-11-11 at 23:55 +0100, Tobias Grosser wrote:
> 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 *)

Since the vectorization pass is currently just a basic-block pass, I
think that I should need only forgetValue, right? I suppose that I would
call that on all of the values that are fused.

Also, using getPointerBase to get the base pointer seems simple enough,
but how should I use getMinusSCEV to get the offset. Should I call it on
each load pointer and its base pointer, or between the two load pointers
once I know that they share the same base. And once I do that, how do I
get the offset (if known). I see the get[Uns|S]ignedRange functions, but
if there is a way to directly get a constant value, then that would be
more straightforward.

Thanks again,
Hal

> ScalarEvolution::forgetLoop(Loop *)
> 
> Cheers
> Tobi

-- 
Hal Finkel
Postdoctoral Appointee
Leadership Computing Facility
Argonne National Laboratory




More information about the llvm-commits mailing list