2002-05-16 01:03:12 +00:00
|
|
|
; This testcase ensures that redundant loads are preserved when they are not
|
|
|
|
; allowed to be eliminated.
|
2003-09-16 15:29:54 +00:00
|
|
|
; RUN: llvm-as < %s | opt -load-vn -gcse | llvm-dis | grep sub
|
2002-05-16 01:03:12 +00:00
|
|
|
;
|
2003-06-16 11:59:34 +00:00
|
|
|
int %test1(int* %P) {
|
2002-05-16 01:03:12 +00:00
|
|
|
%A = load int* %P
|
2003-06-16 11:59:34 +00:00
|
|
|
store int 1, int* %P
|
2002-05-16 01:03:12 +00:00
|
|
|
%B = load int* %P
|
2003-06-16 11:59:34 +00:00
|
|
|
%C = sub int %A, %B
|
2002-05-16 01:03:12 +00:00
|
|
|
ret int %C
|
|
|
|
}
|
|
|
|
|
2003-06-16 11:59:34 +00:00
|
|
|
int %test2(int* %P) {
|
2002-05-16 01:03:12 +00:00
|
|
|
%A = load int* %P
|
|
|
|
br label %BB2
|
|
|
|
BB2:
|
2003-06-16 11:59:34 +00:00
|
|
|
store int 5, int* %P
|
2002-05-16 01:03:12 +00:00
|
|
|
br label %BB3
|
|
|
|
BB3:
|
|
|
|
%B = load int* %P
|
2003-06-16 11:59:34 +00:00
|
|
|
%C = sub int %A, %B
|
2002-05-16 01:03:12 +00:00
|
|
|
ret int %C
|
|
|
|
}
|
|
|
|
|
|
|
|
|