[llvm-commits] [polly] r144278 - /polly/trunk/lib/Analysis/ScopDetection.cpp
Tobias Grosser
grosser at fim.uni-passau.de
Thu Nov 10 04:44:50 PST 2011
Author: grosser
Date: Thu Nov 10 06:44:50 2011
New Revision: 144278
URL: http://llvm.org/viewvc/llvm-project?rev=144278&view=rev
Log:
ScopDetect: Use getPointerBase to get the base pointer
Previously we allowed in access functions only a single SCEVUnknown, which later
became the base address. We now use getPointerBase() to derive the base address
and all remaining unknowns are handled as parameters. This allows us to handle
cases like A[b+c];
Modified:
polly/trunk/lib/Analysis/ScopDetection.cpp
Modified: polly/trunk/lib/Analysis/ScopDetection.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetection.cpp?rev=144278&r1=144277&r2=144278&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetection.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetection.cpp Thu Nov 10 06:44:50 2011
@@ -56,6 +56,7 @@
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/RegionIterator.h"
#include "llvm/Analysis/ScalarEvolution.h"
+#include "llvm/Analysis/ScalarEvolutionExpressions.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Assembly/Writer.h"
@@ -213,10 +214,26 @@
DetectionContext &Context) const {
Value *Ptr = getPointerOperand(Inst), *BasePtr;
const SCEV *AccessFunction = SE->getSCEV(Ptr);
+ const SCEVUnknown *BasePointer;
+ const Value *BaseValue;
- if (!isAffineExpr(&Context.CurRegion, AccessFunction, *SE, &BasePtr))
+ BasePointer = dyn_cast<SCEVUnknown>(SE->getPointerBase(AccessFunction));
+
+ if (!BasePointer)
+ INVALID(AffFunc, "No base pointer");
+
+ BaseValue = BasePointer->getValue();
+
+ if (isa<UndefValue>(BaseValue))
+ INVALID(AffFunc, "Undefined base pointer");
+
+ AccessFunction = SE->getMinusSCEV(AccessFunction, BasePointer);
+
+ if (!isAffineExpr(&Context.CurRegion, AccessFunction, *SE))
INVALID(AffFunc, "Bad memory address " << *AccessFunction);
+ BasePtr = BasePointer->getValue();
+
// FIXME: Alias Analysis thinks IntToPtrInst aliases with alloca instructions
// created by IndependentBlocks Pass.
if (isa<IntToPtrInst>(BasePtr))
More information about the llvm-commits
mailing list