[llvm-commits] [polly] r166670 - /polly/trunk/lib/IndVarSimplify.cpp
Chandler Carruth
chandlerc at gmail.com
Thu Oct 25 01:43:18 PDT 2012
Author: chandlerc
Date: Thu Oct 25 03:43:18 2012
New Revision: 166670
URL: http://llvm.org/viewvc/llvm-project?rev=166670&view=rev
Log:
Another speculative commit to try to fix Polly's build. This is more delta than
I like to make w/o being able to build, but I don't have the dependencies to
build and test polly. I'll revert if the build bots don't like it.
Modified:
polly/trunk/lib/IndVarSimplify.cpp
Modified: polly/trunk/lib/IndVarSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/IndVarSimplify.cpp?rev=166670&r1=166669&r2=166670&view=diff
==============================================================================
--- polly/trunk/lib/IndVarSimplify.cpp (original)
+++ polly/trunk/lib/IndVarSimplify.cpp Thu Oct 25 03:43:18 2012
@@ -1530,7 +1530,8 @@
/// genLoopLimit - Help LinearFunctionTestReplace by generating a value that
/// holds the RHS of the new loop test.
static Value *genLoopLimit(PHINode *IndVar, const SCEV *IVCount, Loop *L,
- SCEVExpander &Rewriter, ScalarEvolution *SE) {
+ SCEVExpander &Rewriter, ScalarEvolution *SE,
+ const DataLayout *TD) {
const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(SE->getSCEV(IndVar));
assert(AR && AR->getLoop() == L && AR->isAffine() && "bad loop counter");
const SCEV *IVInit = AR->getStart();
@@ -1555,9 +1556,11 @@
assert(AR->getStart() == SE->getSCEV(GEPBase) && "bad loop counter");
// We could handle pointer IVs other than i8*, but we need to compensate for
// gep index scaling. See canExpandBackedgeTakenCount comments.
- assert(SE->getSizeOfExpr(
- cast<PointerType>(GEPBase->getType())->getElementType())->isOne()
- && "unit stride pointer IV must be i8*");
+ if (TD)
+ assert(SE->getSizeOfExpr(
+ cast<PointerType>(GEPBase->getType())->getElementType(),
+ TD->getIntPtrType(GEPBase->getType()))->isOne()
+ && "unit stride pointer IV must be i8*");
IRBuilder<> Builder(L->getLoopPreheader()->getTerminator());
return Builder.CreateGEP(GEPBase, GEPOffset, "lftr.limit");
@@ -1656,7 +1659,7 @@
CmpIndVar = IndVar;
}
- Value *ExitCnt = genLoopLimit(IndVar, IVCount, L, Rewriter, SE);
+ Value *ExitCnt = genLoopLimit(IndVar, IVCount, L, Rewriter, SE, TD);
assert(ExitCnt->getType()->isPointerTy() == IndVar->getType()->isPointerTy()
&& "genLoopLimit missed a cast");
More information about the llvm-commits
mailing list