summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Grosser <tobias@grosser.es>2016-04-05 06:23:45 +0000
committerTobias Grosser <tobias@grosser.es>2016-04-05 06:23:45 +0000
commit535afd808dc645530d53bf5f8ccf9d6f08f330e6 (patch)
treeb4162b62db5dbb0fa787370874d608c1eae6fd25
parentc7db569cc1235280dc58473b78064fa7b5f7f7b1 (diff)
downloadbcm5719-llvm-535afd808dc645530d53bf5f8ccf9d6f08f330e6.tar.gz
bcm5719-llvm-535afd808dc645530d53bf5f8ccf9d6f08f330e6.zip
ScopInfo: Check for possibly nested GEP in fixed-size delin
We currently only consider the first GEP when delinearizing access functions, which makes us loose information about additional index expression offsets, which results in our SCoP model to be incorrect. With this patch we now compare the base pointers used to ensure we do not miss any additional offsets. This fixes llvm.org/PR27195. We may consider supporting nested GEP in our delinearization heuristics in the future. llvm-svn: 265379
-rw-r--r--polly/lib/Analysis/ScopInfo.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp
index 6dd63ce4d3d..0e17241c0b9 100644
--- a/polly/lib/Analysis/ScopInfo.cpp
+++ b/polly/lib/Analysis/ScopInfo.cpp
@@ -3985,6 +3985,14 @@ bool ScopInfo::buildAccessMultiDimFixed(
std::tie(Subscripts, Sizes) = getIndexExpressionsFromGEP(GEP, *SE);
auto *BasePtr = GEP->getOperand(0);
+ if (auto *BasePtrCast = dyn_cast<BitCastInst>(BasePtr))
+ BasePtr = BasePtrCast->getOperand(0);
+
+ // Check for identical base pointers to ensure that we do not miss index
+ // offsets that have been added before this GEP is applied.
+ if (BasePtr != BasePointer->getValue())
+ return false;
+
std::vector<const SCEV *> SizesSCEV;
for (auto *Subscript : Subscripts) {
OpenPOWER on IntegriCloud