Attempt to sort the pointers in VL and return the sorted indices in SortedIndices, if reordering is required.

Synopsis

Declared in <llvm/Analysis/LoopAccessAnalysis.h>

bool
sortPtrAccesses(
    ArrayRef<Value*> VL,
    Type* ElemTy,
    DataLayout const& DL,
    ScalarEvolution& SE,
    SmallVectorImpl<unsigned int>& SortedIndices);

Description

Returns 'true' if sorting is legal, otherwise returns 'false'.

For example, for a given VL of memory accesses in program order, a[i+4], a[i+0], a[i+1]and a[i+7], this function will sort the VL and save the sorted indices in SortedIndices as a[i+0], a[i+1], a[i+4], a[i+7]and saves the mask for actual memory accesses in program order in SortedIndices as <1,2,0,3>

Return Value

True if sorting is legal; false otherwise.

Parameters

Name

Description

VL

Pointer values of the memory accesses in program order.

ElemTy

Element type of the accesses in VL.

DL

Data layout used to compute type sizes and offsets.

SE

ScalarEvolution used to compare pointer distances.

SortedIndices

Filled with the permutation that sorts VL.

Created with MrDocs