diff options
| author | Michael Kruse <llvm@meinersbur.de> | 2016-06-28 01:37:13 +0000 |
|---|---|---|
| committer | Michael Kruse <llvm@meinersbur.de> | 2016-06-28 01:37:13 +0000 |
| commit | 6ff419c2ec8ac6f4718a46aebda94567c95045dd (patch) | |
| tree | 95147ac7f4d77b77df591b15019a44a10e51d43f /polly/lib/Analysis/ScopInfo.cpp | |
| parent | 728356d10a7333c154ca8cf980d714b988a7b44a (diff) | |
| download | bcm5719-llvm-6ff419c2ec8ac6f4718a46aebda94567c95045dd.tar.gz bcm5719-llvm-6ff419c2ec8ac6f4718a46aebda94567c95045dd.zip | |
Move getIndexExpressionsFromGEP() to ScopHelper. NFC.
This function is used by both ScopInfo and ScopBuilder. A common
location for this function is required when ScopInfo and ScopBuilder are
separated into separate files in the next commit.
llvm-svn: 273981
Diffstat (limited to 'polly/lib/Analysis/ScopInfo.cpp')
| -rw-r--r-- | polly/lib/Analysis/ScopInfo.cpp | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp index f8e2e3abef2..4edd5265c1b 100644 --- a/polly/lib/Analysis/ScopInfo.cpp +++ b/polly/lib/Analysis/ScopInfo.cpp @@ -491,67 +491,6 @@ static MemoryAccess::ReductionType getReductionType(const BinaryOperator *BinOp, } } -/// @brief Derive the individual index expressions from a GEP instruction -/// -/// This function optimistically assumes the GEP references into a fixed size -/// array. If this is actually true, this function returns a list of array -/// subscript expressions as SCEV as well as a list of integers describing -/// the size of the individual array dimensions. Both lists have either equal -/// length of the size list is one element shorter in case there is no known -/// size available for the outermost array dimension. -/// -/// @param GEP The GetElementPtr instruction to analyze. -/// -/// @return A tuple with the subscript expressions and the dimension sizes. -static std::tuple<std::vector<const SCEV *>, std::vector<int>> -getIndexExpressionsFromGEP(GetElementPtrInst *GEP, ScalarEvolution &SE) { - std::vector<const SCEV *> Subscripts; - std::vector<int> Sizes; - - Type *Ty = GEP->getPointerOperandType(); - - bool DroppedFirstDim = false; - - for (unsigned i = 1; i < GEP->getNumOperands(); i++) { - - const SCEV *Expr = SE.getSCEV(GEP->getOperand(i)); - - if (i == 1) { - if (auto *PtrTy = dyn_cast<PointerType>(Ty)) { - Ty = PtrTy->getElementType(); - } else if (auto *ArrayTy = dyn_cast<ArrayType>(Ty)) { - Ty = ArrayTy->getElementType(); - } else { - Subscripts.clear(); - Sizes.clear(); - break; - } - if (auto *Const = dyn_cast<SCEVConstant>(Expr)) - if (Const->getValue()->isZero()) { - DroppedFirstDim = true; - continue; - } - Subscripts.push_back(Expr); - continue; - } - - auto *ArrayTy = dyn_cast<ArrayType>(Ty); - if (!ArrayTy) { - Subscripts.clear(); - Sizes.clear(); - break; - } - - Subscripts.push_back(Expr); - if (!(DroppedFirstDim && i == 2)) - Sizes.push_back(ArrayTy->getNumElements()); - - Ty = ArrayTy->getElementType(); - } - - return std::make_tuple(Subscripts, Sizes); -} - MemoryAccess::~MemoryAccess() { isl_id_free(Id); isl_set_free(InvalidDomain); |

