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