1 ; RUN: opt -S -basicaa -licm %s | FileCheck %s
2 declare i32 @foo() readonly argmemonly nounwind
3 declare i32 @foo2() readonly nounwind
4 declare i32 @bar(i32* %loc2) readonly argmemonly nounwind
6 define void @test(i32* %loc) {
13 %res = call i32 @foo()
14 store i32 %res, i32* %loc
18 ; Negative test: show argmemonly is required
19 define void @test_neg(i32* %loc) {
20 ; CHECK-LABEL: @test_neg
26 %res = call i32 @foo2()
27 store i32 %res, i32* %loc
31 define void @test2(i32* noalias %loc, i32* noalias %loc2) {
38 %res = call i32 @bar(i32* %loc2)
39 store i32 %res, i32* %loc
43 ; Negative test: %might clobber gep
44 define void @test3(i32* %loc) {
51 %res = call i32 @bar(i32* %loc)
52 %gep = getelementptr i32, i32 *%loc, i64 1000000
53 store i32 %res, i32* %gep
58 ; Negative test: %loc might alias %loc2
59 define void @test4(i32* %loc, i32* %loc2) {
66 %res = call i32 @bar(i32* %loc2)
67 store i32 %res, i32* %loc