Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions llvm/include/llvm/Analysis/Delinearization.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,8 @@ bool findFixedSizeArrayDimensions(ScalarEvolution &SE, const SCEV *Expr,
/// terms exist in the \p Expr. In other words, it assumes that the all step
/// values are constant.
///
/// This function is intended to replace getIndexExpressionsFromGEP and
/// tryDelinearizeFixedSizeImpl. They rely on the GEP source element type so
/// that they will be removed in the future.
/// This function is intended to replace getIndexExpressionsFromGEP. They rely
/// on the GEP source element type so that will be removed in the future.
bool delinearizeFixedSizeArray(ScalarEvolution &SE, const SCEV *Expr,
SmallVectorImpl<const SCEV *> &Subscripts,
SmallVectorImpl<const SCEV *> &Sizes,
Expand All @@ -155,17 +154,6 @@ bool getIndexExpressionsFromGEP(ScalarEvolution &SE,
SmallVectorImpl<const SCEV *> &Subscripts,
SmallVectorImpl<int> &Sizes);

/// Implementation of fixed size array delinearization. Try to delinearize
/// access function for a fixed size multi-dimensional array, by deriving
/// subscripts from GEP instructions. Returns true upon success and false
/// otherwise. \p Inst is the load/store instruction whose pointer operand is
/// the one we want to delinearize. \p AccessFn is its corresponding SCEV
/// expression w.r.t. the surrounding loop.
bool tryDelinearizeFixedSizeImpl(ScalarEvolution *SE, Instruction *Inst,
const SCEV *AccessFn,
SmallVectorImpl<const SCEV *> &Subscripts,
SmallVectorImpl<int> &Sizes);

struct DelinearizationPrinterPass
: public PassInfoMixin<DelinearizationPrinterPass> {
explicit DelinearizationPrinterPass(raw_ostream &OS);
Expand Down
4 changes: 2 additions & 2 deletions llvm/include/llvm/Analysis/DependenceAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -773,8 +773,8 @@ class DependenceInfo {
SmallVectorImpl<Subscript> &Pair);

/// Tries to delinearize \p Src and \p Dst access functions for a fixed size
/// multi-dimensional array. Calls tryDelinearizeFixedSizeImpl() to
/// delinearize \p Src and \p Dst separately,
/// multi-dimensional array. Calls delinearizeFixedSizeArray() to delinearize
/// \p Src and \p Dst separately,
bool tryDelinearizeFixedSize(Instruction *Src, Instruction *Dst,
const SCEV *SrcAccessFn, const SCEV *DstAccessFn,
SmallVectorImpl<const SCEV *> &SrcSubscripts,
Expand Down
38 changes: 0 additions & 38 deletions llvm/lib/Analysis/Delinearization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -704,44 +704,6 @@ bool llvm::getIndexExpressionsFromGEP(ScalarEvolution &SE,
return !Subscripts.empty();
}

bool llvm::tryDelinearizeFixedSizeImpl(
ScalarEvolution *SE, Instruction *Inst, const SCEV *AccessFn,
SmallVectorImpl<const SCEV *> &Subscripts, SmallVectorImpl<int> &Sizes) {
Value *SrcPtr = getLoadStorePointerOperand(Inst);

// Check the simple case where the array dimensions are fixed size.
auto *SrcGEP = dyn_cast<GetElementPtrInst>(SrcPtr);
if (!SrcGEP)
return false;

getIndexExpressionsFromGEP(*SE, SrcGEP, Subscripts, Sizes);

// Check that the two size arrays are non-empty and equal in length and
// value.
// TODO: it would be better to let the caller to clear Subscripts, similar
// to how we handle Sizes.
if (Sizes.empty() || Subscripts.size() <= 1) {
Subscripts.clear();
return false;
}

// Check that for identical base pointers we do not miss index offsets
// that have been added before this GEP is applied.
Value *SrcBasePtr = SrcGEP->getOperand(0)->stripPointerCasts();
const SCEVUnknown *SrcBase =
dyn_cast<SCEVUnknown>(SE->getPointerBase(AccessFn));
if (!SrcBase || SrcBasePtr != SrcBase->getValue()) {
Subscripts.clear();
return false;
}

assert(Subscripts.size() == Sizes.size() + 1 &&
"Expected equal number of entries in the list of size and "
"subscript.");

return true;
}

namespace {

void printDelinearization(raw_ostream &O, Function *F, LoopInfo *LI,
Expand Down
Loading