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