[llvm] r268409 -
Liu, Jack via llvm-commits
llvm-commits at lists.llvm.org
Tue May 3 13:18:29 PDT 2016
It was my mistake. I got your email late, and had reverted the change and re-committed it again at r268424.
------------------------------------------------------------------------
r268424 | liu12295 | 2016-05-03 12:30:48 -0700 (Tue, 03 May 2016) | 6 lines
[SROA] Function canConvertValue needs to check whether both NewTy and OldTy pointers are
pointing to the same addr space. This can prevent SROA from creating a bitcast
between pointers with different addr spaces.
Differential Revision: http://reviews.llvm.org/D19697
Sorry about the confusion.
From: David Blaikie [mailto:dblaikie at gmail.com]
Sent: Tuesday, May 3, 2016 12:59 PM
To: Liu, Jack <jack.liu at intel.com>
Cc: llvm-commits <llvm-commits at lists.llvm.org>
Subject: Re: [llvm] r268409 -
Missing commit message? (could you provide it in a reply here - and try to include commit messages in the commit in the future (ie: don't bother reverting & recommitting this just to add a commit message unless you particularly want to - some people might appreciate it when trawling through the logs))
On Tue, May 3, 2016 at 11:01 AM, Jack Liu via llvm-commits <llvm-commits at lists.llvm.org<mailto:llvm-commits at lists.llvm.org>> wrote:
Author: liu12295
Date: Tue May 3 13:01:43 2016
New Revision: 268409
URL: http://llvm.org/viewvc/llvm-project?rev=268409&view=rev
Log: (empty)
Modified:
llvm/trunk/lib/Transforms/Scalar/SROA.cpp
llvm/trunk/test/Transforms/SROA/address-spaces.ll
Modified: llvm/trunk/lib/Transforms/Scalar/SROA.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SROA.cpp?rev=268409&r1=268408&r2=268409&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/SROA.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/SROA.cpp Tue May 3 13:01:43 2016
@@ -1635,8 +1635,10 @@ static bool canConvertValue(const DataLa
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;
Modified: llvm/trunk/test/Transforms/SROA/address-spaces.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SROA/address-spaces.ll?rev=268409&r1=268408&r2=268409&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/SROA/address-spaces.ll (original)
+++ llvm/trunk/test/Transforms/SROA/address-spaces.ll Tue May 3 13:01:43 2016
@@ -52,7 +52,7 @@ define void @test_address_space_0_1(<2 x
%struct.struct_test_27.0.13 = type { i32, float, i64, i8, [4 x i32] }
-; Function Attrs: nounwind
+; Function Attrs: nounwind
define void @copy_struct([5 x i64] %in.coerce) {
; CHECK-LABEL: @copy_struct(
; CHECK-NOT: memcpy
@@ -66,3 +66,20 @@ for.end:
ret void
}
+%union.anon = type { i32* }
+
+ at g = common global i32 0, align 4
+ at l = common addrspace(3) global i32 0, align 4
+
+; Make sure an illegal bitcast isn't introduced
+define void @pr27557() {
+; CHECK-LABEL: @pr27557(
+; CHECK: %[[CAST:.*]] = bitcast i32** {{.*}} to i32 addrspace(3)**
+; CHECK: store i32 addrspace(3)* @l, i32 addrspace(3)** %[[CAST]]
+ %1 = alloca %union.anon, align 8
+ %2 = bitcast %union.anon* %1 to i32**
+ store i32* @g, i32** %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
+}
_______________________________________________
llvm-commits mailing list
llvm-commits at lists.llvm.org<mailto:llvm-commits at lists.llvm.org>
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160503/2b34ceb9/attachment.html>
More information about the llvm-commits
mailing list