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