llvm-6502/test/Transforms/InstCombine/invariant.ll
Duncan Sands a3da922a27 Don't trivially delete unused calls to llvm.invariant.start. This allows
llvm.invariant.start to be used without necessarily being paired with a call
to llvm.invariant.end.  If you run the entire optimization pipeline then such
calls are in fact deleted (adce does it), but that's actually a good thing since
we probably do want them to be zapped late in the game.  There should really be
an integration test that checks that the llvm.invariant.start call lasts long
enough that all passes that do interesting things with it get to do their stuff
before it is deleted.  But since no passes do anything interesting with it yet
this will have to wait for later.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86840 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 15:34:13 +00:00

17 lines
553 B
LLVM

; Test to make sure unused llvm.invariant.start calls are not trivially eliminated
; RUN: opt < %s -instcombine -S | FileCheck %s
declare void @g(i8*)
declare { }* @llvm.invariant.start(i64, i8* nocapture) nounwind readonly
define i8 @f() {
%a = alloca i8 ; <i8*> [#uses=4]
store i8 0, i8* %a
%i = call { }* @llvm.invariant.start(i64 1, i8* %a) ; <{ }*> [#uses=0]
; CHECK: call { }* @llvm.invariant.start
call void @g(i8* %a)
%r = load i8* %a ; <i8> [#uses=1]
ret i8 %r
}