2004-10-12 04:51:55 +00:00
|
|
|
; This test makes sure that memmove instructions are properly eliminated.
|
|
|
|
;
|
2008-03-18 03:45:45 +00:00
|
|
|
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
|
2007-04-14 20:13:02 +00:00
|
|
|
; RUN: not grep {call void @llvm.memmove}
|
2004-10-12 04:51:55 +00:00
|
|
|
|
2008-03-18 03:45:45 +00:00
|
|
|
@S = internal constant [33 x i8] c"panic: restorelist inconsistency\00" ; <[33 x i8]*> [#uses=1]
|
2004-10-12 04:51:55 +00:00
|
|
|
|
2008-03-18 03:45:45 +00:00
|
|
|
declare void @llvm.memmove.i32(i8*, i8*, i32, i32)
|
2004-10-12 04:51:55 +00:00
|
|
|
|
2008-03-18 03:45:45 +00:00
|
|
|
define void @test1(i8* %A, i8* %B, i32 %N) {
|
|
|
|
call void @llvm.memmove.i32( i8* %A, i8* %B, i32 0, i32 1 )
|
2004-10-12 04:51:55 +00:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2008-03-18 03:45:45 +00:00
|
|
|
define void @test2(i8* %A, i32 %N) {
|
|
|
|
;; dest can't alias source since we can't write to source!
|
|
|
|
call void @llvm.memmove.i32( i8* %A, i8* getelementptr ([33 x i8]* @S, i32 0, i32 0), i32 %N, i32 1 )
|
2004-10-12 04:51:55 +00:00
|
|
|
ret void
|
|
|
|
}
|