1; Test to make sure unused llvm.invariant.start calls are not trivially eliminated 2; RUN: opt < %s -instcombine -S | FileCheck %s 3 4declare void @g(i8*) 5declare void @g_addr1(i8 addrspace(1)*) 6 7declare {}* @llvm.invariant.start.p0i8(i64, i8* nocapture) nounwind readonly 8declare {}* @llvm.invariant.start.p1i8(i64, i8 addrspace(1)* nocapture) nounwind readonly 9 10define i8 @f() { 11 %a = alloca i8 ; <i8*> [#uses=4] 12 store i8 0, i8* %a 13 %i = call {}* @llvm.invariant.start.p0i8(i64 1, i8* %a) ; <{}*> [#uses=0] 14 ; CHECK: call {}* @llvm.invariant.start.p0i8 15 call void @g(i8* %a) 16 %r = load i8, i8* %a ; <i8> [#uses=1] 17 ret i8 %r 18} 19 20; make sure llvm.invariant.call in non-default addrspace are also not eliminated. 21define 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] 27 ret i8 %r 28} 29