diff options
Diffstat (limited to 'llvm/test/Transforms/LICM/argmemonly-call.ll')
-rw-r--r-- | llvm/test/Transforms/LICM/argmemonly-call.ll | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/llvm/test/Transforms/LICM/argmemonly-call.ll b/llvm/test/Transforms/LICM/argmemonly-call.ll index fe7c6af6d6d..b7d7d6a3953 100644 --- a/llvm/test/Transforms/LICM/argmemonly-call.ll +++ b/llvm/test/Transforms/LICM/argmemonly-call.ll @@ -1,5 +1,8 @@ -; RUN: opt -S -basicaa -licm %s | FileCheck %s -; RUN: opt -aa-pipeline=basic-aa -passes='require<aa>,require<targetir>,require<scalar-evolution>,require<opt-remark-emit>,loop(licm)' < %s -S | FileCheck %s +; RUN: opt -S -basicaa -licm -licm-n2-threshold=0 %s | FileCheck %s +; RUN: opt -licm -basicaa -licm-n2-threshold=200 < %s -S | FileCheck %s --check-prefix=ALIAS-N2 +; RUN: opt -aa-pipeline=basic-aa -licm-n2-threshold=0 -passes='require<aa>,require<targetir>,require<scalar-evolution>,require<opt-remark-emit>,loop(licm)' < %s -S | FileCheck %s +; RUN: opt -aa-pipeline=basic-aa -licm-n2-threshold=200 -passes='require<aa>,require<targetir>,require<scalar-evolution>,require<opt-remark-emit>,loop(licm)' < %s -S | FileCheck %s --check-prefix=ALIAS-N2 + declare i32 @foo() readonly argmemonly nounwind declare i32 @foo2() readonly nounwind declare i32 @bar(i32* %loc2) readonly argmemonly nounwind @@ -68,3 +71,27 @@ loop: store i32 %res, i32* %loc br label %loop } + +declare i32 @foo_new(i32*) readonly +; With the default AST mechanism used by LICM for alias analysis, +; we clump foo_new with bar. +; With the N2 Alias analysis diagnostic tool, we are able to hoist the +; argmemonly bar call out of the loop. + +define void @test5(i32* %loc2, i32* noalias %loc) { +; ALIAS-N2-LABEL: @test5 +; ALIAS-N2: @bar +; ALIAS-N2-LABEL: loop: + +; CHECK-LABEL: @test5 +; CHECK-LABEL: loop: +; CHECK: @bar + br label %loop + +loop: + %res1 = call i32 @bar(i32* %loc2) + %res = call i32 @foo_new(i32* %loc2) + store volatile i32 %res1, i32* %loc + br label %loop +} + |