xref: /aosp_15_r20/external/llvm/test/Transforms/InstCombine/nonnull-attribute.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -instcombine -S | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; This test makes sure that we do not assume globals in address spaces other
4*9880d681SAndroid Build Coastguard Worker; than 0 are able to be null.
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker@as0 = external global i32
7*9880d681SAndroid Build Coastguard Worker@as1 = external addrspace(1) global i32
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Workerdeclare void @addrspace0(i32*)
10*9880d681SAndroid Build Coastguard Workerdeclare void @addrspace1(i32 addrspace(1)*)
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard Worker; CHECK: call void @addrspace0(i32* nonnull @as0)
13*9880d681SAndroid Build Coastguard Worker; CHECK: call void @addrspace1(i32 addrspace(1)* @as1)
14*9880d681SAndroid Build Coastguard Worker
15*9880d681SAndroid Build Coastguard Workerdefine void @test() {
16*9880d681SAndroid Build Coastguard Worker  call void @addrspace0(i32* @as0)
17*9880d681SAndroid Build Coastguard Worker  call void @addrspace1(i32 addrspace(1)* @as1)
18*9880d681SAndroid Build Coastguard Worker  ret void
19*9880d681SAndroid Build Coastguard Worker}
20