[polly] r261863 - Try to build alias checks even when non-affine accesses are allowed
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 25 06:06:12 PST 2016
Author: jdoerfert
Date: Thu Feb 25 08:06:11 2016
New Revision: 261863
URL: http://llvm.org/viewvc/llvm-project?rev=261863&view=rev
Log:
Try to build alias checks even when non-affine accesses are allowed
From now on we bail only if a non-trivial alias group contains a non-affine
access, not when we discover aliasing and non-affine accesses are allowed.
Added:
polly/trunk/test/ScopInfo/aliasing_with_non_affine_access.ll
Modified:
polly/trunk/lib/Analysis/ScopDetection.cpp
polly/trunk/lib/Analysis/ScopInfo.cpp
polly/trunk/test/Isl/Ast/alias_simple_2.ll
Modified: polly/trunk/lib/Analysis/ScopDetection.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetection.cpp?rev=261863&r1=261862&r2=261863&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetection.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetection.cpp Thu Feb 25 08:06:11 2016
@@ -232,12 +232,6 @@ ScopDetection::ScopDetection() : Functio
PollyUseRuntimeAliasChecks = false;
return;
}
-
- if (AllowNonAffine) {
- DEBUG(errs() << "WARNING: We disable runtime alias checks as non affine "
- "accesses are enabled.\n");
- PollyUseRuntimeAliasChecks = false;
- }
}
template <class RR, typename... Args>
Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=261863&r1=261862&r2=261863&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Thu Feb 25 08:06:11 2016
@@ -2689,6 +2689,20 @@ bool Scop::buildAliasGroups(AliasAnalysi
continue;
}
+ // Check if we have non-affine accesses left, if so bail out as we cannot
+ // generate a good access range yet.
+ for (auto *MA : AG)
+ if (!MA->isAffine()) {
+ invalidate(ALIASING, MA->getAccessInstruction()->getDebugLoc());
+ return false;
+ }
+ for (auto &ReadOnlyPair : ReadOnlyPairs)
+ for (auto *MA : ReadOnlyPair.second)
+ if (!MA->isAffine()) {
+ invalidate(ALIASING, MA->getAccessInstruction()->getDebugLoc());
+ return false;
+ }
+
// Calculate minimal and maximal accesses for non read only accesses.
MinMaxAliasGroups.emplace_back();
MinMaxVectorPairTy &pair = MinMaxAliasGroups.back();
Modified: polly/trunk/test/Isl/Ast/alias_simple_2.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/Ast/alias_simple_2.ll?rev=261863&r1=261862&r2=261863&view=diff
==============================================================================
--- polly/trunk/test/Isl/Ast/alias_simple_2.ll (original)
+++ polly/trunk/test/Isl/Ast/alias_simple_2.ll Thu Feb 25 08:06:11 2016
@@ -3,6 +3,7 @@
; RUN: opt %loadPolly -polly-ast -analyze -disable-basicaa -tbaa < %s | FileCheck %s --check-prefix=TBAA
; RUN: opt %loadPolly -polly-ast -analyze -disable-basicaa -scev-aa < %s | FileCheck %s --check-prefix=SCEV
; RUN: opt %loadPolly -polly-ast -analyze -disable-basicaa -globals-aa < %s | FileCheck %s --check-prefix=GLOB
+; RUN: opt %loadPolly -polly-ast -analyze -disable-basicaa -globals-aa -polly-allow-nonaffine < %s | FileCheck %s --check-prefix=NONAFFINE
;
; int A[1024], B[1024];
;
@@ -17,6 +18,7 @@
; TBAA: if (1 && (&MemRef_B[N] <= &MemRef_A[0] || &MemRef_A[N] <= &MemRef_B[0]))
; SCEV: if (1 && (&MemRef_B[N] <= &MemRef_A[0] || &MemRef_A[N] <= &MemRef_B[0]))
; GLOB: if (1 && (&MemRef_B[N] <= &MemRef_A[0] || &MemRef_A[N] <= &MemRef_B[0]))
+; NONAFFINE: if (1 && (&MemRef_B[N] <= &MemRef_A[0] || &MemRef_A[N] <= &MemRef_B[0]))
;
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
Added: polly/trunk/test/ScopInfo/aliasing_with_non_affine_access.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/aliasing_with_non_affine_access.ll?rev=261863&view=auto
==============================================================================
--- polly/trunk/test/ScopInfo/aliasing_with_non_affine_access.ll (added)
+++ polly/trunk/test/ScopInfo/aliasing_with_non_affine_access.ll Thu Feb 25 08:06:11 2016
@@ -0,0 +1,49 @@
+; RUN: opt %loadPolly -analyze -polly-scops < %s | FileCheck %s
+; RUN: opt %loadPolly -analyze -polly-scops -pass-remarks-analysis="polly-scops" 2>&1 < %s | FileCheck %s --check-prefix=REMARK
+;
+; This test case has a non-affine access (the memset call) that aliases with
+; other accesses. Thus, we bail out.
+;
+; CHECK-NOT: Statements
+;
+; REMARK: remark: <unknown>:0:0: SCoP begins here.
+; REMARK-NEXT: remark: <unknown>:0:0: Possibly aliasing pointer, use restrict keyword.
+; REMARK-NEXT: remark: <unknown>:0:0: Possibly aliasing pointer, use restrict keyword.
+; REMARK-NEXT: remark: <unknown>:0:0: No-aliasing assumption: { : 1 = 0 }
+; REMARK-NEXT: remark: <unknown>:0:0: SCoP ends here but was dismissed.
+;
+; ModuleID = 'bugpoint-reduced-simplified.bc'
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+
+%struct.info = type { i32, %struct.ctr*, i32, %struct.ord*, %struct.ctr*, i32, i8*, i32, i32, double }
+%struct.ctr = type { i32, i8, i8, i32 }
+%struct.ord = type { i32, i8 }
+
+; Function Attrs: argmemonly nounwind
+declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) #0
+
+; Function Attrs: nounwind uwtable
+define void @bestVirtualIndex(%struct.info** %ppIdxInfo) {
+entry:
+ %0 = load %struct.info*, %struct.info** %ppIdxInfo, align 8
+ br label %if.end125
+
+if.end125: ; preds = %entry
+ %1 = load %struct.ctr*, %struct.ctr** undef, align 8
+ br label %for.end143
+
+for.end143: ; preds = %if.end125
+ %2 = bitcast %struct.ctr* %1 to i8*
+ tail call void @llvm.memset.p0i8.i64(i8* %2, i8 0, i64 32, i32 4, i1 false)
+ %needToFreeIdxStr = getelementptr inbounds %struct.info, %struct.info* %0, i64 0, i32 7
+ %3 = load i32, i32* %needToFreeIdxStr, align 8
+ br i1 false, label %if.end149, label %if.then148
+
+if.then148: ; preds = %for.end143
+ br label %if.end149
+
+if.end149: ; preds = %if.then148, %for.end143
+ unreachable
+}
+
+attributes #0 = { argmemonly nounwind }
More information about the llvm-commits
mailing list