summaryrefslogtreecommitdiffstats
path: root/polly/lib/Analysis/ScopDetection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'polly/lib/Analysis/ScopDetection.cpp')
-rw-r--r--polly/lib/Analysis/ScopDetection.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp
index 5122c2024b1..3d24596d45d 100644
--- a/polly/lib/Analysis/ScopDetection.cpp
+++ b/polly/lib/Analysis/ScopDetection.cpp
@@ -121,6 +121,11 @@ static cl::opt<bool>
cl::desc("Print information about the activities of Polly"),
cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory));
+static cl::opt<bool> AllowDifferentTypes(
+ "polly-allow-differing-element-types",
+ cl::desc("Allow different element types for array accesses"), cl::Hidden,
+ cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory));
+
static cl::opt<bool>
AllowNonAffine("polly-allow-nonaffine",
cl::desc("Allow non affine access functions in arrays"),
@@ -787,11 +792,16 @@ bool ScopDetection::isValidMemoryAccess(MemAccInst Inst,
AccessFunction = SE->getMinusSCEV(AccessFunction, BasePointer);
const SCEV *Size = SE->getElementSize(Inst);
- if (Context.ElementSize[BasePointer])
+ if (Context.ElementSize[BasePointer]) {
+ if (!AllowDifferentTypes && Context.ElementSize[BasePointer] != Size)
+ return invalid<ReportDifferentArrayElementSize>(Context, /*Assert=*/true,
+ Inst, BaseValue);
+
Context.ElementSize[BasePointer] =
SE->getSMinExpr(Size, Context.ElementSize[BasePointer]);
- else
+ } else {
Context.ElementSize[BasePointer] = Size;
+ }
bool isVariantInNonAffineLoop = false;
SetVector<const Loop *> Loops;
OpenPOWER on IntegriCloud