diff options
| author | George Burgess IV <george.burgess.iv@gmail.com> | 2016-04-05 21:40:45 +0000 |
|---|---|---|
| committer | George Burgess IV <george.burgess.iv@gmail.com> | 2016-04-05 21:40:45 +0000 |
| commit | 7e5404cc2069df535019a71d8b0139706f3e5c25 (patch) | |
| tree | 1a5be74092db0f02d64357c148ceb95d20f1aa21 /llvm/test | |
| parent | c94fbee9f66ea7f5777accf421096808bbb083b1 (diff) | |
| download | bcm5719-llvm-7e5404cc2069df535019a71d8b0139706f3e5c25.tar.gz bcm5719-llvm-7e5404cc2069df535019a71d8b0139706f3e5c25.zip | |
[CFLAA] Fix PR27213; incorrect tagging of args/globals
Prior to this patch, CFLAA wouldn't tag arguments/globals properly if
it didn't find any "interesting" edges on them. This means that, if all
you do is store constants to a global or argument, we would never
actually treat it as a global/argument.
Test case:
define void @foo(i32* %A, i32* %B) #0 {
entry:
store i32 0, i32* %A, align 4
store i32 0, i32* %B, align 4
ret void
}
CFLAA would say that %A can't alias %B, because neither pointer was
used in an interesting way. This patch makes us note whether something
is an argument, global, ... regardless of how interesting CFLAA thinks
its uses are.
(For the record, using a value in an interesting way means loading
from it, using it in a GEP, ...)
llvm-svn: 265474
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/Analysis/CFLAliasAnalysis/basic-interproc.ll | 7 | ||||
| -rw-r--r-- | llvm/test/Analysis/CFLAliasAnalysis/pr27213.ll | 39 |
2 files changed, 41 insertions, 5 deletions
diff --git a/llvm/test/Analysis/CFLAliasAnalysis/basic-interproc.ll b/llvm/test/Analysis/CFLAliasAnalysis/basic-interproc.ll index f99fa3a3c3c..952afd7c2ae 100644 --- a/llvm/test/Analysis/CFLAliasAnalysis/basic-interproc.ll +++ b/llvm/test/Analysis/CFLAliasAnalysis/basic-interproc.ll @@ -4,11 +4,8 @@ ; RUN: opt < %s -disable-basicaa -cfl-aa -aa-eval -print-may-aliases -disable-output 2>&1 | FileCheck %s ; RUN: opt < %s -aa-pipeline=cfl-aa -passes=aa-eval -print-may-aliases -disable-output 2>&1 | FileCheck %s -; CHECK: Function: test -; CHECK: 2 Total Alias Queries Performed -; CHECK: 1 no alias responses -; ^^ In @test2, %arg1 and %arg2 may alias - +; CHECK: Function: test2 +; CHECK: MayAlias: i32* %arg1, i32* %arg2 define void @test2(i32* %arg1, i32* %arg2) { store i32 0, i32* %arg1 store i32 0, i32* %arg2 diff --git a/llvm/test/Analysis/CFLAliasAnalysis/pr27213.ll b/llvm/test/Analysis/CFLAliasAnalysis/pr27213.ll new file mode 100644 index 00000000000..2b40f4a10b9 --- /dev/null +++ b/llvm/test/Analysis/CFLAliasAnalysis/pr27213.ll @@ -0,0 +1,39 @@ +; RUN: opt < %s -disable-basicaa -cfl-aa -aa-eval -print-may-aliases -disable-output 2>&1 | FileCheck %s +; RUN: opt < %s -aa-pipeline=cfl-aa -passes=aa-eval -print-may-aliases -disable-output 2>&1 | FileCheck %s + +; CHECK-LABEL: Function: foo +; CHECK: MayAlias: i32* %A, i32* %B +define void @foo(i32* %A, i32* %B) { +entry: + store i32 0, i32* %A, align 4 + store i32 0, i32* %B, align 4 + ret void +} + +; CHECK-LABEL: Function: bar +; CHECK: MayAlias: i32* %A, i32* %B +; CHECK: MayAlias: i32* %A, i32* %arrayidx +; CHECK: MayAlias: i32* %B, i32* %arrayidx +define void @bar(i32* %A, i32* %B) { +entry: + store i32 0, i32* %A, align 4 + %arrayidx = getelementptr inbounds i32, i32* %B, i64 1 + store i32 0, i32* %arrayidx, align 4 + ret void +} + +@G = global i32 0 + +; CHECK-LABEL: Function: baz +; CHECK: MayAlias: i32* %A, i32* @G +define void @baz(i32* %A) { +entry: + store i32 0, i32* %A, align 4 + store i32 0, i32* @G, align 4 + ret void +} + +; CHECK-LABEL: Alias Analysis Evaluator Report +; CHECK: 5 Total Alias Queries Performed +; CHECK: 0 no alias responses +; CHECK: 5 may alias responses |

