blob: 88a0c7f2987fb120058d66fe5ea5d133cfa48fd0 [file] [log] [blame]
Chris Lattner5abaa0c2002-05-16 01:03:12 +00001; This testcase ensures that redundant loads are preserved when they are not
2; allowed to be eliminated.
Misha Brukmane78760e2003-09-16 15:29:54 +00003; RUN: llvm-as < %s | opt -load-vn -gcse | llvm-dis | grep sub
Chris Lattner5abaa0c2002-05-16 01:03:12 +00004;
Chris Lattner14d7f5d2003-06-16 11:59:34 +00005int %test1(int* %P) {
Chris Lattner5abaa0c2002-05-16 01:03:12 +00006 %A = load int* %P
Chris Lattner14d7f5d2003-06-16 11:59:34 +00007 store int 1, int* %P
Chris Lattner5abaa0c2002-05-16 01:03:12 +00008 %B = load int* %P
Chris Lattner14d7f5d2003-06-16 11:59:34 +00009 %C = sub int %A, %B
Chris Lattner5abaa0c2002-05-16 01:03:12 +000010 ret int %C
11}
12
Chris Lattner14d7f5d2003-06-16 11:59:34 +000013int %test2(int* %P) {
Chris Lattner5abaa0c2002-05-16 01:03:12 +000014 %A = load int* %P
15 br label %BB2
16BB2:
Chris Lattner14d7f5d2003-06-16 11:59:34 +000017 store int 5, int* %P
Chris Lattner5abaa0c2002-05-16 01:03:12 +000018 br label %BB3
19BB3:
20 %B = load int* %P
Chris Lattner14d7f5d2003-06-16 11:59:34 +000021 %C = sub int %A, %B
Chris Lattner5abaa0c2002-05-16 01:03:12 +000022 ret int %C
23}
24
25