[polly] r265379 - ScopInfo: Check for possibly nested GEP in fixed-size delin

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 4 23:23:46 PDT 2016


Author: grosser
Date: Tue Apr  5 01:23:45 2016
New Revision: 265379

URL: http://llvm.org/viewvc/llvm-project?rev=265379&view=rev
Log:
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.

Modified:
    polly/trunk/lib/Analysis/ScopInfo.cpp

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=265379&r1=265378&r2=265379&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Tue Apr  5 01:23:45 2016
@@ -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) {




More information about the llvm-commits mailing list