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>

Parameters

Name

Description

VL

Represent a constant reference to an array (0 or more elements consecutively in memory), i.e. a start pointer and a length. It allows various APIs to take consecutive elements easily and conveniently.

ElemTy

The instances of the Type class are immutable: once they are created, they are never changed. Also note that only one instance of a particular type is ever created. Thus seeing if two types are equal is a matter of doing a trivial pointer comparison. To enforce that no two equal instances are created, Type instances can only be created via static factory methods in class Type and in derived classes. Once allocated, Types are never free'd.

DL

A parsed version of the target data layout string in and methods for querying it.

SE

The main scalar evolution driver. Because client code (intentionally) can't do much with the SCEV objects directly, they must ask this class for services.

SortedIndices

This class consists of common code factored out of the SmallVector class to reduce code duplication based on the SmallVector 'N' template parameter.

Created with MrDocs