1 ; Test to make sure unused llvm.invariant.start calls are not trivially eliminated
2 ; RUN: opt < %s -instcombine -S | FileCheck %s
5 declare void @g_addr1(i8 addrspace(1)*)
7 declare {}* @llvm.invariant.start.p0i8(i64, i8* nocapture) nounwind readonly
8 declare {}* @llvm.invariant.start.p1i8(i64, i8 addrspace(1)* nocapture) nounwind readonly
11 %a = alloca i8 ; <i8*> [#uses=4]
13 %i = call {}* @llvm.invariant.start.p0i8(i64 1, i8* %a) ; <{}*> [#uses=0]
14 ; CHECK: call {}* @llvm.invariant.start.p0i8
16 %r = load i8, i8* %a ; <i8> [#uses=1]
20 ; make sure llvm.invariant.call in non-default addrspace are also not eliminated.
21 define i8 @f_addrspace1(i8 addrspace(1)* %a) {
22 store i8 0, i8 addrspace(1)* %a
23 %i = call {}* @llvm.invariant.start.p1i8(i64 1, i8 addrspace(1)* %a) ; <{}*> [#uses=0]
24 ; CHECK: call {}* @llvm.invariant.start.p1i8
25 call void @g_addr1(i8 addrspace(1)* %a)
26 %r = load i8, i8 addrspace(1)* %a ; <i8> [#uses=1]