xref: /aosp_15_r20/external/llvm/test/Transforms/MergeFunc/address-spaces.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: opt -S -mergefunc < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Workertarget datalayout = "p:32:32:32-p1:32:32:32-p2:16:16:16"
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Workerdeclare void @foo(i32) nounwind
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Worker; None of these functions should be merged
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Workerdefine i32 @store_as0(i32* %x) {
10*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @store_as0(
11*9880d681SAndroid Build Coastguard Worker; CHECK: call void @foo(
12*9880d681SAndroid Build Coastguard Worker  %gep = getelementptr i32, i32* %x, i32 4
13*9880d681SAndroid Build Coastguard Worker  %y = load i32, i32* %gep
14*9880d681SAndroid Build Coastguard Worker  call void @foo(i32 %y) nounwind
15*9880d681SAndroid Build Coastguard Worker  ret i32 %y
16*9880d681SAndroid Build Coastguard Worker}
17*9880d681SAndroid Build Coastguard Worker
18*9880d681SAndroid Build Coastguard Workerdefine i32 @store_as1(i32 addrspace(1)* %x) {
19*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @store_as1(
20*9880d681SAndroid Build Coastguard Worker; CHECK: call void @foo(
21*9880d681SAndroid Build Coastguard Worker  %gep = getelementptr i32, i32 addrspace(1)* %x, i32 4
22*9880d681SAndroid Build Coastguard Worker  %y = load i32, i32 addrspace(1)* %gep
23*9880d681SAndroid Build Coastguard Worker  call void @foo(i32 %y) nounwind
24*9880d681SAndroid Build Coastguard Worker  ret i32 %y
25*9880d681SAndroid Build Coastguard Worker}
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard Workerdefine i32 @store_as2(i32 addrspace(2)* %x) {
28*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @store_as2(
29*9880d681SAndroid Build Coastguard Worker; CHECK: call void @foo(
30*9880d681SAndroid Build Coastguard Worker  %gep = getelementptr i32, i32 addrspace(2)* %x, i32 4
31*9880d681SAndroid Build Coastguard Worker  %y = load i32, i32 addrspace(2)* %gep
32*9880d681SAndroid Build Coastguard Worker  call void @foo(i32 %y) nounwind
33*9880d681SAndroid Build Coastguard Worker  ret i32 %y
34*9880d681SAndroid Build Coastguard Worker}
35*9880d681SAndroid Build Coastguard Worker
36