diff --git a/test/Analysis/GlobalsModRef/aliastest.ll b/test/Analysis/GlobalsModRef/aliastest.ll new file mode 100644 index 00000000000..19def385953 --- /dev/null +++ b/test/Analysis/GlobalsModRef/aliastest.ll @@ -0,0 +1,9 @@ +; RUN: llvm-as < %s | opt -globalsmodref-aa -load-vn -gcse | llvm-dis | not grep load +%X = internal global int 4 + +int %test(int *%P) { + store int 7, int* %P + store int 12, int* %X ;; cannot alias P, X's addr isn't taken + %V = load int* %P + ret int %V +} diff --git a/test/Analysis/GlobalsModRef/modreftest.ll b/test/Analysis/GlobalsModRef/modreftest.ll new file mode 100644 index 00000000000..a08eef1b666 --- /dev/null +++ b/test/Analysis/GlobalsModRef/modreftest.ll @@ -0,0 +1,13 @@ +; RUN: llvm-as < %s | opt -globalsmodref-aa -load-vn -gcse | llvm-dis | not grep load +%X = internal global int 4 + +int %test(int *%P) { + store int 12, int* %X + call void %doesnotmodX() + %V = load int* %X + ret int %V +} + +void %doesnotmodX() { + ret void +}