Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CFLAA] Add some interproc. analysis to CFLAnders.
This patch adds function summary support to CFLAnders. It also comes with a lot of tests! Woohoo! Patch by Jia Chen. Differential Revision: https://reviews.llvm.org/D22450 llvm-svn: 276026
- Loading branch information
1 parent
6524bd8
commit 3b05984
Showing
15 changed files
with
636 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
llvm/test/Analysis/CFLAliasAnalysis/Andersen/basic-interproc.ll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
; This testcase ensures that CFL AA won't be too conservative when trying to do | ||
; interprocedural analysis on simple callee | ||
|
||
; RUN: opt < %s -disable-basicaa -cfl-anders-aa -aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s | ||
; RUN: opt < %s -aa-pipeline=cfl-anders-aa -passes=aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s | ||
|
||
; CHECK-LABEL: Function: noop_callee | ||
; CHECK: MayAlias: i32* %arg1, i32* %arg2 | ||
define void @noop_callee(i32* %arg1, i32* %arg2) { | ||
store i32 0, i32* %arg1 | ||
store i32 0, i32* %arg2 | ||
ret void | ||
} | ||
; CHECK-LABEL: Function: test_noop | ||
; CHECK: NoAlias: i32* %a, i32* %b | ||
define void @test_noop() { | ||
%a = alloca i32, align 4 | ||
%b = alloca i32, align 4 | ||
call void @noop_callee(i32* %a, i32* %b) | ||
|
||
ret void | ||
} |
33 changes: 33 additions & 0 deletions
33
llvm/test/Analysis/CFLAliasAnalysis/Andersen/interproc-arg-deref-escape.ll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
; This testcase ensures that CFL AA answers queries soundly when callee tries | ||
; to escape the memory pointed to by its parameters | ||
|
||
; RUN: opt < %s -disable-basicaa -cfl-anders-aa -aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s | ||
; RUN: opt < %s -aa-pipeline=cfl-anders-aa -passes=aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s | ||
|
||
declare void @opaque(i32*) | ||
define void @escape_arg_deref(i32** %arg) { | ||
%arg_deref = load i32*, i32** %arg | ||
call void @opaque(i32* %arg_deref) | ||
ret void | ||
} | ||
; CHECK-LABEL: Function: test_arg_deref_escape | ||
; CHECK: NoAlias: i32* %a, i32** %x | ||
; CHECK: NoAlias: i32* %b, i32** %x | ||
; CHECK: NoAlias: i32* %a, i32* %b | ||
; CHECK: NoAlias: i32** %p, i32** %x | ||
; CHECK: NoAlias: i32* %a, i32** %p | ||
; CHECK: NoAlias: i32* %b, i32** %p | ||
; CHECK: MayAlias: i32* %a, i32* %c | ||
; CHECK: NoAlias: i32* %b, i32* %c | ||
; CHECK: NoAlias: i32* %c, i32** %p | ||
define void @test_arg_deref_escape(i32** %x) { | ||
%a = alloca i32, align 4 | ||
%b = alloca i32, align 4 | ||
%p = alloca i32*, align 4 | ||
|
||
store i32* %a, i32** %p | ||
call void @escape_arg_deref(i32** %p) | ||
%c = load i32*, i32** %x | ||
|
||
ret void | ||
} |
31 changes: 31 additions & 0 deletions
31
llvm/test/Analysis/CFLAliasAnalysis/Andersen/interproc-arg-escape.ll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
; This testcase ensures that CFL AA answers queries soundly when callee tries | ||
; to escape its parameters | ||
|
||
; RUN: opt < %s -disable-basicaa -cfl-anders-aa -aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s | ||
; RUN: opt < %s -aa-pipeline=cfl-anders-aa -passes=aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s | ||
|
||
declare void @opaque(i32*) | ||
define void @escape_arg(i32* %arg) { | ||
call void @opaque(i32* %arg) | ||
ret void | ||
} | ||
; CHECK-LABEL: Function: test_arg_escape | ||
; CHECK: NoAlias: i32* %a, i32** %x | ||
; CHECK: NoAlias: i32* %b, i32** %x | ||
; CHECK: NoAlias: i32* %a, i32* %b | ||
; CHECK: NoAlias: i32* %c, i32** %x | ||
; CHECK: NoAlias: i32* %a, i32* %c | ||
; CHECK: NoAlias: i32* %b, i32* %c | ||
; CHECK: MayAlias: i32* %a, i32* %d | ||
; CHECK: MayAlias: i32* %b, i32* %d | ||
; CHECK: NoAlias: i32* %c, i32* %d | ||
define void @test_arg_escape(i32** %x) { | ||
%a = alloca i32, align 4 | ||
%b = alloca i32, align 4 | ||
%c = alloca i32, align 4 | ||
call void @escape_arg(i32* %a) | ||
call void @escape_arg(i32* %b) | ||
%d = load i32*, i32** %x | ||
|
||
ret void | ||
} |
21 changes: 21 additions & 0 deletions
21
llvm/test/Analysis/CFLAliasAnalysis/Andersen/interproc-ret-arg.ll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
; This testcase ensures that CFL AA answers queries soundly when callee tries | ||
; to return one of its parameters | ||
|
||
; RUN: opt < %s -disable-basicaa -cfl-anders-aa -aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s | ||
; RUN: opt < %s -aa-pipeline=cfl-anders-aa -passes=aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s | ||
|
||
define i32* @return_arg_callee(i32* %arg1, i32* %arg2) { | ||
ret i32* %arg1 | ||
} | ||
; CHECK-LABEL: Function: test_return_arg | ||
; CHECK: NoAlias: i32* %a, i32* %b | ||
; CHECK: MayAlias: i32* %a, i32* %c | ||
; CHECK: NoAlias: i32* %b, i32* %c | ||
define void @test_return_arg() { | ||
%a = alloca i32, align 4 | ||
%b = alloca i32, align 4 | ||
|
||
%c = call i32* @return_arg_callee(i32* %a, i32* %b) | ||
|
||
ret void | ||
} |
Oops, something went wrong.