[llvm-commits] [poolalloc] r155775 - in /poolalloc/trunk/test/dsa: callgraph/chain.ll td/chain.ll
Will Dietz
wdietz2 at illinois.edu
Sat Apr 28 15:12:26 PDT 2012
Author: wdietz2
Date: Sat Apr 28 17:12:26 2012
New Revision: 155775
URL: http://llvm.org/viewvc/llvm-project?rev=155775&view=rev
Log:
Add two simple A->B->C chain callgraph tests. Latter checks +H flag also.
Added:
poolalloc/trunk/test/dsa/callgraph/chain.ll
poolalloc/trunk/test/dsa/td/chain.ll
Added: poolalloc/trunk/test/dsa/callgraph/chain.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/callgraph/chain.ll?rev=155775&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/callgraph/chain.ll (added)
+++ poolalloc/trunk/test/dsa/callgraph/chain.ll Sat Apr 28 17:12:26 2012
@@ -0,0 +1,24 @@
+;RUN: dsaopt %s -dsa-cbu -analyze -check-callees=A,B
+;RUN: dsaopt %s -dsa-cbu -analyze -check-callees=B,C
+;RUN: dsaopt %s -dsa-bu -analyze -check-callees=A,B
+;RUN: dsaopt %s -dsa-bu -analyze -check-callees=B,C
+
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @C() {
+entry:
+ ret void
+}
+
+define void @B() {
+entry:
+ call void @C()
+ ret void
+}
+
+define void @A() {
+entry:
+ call void @B()
+ ret void
+}
Added: poolalloc/trunk/test/dsa/td/chain.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/td/chain.ll?rev=155775&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/td/chain.ll (added)
+++ poolalloc/trunk/test/dsa/td/chain.ll Sat Apr 28 17:12:26 2012
@@ -0,0 +1,52 @@
+; Verify callgraph is as expected for all DSA passes
+;RUN: dsaopt %s -dsa-cbu -analyze -check-callees=A,B
+;RUN: dsaopt %s -dsa-cbu -analyze -check-callees=B,C
+;RUN: dsaopt %s -dsa-bu -analyze -check-callees=A,B
+;RUN: dsaopt %s -dsa-bu -analyze -check-callees=B,C
+;RUN: dsaopt %s -dsa-td -analyze -check-callees=A,B
+;RUN: dsaopt %s -dsa-td -analyze -check-callees=B,C
+
+; Verify the heap flag is also set appropriately where it should be
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "C:memC-H"
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "B:memB-H"
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "A:memA-H"
+
+;RUN: dsaopt %s -dsa-stdlib -analyze -verify-flags "C:memC+H"
+;RUN: dsaopt %s -dsa-stdlib -analyze -verify-flags "B:memB-H"
+;RUN: dsaopt %s -dsa-stdlib -analyze -verify-flags "A:memA-H"
+
+;RUN: dsaopt %s -dsa-bu -analyze -verify-flags "C:memC+H"
+;RUN: dsaopt %s -dsa-bu -analyze -verify-flags "B:memB+H"
+;RUN: dsaopt %s -dsa-bu -analyze -verify-flags "A:memA+H"
+
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "C:memC+H"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "B:memB+H"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "A:memA+H"
+
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
+target triple = "x86_64-unknown-linux-gnu"
+
+declare noalias i8* @malloc(i64) nounwind
+
+; Malloc wrapper
+define i8* @C(i64 %size) {
+entry:
+ %memC = call noalias i8* @malloc(i64 %size) nounwind
+ store i8 5, i8* %memC, align 8 ; Store so this isn't detected as an allocator
+ ret i8* %memC
+}
+
+; Chain along to malloc wrapper
+define i8* @B() {
+entry:
+ %memB = call i8* @C(i64 10)
+ ret i8* %memB
+}
+
+define void @A() {
+entry:
+ %memA = call i8* @B()
+ ;call void free(i8* %memA)
+ ; (leak)
+ ret void
+}
More information about the llvm-commits
mailing list