From 59d3ae6cdc4316ad338cd848251f33a236ccb36c Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Fri, 15 Nov 2013 01:34:59 +0000 Subject: Add addrspacecast instruction. Patch by Michele Scandale! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194760 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Transforms/InstCombine/2009-01-16-PointerAddrSpace.ll | 2 +- test/Transforms/InstCombine/2012-07-30-addrsp-bitcast.ll | 4 ++-- test/Transforms/InstCombine/cast_ptr.ll | 2 +- test/Transforms/InstCombine/constant-fold-address-space-pointer.ll | 4 ++-- test/Transforms/InstCombine/gep-addrspace.ll | 2 +- test/Transforms/InstCombine/objsize-address-space.ll | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) (limited to 'test/Transforms') diff --git a/test/Transforms/InstCombine/2009-01-16-PointerAddrSpace.ll b/test/Transforms/InstCombine/2009-01-16-PointerAddrSpace.ll index 949fc59..e354311 100644 --- a/test/Transforms/InstCombine/2009-01-16-PointerAddrSpace.ll +++ b/test/Transforms/InstCombine/2009-01-16-PointerAddrSpace.ll @@ -5,7 +5,7 @@ target triple = "i386-apple-darwin9.6" define i32 @test(i32* %P) nounwind { entry: - %Q = bitcast i32* %P to i32 addrspace(1)* + %Q = addrspacecast i32* %P to i32 addrspace(1)* store i32 0, i32 addrspace(1)* %Q, align 4 ret i32 0 } diff --git a/test/Transforms/InstCombine/2012-07-30-addrsp-bitcast.ll b/test/Transforms/InstCombine/2012-07-30-addrsp-bitcast.ll index 6f3df5b..4d185bf 100644 --- a/test/Transforms/InstCombine/2012-07-30-addrsp-bitcast.ll +++ b/test/Transforms/InstCombine/2012-07-30-addrsp-bitcast.ll @@ -1,10 +1,10 @@ ; RUN: opt < %s -instcombine -S | FileCheck %s -; CHECK: bitcast +; CHECK: addrspacecast @base = internal addrspace(3) unnamed_addr global [16 x i32] zeroinitializer, align 16 declare void @foo(i32*) define void @test() nounwind { - call void @foo(i32* getelementptr (i32* bitcast ([16 x i32] addrspace(3)* @base to i32*), i64 2147483647)) nounwind + call void @foo(i32* getelementptr (i32* addrspacecast ([16 x i32] addrspace(3)* @base to i32*), i64 2147483647)) nounwind ret void } diff --git a/test/Transforms/InstCombine/cast_ptr.ll b/test/Transforms/InstCombine/cast_ptr.ll index d415810..23006a8 100644 --- a/test/Transforms/InstCombine/cast_ptr.ll +++ b/test/Transforms/InstCombine/cast_ptr.ll @@ -100,7 +100,7 @@ define %unop* @test5(%op* %O) { define i8 @test6(i8 addrspace(1)* %source) { entry: - %arrayidx223 = bitcast i8 addrspace(1)* %source to i8* + %arrayidx223 = addrspacecast i8 addrspace(1)* %source to i8* %tmp4 = load i8* %arrayidx223 ret i8 %tmp4 ; CHECK-LABEL: @test6( diff --git a/test/Transforms/InstCombine/constant-fold-address-space-pointer.ll b/test/Transforms/InstCombine/constant-fold-address-space-pointer.ll index f3a474a..9f21d54 100644 --- a/test/Transforms/InstCombine/constant-fold-address-space-pointer.ll +++ b/test/Transforms/InstCombine/constant-fold-address-space-pointer.ll @@ -32,10 +32,10 @@ define i32 addrspace(2)* @test_constant_fold_inttoptr_as_pointer_smaller() { } ; Different address spaces that are the same size, but they are -; different so there should be a bitcast. +; different so nothing should happen define i32 addrspace(4)* @test_constant_fold_inttoptr_as_pointer_smaller_different_as() { ; CHECK-LABEL: @test_constant_fold_inttoptr_as_pointer_smaller_different_as( -; CHECK-NEXT: ret i32 addrspace(4)* bitcast (i32 addrspace(3)* @const_zero_i32_as3 to i32 addrspace(4)*) +; CHECK-NEXT: ret i32 addrspace(4)* inttoptr (i16 ptrtoint (i32 addrspace(3)* @const_zero_i32_as3 to i16) to i32 addrspace(4)*) %x = ptrtoint i32 addrspace(3)* @const_zero_i32_as3 to i16 %y = inttoptr i16 %x to i32 addrspace(4)* ret i32 addrspace(4)* %y diff --git a/test/Transforms/InstCombine/gep-addrspace.ll b/test/Transforms/InstCombine/gep-addrspace.ll index dfe12db..24c355d 100644 --- a/test/Transforms/InstCombine/gep-addrspace.ll +++ b/test/Transforms/InstCombine/gep-addrspace.ll @@ -9,7 +9,7 @@ target triple = "x86_64-pc-win32" define void @func(%myStruct addrspace(1)* nocapture %p) nounwind { ST: %A = getelementptr inbounds %myStruct addrspace(1)* %p, i64 0 - %B = bitcast %myStruct addrspace(1)* %A to %myStruct* + %B = addrspacecast %myStruct addrspace(1)* %A to %myStruct* %C = getelementptr inbounds %myStruct* %B, i32 0, i32 1 %D = getelementptr inbounds [3 x float]* %C, i32 0, i32 2 %E = load float* %D, align 4 diff --git a/test/Transforms/InstCombine/objsize-address-space.ll b/test/Transforms/InstCombine/objsize-address-space.ll index e3723ce..9cb6884 100644 --- a/test/Transforms/InstCombine/objsize-address-space.ll +++ b/test/Transforms/InstCombine/objsize-address-space.ll @@ -49,7 +49,7 @@ define i32 @array_as2_size() { define i32 @pointer_array_as1() { ; CHECK-LABEL: @pointer_array_as1( ; CHECK-NEXT: ret i32 80 - %bc = bitcast [10 x i32 addrspace(1)*]* @array_as1_pointers to i8 addrspace(1)* + %bc = addrspacecast [10 x i32 addrspace(1)*]* @array_as1_pointers to i8 addrspace(1)* %1 = call i32 @llvm.objectsize.i32.p1i8(i8 addrspace(1)* %bc, i1 false) ret i32 %1 } -- cgit v1.1