Matt Arsenault | 5bcefab | 2013-11-10 01:44:37 +0000 | [diff] [blame] | 1 | ; RUN: opt -S -mergefunc < %s | FileCheck %s |
| 2 | |
| 3 | target datalayout = "p:32:32:32-p1:32:32:32-p2:16:16:16" |
| 4 | |
| 5 | declare void @foo(i32) nounwind |
| 6 | |
| 7 | ; None of these functions should be merged |
| 8 | |
| 9 | define i32 @store_as0(i32* %x) { |
| 10 | ; CHECK-LABEL: @store_as0( |
| 11 | ; CHECK: call void @foo( |
| 12 | %gep = getelementptr i32* %x, i32 4 |
| 13 | %y = load i32* %gep |
| 14 | call void @foo(i32 %y) nounwind |
| 15 | ret i32 %y |
| 16 | } |
| 17 | |
| 18 | define i32 @store_as1(i32 addrspace(1)* %x) { |
| 19 | ; CHECK-LABEL: @store_as1( |
| 20 | ; CHECK: call void @foo( |
| 21 | %gep = getelementptr i32 addrspace(1)* %x, i32 4 |
| 22 | %y = load i32 addrspace(1)* %gep |
| 23 | call void @foo(i32 %y) nounwind |
| 24 | ret i32 %y |
| 25 | } |
| 26 | |
| 27 | define i32 @store_as2(i32 addrspace(2)* %x) { |
| 28 | ; CHECK-LABEL: @store_as2( |
| 29 | ; CHECK: call void @foo( |
| 30 | %gep = getelementptr i32 addrspace(2)* %x, i32 4 |
| 31 | %y = load i32 addrspace(2)* %gep |
| 32 | call void @foo(i32 %y) nounwind |
| 33 | ret i32 %y |
| 34 | } |
| 35 | |