diff --git a/test/Analysis/DSGraph/2004-03-10-ElimLoad.ll b/test/Analysis/DSGraph/2004-03-10-ElimLoad.ll new file mode 100644 index 00000000000..1ae0a48a843 --- /dev/null +++ b/test/Analysis/DSGraph/2004-03-10-ElimLoad.ll @@ -0,0 +1,13 @@ +; RUN: llvm-as < %s | opt -ds-aa -load-vn -gcse -instcombine | llvm-dis | not grep sub + +void %bar(int* %p) { + ret void +} + +int %foo(int* %a) { + %b = load int* %a + call void %bar(int* %a) + %d = load int* %a + %e = sub int %b, %d + ret int %e +} diff --git a/test/Analysis/DSGraph/2004-03-10-NoElimLoad.ll b/test/Analysis/DSGraph/2004-03-10-NoElimLoad.ll new file mode 100644 index 00000000000..3a8e540ef16 --- /dev/null +++ b/test/Analysis/DSGraph/2004-03-10-NoElimLoad.ll @@ -0,0 +1,14 @@ +; RUN: llvm-as < %s | opt -ds-aa -load-vn -gcse -instcombine | llvm-dis | grep sub + +void %bar(int* %p) { + store int 15, int* %p + ret void +} + +int %foo(int* %a) { + %b = load int* %a + call void %bar(int* %a) + %d = load int* %a + %e = sub int %b, %d + ret int %e +}