1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
2 ; RUN: opt -assume-default-is-flat-addrspace -S -passes=infer-address-spaces < %s 2>&1 | FileCheck %s
4 @g = addrspace(1) global i32 0, align 4
7 ; CHECK-LABEL: define ptr @f2() {
9 ; CHECK-NEXT: [[X2:%.*]] = addrspacecast ptr addrspace(1) @g to ptr
10 ; CHECK-NEXT: ret ptr [[X2]]
13 %x1 = addrspacecast ptr addrspacecast (ptr addrspace(1) @g to ptr) to ptr addrspace(1)
14 %x2 = addrspacecast ptr addrspace(1) %x1 to ptr
19 ; CHECK-LABEL: define ptr @f3(
20 ; CHECK-SAME: ) #[[ATTR0:[0-9]+]] {
22 ; CHECK-NEXT: [[X1:%.*]] = addrspacecast ptr addrspacecast (ptr addrspace(1) @g to ptr) to ptr addrspace(1)
23 ; CHECK-NEXT: [[X2:%.*]] = addrspacecast ptr addrspace(1) [[X1]] to ptr
24 ; CHECK-NEXT: ret ptr [[X2]]
27 %x1 = addrspacecast ptr addrspacecast (ptr addrspace(1) @g to ptr) to ptr addrspace(1)
28 %x2 = addrspacecast ptr addrspace(1) %x1 to ptr
32 attributes #0 = { noinline optnone }