[PATCH] D19677: SROA assertion: creating bitcast between ptr types with different addr spaces
Jack Liu via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 28 14:20:32 PDT 2016
liu12295 removed rL LLVM as the repository for this revision.
liu12295 updated this revision to Diff 55486.
liu12295 added a comment.
This revision addresses the raised concerns.
http://reviews.llvm.org/D19677
Files:
lib/Transforms/Scalar/SROA.cpp
test/Transforms/SROA/pr27557.ll
Index: test/Transforms/SROA/pr27557.ll
===================================================================
--- test/Transforms/SROA/pr27557.ll
+++ test/Transforms/SROA/pr27557.ll
@@ -0,0 +1,19 @@
+; RUN: opt -O1 < %s -S
+
+; ModuleID = '<origin>'
+target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
+
+%union.anon = type { i32 addrspace(1)* }
+
+ at g = common addrspace(1) global i32 0, align 4
+ at l = common addrspace(3) global i32 0, align 4
+
+; Function Attrs: nounwind uwtable
+define void @testKernel() #0 {
+ %1 = alloca %union.anon, align 8
+ %2 = bitcast %union.anon* %1 to i32 addrspace(1)**
+ store i32 addrspace(1)* @g, i32 addrspace(1)** %2, align 8
+ %3 = bitcast %union.anon* %1 to i32 addrspace(3)**
+ store i32 addrspace(3)* @l, i32 addrspace(3)** %3, align 8
+ ret void
+}
Index: lib/Transforms/Scalar/SROA.cpp
===================================================================
--- lib/Transforms/Scalar/SROA.cpp
+++ lib/Transforms/Scalar/SROA.cpp
@@ -1635,8 +1635,10 @@
OldTy = OldTy->getScalarType();
NewTy = NewTy->getScalarType();
if (NewTy->isPointerTy() || OldTy->isPointerTy()) {
- if (NewTy->isPointerTy() && OldTy->isPointerTy())
- return true;
+ if (NewTy->isPointerTy() && OldTy->isPointerTy()) {
+ return cast<PointerType>(NewTy)->getPointerAddressSpace() ==
+ cast<PointerType>(OldTy)->getPointerAddressSpace();
+ }
if (NewTy->isIntegerTy() || OldTy->isIntegerTy())
return true;
return false;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19677.55486.patch
Type: text/x-patch
Size: 1489 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160428/9a1ed691/attachment.bin>
More information about the llvm-commits
mailing list