From: Michael Kruse Date: Tue, 4 Oct 2016 17:33:34 +0000 (+0000) Subject: [ScopInfo] Scalar access do not have indirect base pointers. X-Git-Tag: llvmorg-4.0.0-rc1~8137 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ca7cbcca373c8ae451b36a9c033d967dde35dcdf;p=platform%2Fupstream%2Fllvm.git [ScopInfo] Scalar access do not have indirect base pointers. ScopArrayInfo used to determine base pointer origins by looking up whether the base pointer is a load. The "base pointer" for scalar accesses is the llvm::Value being accessed. This is only a symbolic base pointer, it represents the alloca variable (.s2a or .phiops) generated for it at code generation. This patch disables determining base pointer origin for scalars. A test case where this caused a crash will be added in the next commit. In that test SAI tried to get the origin base pointer that was only declared later, therefore not existing. This is probably only possible for scalars used in PHINode incoming blocks. llvm-svn: 283232 --- diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp index 30e248d..64f3b47 100644 --- a/polly/lib/Analysis/ScopInfo.cpp +++ b/polly/lib/Analysis/ScopInfo.cpp @@ -179,7 +179,7 @@ ScopArrayInfo::ScopArrayInfo(Value *BasePtr, Type *ElementType, isl_ctx *Ctx, updateSizes(Sizes); - if (!BasePtr) { + if (!BasePtr || Kind != MK_Array) { BasePtrOriginSAI = nullptr; return; } diff --git a/polly/test/ScopInfo/non_affine_region_4.ll b/polly/test/ScopInfo/non_affine_region_4.ll index 19fdcfd..261cda3 100644 --- a/polly/test/ScopInfo/non_affine_region_4.ll +++ b/polly/test/ScopInfo/non_affine_region_4.ll @@ -17,13 +17,13 @@ ; CHECK: Arrays { ; CHECK-NEXT: i32 MemRef_A[*]; // Element size 4 ; CHECK-NEXT: i32 MemRef_y__phi; // Element size 4 -; CHECK-NEXT: i32 MemRef_x; [BasePtrOrigin: MemRef_A] // Element size 4 +; CHECK-NEXT: i32 MemRef_x; // Element size 4 ; CHECK-NEXT: } ; ; CHECK: Arrays (Bounds as pw_affs) { ; CHECK-NEXT: i32 MemRef_A[*]; // Element size 4 ; CHECK-NEXT: i32 MemRef_y__phi; // Element size 4 -; CHECK-NEXT: i32 MemRef_x; [BasePtrOrigin: MemRef_A] // Element size 4 +; CHECK-NEXT: i32 MemRef_x; // Element size 4 ; CHECK-NEXT: } ; ; CHECK: Statements { diff --git a/polly/test/ScopInfo/scalar.ll b/polly/test/ScopInfo/scalar.ll index fccfe49..ada644c 100644 --- a/polly/test/ScopInfo/scalar.ll +++ b/polly/test/ScopInfo/scalar.ll @@ -32,12 +32,12 @@ return: ; CHECK: Arrays { ; CHECK-NEXT: i64 MemRef_a[*]; // Element size 8 -; CHECK-NEXT: i64 MemRef_val; [BasePtrOrigin: MemRef_a] // Element size 8 +; CHECK-NEXT: i64 MemRef_val; // Element size 8 ; CHECK-NEXT: } ; ; CHECK: Arrays (Bounds as pw_affs) { ; CHECK-NEXT: i64 MemRef_a[*]; // Element size 8 -; CHECK-NEXT: i64 MemRef_val; [BasePtrOrigin: MemRef_a] // Element size 8 +; CHECK-NEXT: i64 MemRef_val; // Element size 8 ; CHECK-NEXT: } ; ; CHECK: Statements {