[llvm-commits] [poolalloc] r114759 - in /poolalloc/trunk/test/dsa: extern/ extern/dg.exp extern/extern.ll extern/extern2.ll extern/extern3.ll extern/extern_global.ll td/extern.ll td/extern2.ll td/extern3.ll td/extern_global.ll
Will Dietz
wdietz2 at illinois.edu
Fri Sep 24 14:08:54 PDT 2010
Author: wdietz2
Date: Fri Sep 24 16:08:54 2010
New Revision: 114759
URL: http://llvm.org/viewvc/llvm-project?rev=114759&view=rev
Log:
Add 'extern' testing directory, move tests over.
No functionality changes.
Added:
poolalloc/trunk/test/dsa/extern/
poolalloc/trunk/test/dsa/extern/dg.exp
poolalloc/trunk/test/dsa/extern/extern.ll
poolalloc/trunk/test/dsa/extern/extern2.ll
poolalloc/trunk/test/dsa/extern/extern3.ll
poolalloc/trunk/test/dsa/extern/extern_global.ll
Removed:
poolalloc/trunk/test/dsa/td/extern.ll
poolalloc/trunk/test/dsa/td/extern2.ll
poolalloc/trunk/test/dsa/td/extern3.ll
poolalloc/trunk/test/dsa/td/extern_global.ll
Added: poolalloc/trunk/test/dsa/extern/dg.exp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/extern/dg.exp?rev=114759&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/extern/dg.exp (added)
+++ poolalloc/trunk/test/dsa/extern/dg.exp Fri Sep 24 16:08:54 2010
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,cpp}]]
Added: poolalloc/trunk/test/dsa/extern/extern.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/extern/extern.ll?rev=114759&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/extern/extern.ll (added)
+++ poolalloc/trunk/test/dsa/extern/extern.ll Fri Sep 24 16:08:54 2010
@@ -0,0 +1,63 @@
+;Test that pointers from external functions are marked incomplete properly
+;Tests on all the DSA passes for three simple cases:
+;--calling an allocator wrapper (shouldn't be incomplete in interprocedural)
+;--calling a undefined (external) function. Should be incomplete at least
+; once the interprocedural passes run.
+;--calling a function that calls an undefined (external) function.
+; Should be incomplete, tests very basic tracking.
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "main:ptrExtern+IE"
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "main:ptr+I-E"
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "main:ptrViaExtern+IE"
+
+;RUN: dsaopt %s -dsa-bu -analyze -verify-flags "main:ptrExtern+IE"
+;RUN: dsaopt %s -dsa-bu -analyze -verify-flags "main:ptr-IE"
+;RUN: dsaopt %s -dsa-bu -analyze -verify-flags "main:ptrViaExtern+IE"
+
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "main:ptrExtern+IE"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "main:ptr-IE"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "main:ptrViaExtern+IE"
+
+;RUN: dsaopt %s -dsa-cbu -analyze -verify-flags "main:ptrExtern+IE"
+;RUN: dsaopt %s -dsa-cbu -analyze -verify-flags "main:ptr-IE"
+;RUN: dsaopt %s -dsa-cbu -analyze -verify-flags "main:ptrViaExtern+IE"
+
+;RUN: dsaopt %s -dsa-eq -analyze -verify-flags "main:ptrExtern+IE"
+;RUN: dsaopt %s -dsa-eq -analyze -verify-flags "main:ptr-IE"
+;RUN: dsaopt %s -dsa-eq -analyze -verify-flags "main:ptrViaExtern+IE"
+
+;RUN: dsaopt %s -dsa-eqtd -analyze -verify-flags "main:ptrExtern+IE"
+;RUN: dsaopt %s -dsa-eqtd -analyze -verify-flags "main:ptr-IE"
+;RUN: dsaopt %s -dsa-eqtd -analyze -verify-flags "main:ptrViaExtern+IE"
+
+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 i32* @getPointerViaExtern() nounwind {
+entry:
+ %0 = tail call i32* (...)* @getPointerExtern() nounwind ; <i32*> [#uses=1]
+ ret i32* %0
+}
+
+declare i32* @getPointerExtern(...)
+
+define internal noalias i32* @getPointer() nounwind {
+entry:
+ %0 = tail call noalias i8* @malloc(i64 4) nounwind ; <i8*> [#uses=1]
+ %1 = bitcast i8* %0 to i32* ; <i32*> [#uses=1]
+ ret i32* %1
+}
+
+declare noalias i8* @malloc(i64) nounwind
+
+define i32 @main(i32 %argc, i8** nocapture %argv) nounwind {
+entry:
+ %ptr = tail call i32* ()* @getPointer() nounwind
+ %ptrExtern = tail call i32* (...)* @getPointerExtern() nounwind
+ %ptrViaExtern = tail call i32* ()* @getPointerViaExtern() nounwind
+ %val1 = load i32* %ptr, align 4
+ %val2 = load i32* %ptrExtern, align 4
+ %val3 = load i32* %ptrViaExtern, align 4
+ %sum_partial = add i32 %val1, %val2
+ %sum = add i32 %sum_partial, %val3
+ ret i32 %sum
+}
Added: poolalloc/trunk/test/dsa/extern/extern2.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/extern/extern2.ll?rev=114759&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/extern/extern2.ll (added)
+++ poolalloc/trunk/test/dsa/extern/extern2.ll Fri Sep 24 16:08:54 2010
@@ -0,0 +1,38 @@
+;Here we get a pointer from an external function and pass it to a callee.
+;We then test that the flags on that pointer are set appropriately.
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "main:ptr+IE"
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "takesPointer:ptr+IE"
+
+;RUN: dsaopt %s -dsa-bu -analyze -verify-flags "main:ptr+IE"
+;RUN: dsaopt %s -dsa-bu -analyze -verify-flags "takesPointer:ptr+IE"
+
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "main:ptr+IE"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "takesPointer:ptr+IE"
+
+;RUN: dsaopt %s -dsa-cbu -analyze -verify-flags "main:ptr+IE"
+;RUN: dsaopt %s -dsa-cbu -analyze -verify-flags "takesPointer:ptr+IE"
+
+;RUN: dsaopt %s -dsa-eq -analyze -verify-flags "main:ptr+IE"
+;RUN: dsaopt %s -dsa-eq -analyze -verify-flags "takesPointer:ptr+IE"
+
+;RUN: dsaopt %s -dsa-eqtd -analyze -verify-flags "main:ptr+IE"
+;RUN: dsaopt %s -dsa-eqtd -analyze -verify-flags "takesPointer:ptr+IE"
+
+
+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 i32 @takesPointer(i32* nocapture %ptr) nounwind readonly {
+entry:
+ %0 = load i32* %ptr, align 4 ; <i32> [#uses=1]
+ ret i32 %0
+}
+
+define i32 @main(i32 %argc, i8** nocapture %argv) nounwind {
+entry:
+ %ptr = tail call i32* (...)* @getPointerExtern() nounwind
+ %0 = tail call i32 @takesPointer(i32* %ptr) nounwind
+ ret i32 %0
+}
+
+declare i32* @getPointerExtern(...)
Added: poolalloc/trunk/test/dsa/extern/extern3.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/extern/extern3.ll?rev=114759&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/extern/extern3.ll (added)
+++ poolalloc/trunk/test/dsa/extern/extern3.ll Fri Sep 24 16:08:54 2010
@@ -0,0 +1,88 @@
+; ModuleID = 'extern.c'
+;This tests the various cases that could involve incompleteness due
+;to external code, and additionally verifies these flags are NOT set
+;on internal functions.
+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 i32* @getPointerExtern()
+declare void @takesPointerExtern(i32*)
+declare noalias i8* @malloc(i64) nounwind
+declare void @free(i8*) nounwind
+
+;This should be marked incomplete and external due to the
+;unification-based nature of DSA.
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "getPointer:ptr+IE"
+define i32* @getPointer() nounwind {
+entry:
+ %0 = tail call noalias i8* @malloc(i64 4) nounwind ; <i8*> [#uses=1]
+ %ptr = bitcast i8* %0 to i32* ; <i32*> [#uses=1]
+ ret i32* %ptr
+}
+
+;This should be marked incomplete and external due to the
+;unification-based nature of DSA.
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "takesPointer:ptr+IE"
+define i32 @takesPointer(i32* %ptr) nounwind {
+entry:
+ %0 = load i32* %ptr, align 4 ; <i32> [#uses=1]
+ ret i32 %0
+}
+
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "getPointerInternal:ptr-IE"
+define internal i32* @getPointerInternal() nounwind {
+entry:
+ %0 = tail call noalias i8* @malloc(i64 4) nounwind ; <i8*> [#uses=1]
+ %ptr = bitcast i8* %0 to i32* ; <i32*> [#uses=1]
+ ret i32* %ptr
+}
+
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "takesPointerInternal:ptr-IE"
+define internal i32 @takesPointerInternal(i32* %ptr) nounwind {
+entry:
+ %0 = load i32* %ptr, align 4 ; <i32> [#uses=1]
+ ret i32 %0
+}
+
+define i32 @main(i32 %argc, i8** %argv) nounwind {
+entry:
+ call void @checkExterns() nounwind
+ call void @checkExternals() nounwind
+ call void @checkInternals() nounwind
+ ret i32 0
+}
+
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "checkExterns:get+IE"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "checkExterns:take+IE"
+define void @checkExterns() nounwind {
+ %get = tail call i32* ()* @getPointerExtern() nounwind ; <i32*> [#uses=0]
+ %1 = tail call noalias i8* @malloc(i64 4) nounwind ; <i8*> [#uses=2]
+ %take = bitcast i8* %1 to i32* ; <i32*> [#uses=1]
+ tail call void @takesPointerExtern(i32* %take) nounwind
+ tail call void @free(i8* %1) nounwind
+ ret void
+}
+
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "checkExternals:get+IE"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "checkExternals:take+IE"
+define void @checkExternals() nounwind {
+entry:
+ %get = tail call i32* ()* @getPointer() nounwind ; <i32*> [#uses=0]
+ %0 = tail call noalias i8* @malloc(i64 4) nounwind ; <i8*> [#uses=2]
+ %take = bitcast i8* %0 to i32* ; <i32*> [#uses=1]
+ tail call i32 @takesPointer(i32* %take) nounwind
+ tail call void @free(i8* %0) nounwind
+ ret void
+}
+
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "checkInternals:get-IE"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "checkInternals:take-IE"
+define void @checkInternals() nounwind {
+entry:
+ %get = tail call i32* ()* @getPointerInternal() nounwind ; <i32*> [#uses=0]
+ %0 = tail call noalias i8* @malloc(i64 4) nounwind ; <i8*> [#uses=2]
+ %take = bitcast i8* %0 to i32* ; <i32*> [#uses=1]
+ tail call i32 @takesPointerInternal(i32* %take) nounwind
+ tail call void @free(i8* %0) nounwind
+ ret void
+}
Added: poolalloc/trunk/test/dsa/extern/extern_global.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/extern/extern_global.ll?rev=114759&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/extern/extern_global.ll (added)
+++ poolalloc/trunk/test/dsa/extern/extern_global.ll Fri Sep 24 16:08:54 2010
@@ -0,0 +1,49 @@
+; ModuleID = 'extern_global.c'
+;This tests how DSA handles external globals and their completeness in TD.
+
+; Externally visible globals should be incomplete
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags globalInt+GIE
+; Externally visible global and what it points to should be incomplete
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags globalIntPtr+GIE
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags globalIntPtr:0+GIE
+; Externally visible global and what it points to should be incomplete,
+; this time with a struct and point to some stack memory...
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags globalStructWithPointers+GIE
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags globalStructWithPointers:8+IE
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags globalStructWithPointers:8:8+IE
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags main:s+IES
+; Globals that aren't marked 'external' shouldn't be incomplete (or external)
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags normalGlobal+G-IE
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags internalGlobal+G-IE
+; Check some edges of the graph
+;RUN: dsaopt %s -dsa-td -analyze -check-same-node=normalGlobal:0,globalIntPtr
+;RUN: dsaopt %s -dsa-td -analyze -check-same-node=internalGlobal:0,normalGlobal
+;RUN: dsaopt %s -dsa-td -analyze -check-same-node=globalStructWithPointers:8,globalStructWithPointers:8:8
+
+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"
+
+%struct.myStruct = type { i32, %struct.myStruct* }
+
+ at globalStructWithPointers = external global %struct.myStruct
+ at globalIntPtr = external global i32*
+ at globalInt = external global i32
+ at normalGlobal = global i32** null
+ at internalGlobal = internal global i32*** null
+
+define i32 @main() nounwind {
+entry:
+;Create the struct and initialize it
+ %s = alloca %struct.myStruct, align 8 ; <%struct.myStruct*> [#uses=1]
+ %0 = getelementptr inbounds %struct.myStruct* %s, i32 0, i32 1 ; <%struct.myStruct**> [#uses=1]
+ store %struct.myStruct* %s, %struct.myStruct** %0, align 8
+ %1 = getelementptr inbounds %struct.myStruct* %s, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 100, i32* %1, align 8
+;Store the struct into the global
+ store %struct.myStruct* %s, %struct.myStruct** getelementptr inbounds (%struct.myStruct* @globalStructWithPointers, i64 0, i32 1), align 8
+;Play around with the rest of the globals
+ store i32* @globalInt, i32** @globalIntPtr, align 8
+ store i32** @globalIntPtr, i32*** @normalGlobal, align 8
+ store i32*** @normalGlobal, i32**** @internalGlobal, align 8
+ ret i32 undef
+}
Removed: poolalloc/trunk/test/dsa/td/extern.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/td/extern.ll?rev=114758&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/td/extern.ll (original)
+++ poolalloc/trunk/test/dsa/td/extern.ll (removed)
@@ -1,63 +0,0 @@
-;Test that pointers from external functions are marked incomplete properly
-;Tests on all the DSA passes for three simple cases:
-;--calling an allocator wrapper (shouldn't be incomplete in interprocedural)
-;--calling a undefined (external) function. Should be incomplete at least
-; once the interprocedural passes run.
-;--calling a function that calls an undefined (external) function.
-; Should be incomplete, tests very basic tracking.
-;RUN: dsaopt %s -dsa-local -analyze -verify-flags "main:ptrExtern+IE"
-;RUN: dsaopt %s -dsa-local -analyze -verify-flags "main:ptr+I-E"
-;RUN: dsaopt %s -dsa-local -analyze -verify-flags "main:ptrViaExtern+IE"
-
-;RUN: dsaopt %s -dsa-bu -analyze -verify-flags "main:ptrExtern+IE"
-;RUN: dsaopt %s -dsa-bu -analyze -verify-flags "main:ptr-IE"
-;RUN: dsaopt %s -dsa-bu -analyze -verify-flags "main:ptrViaExtern+IE"
-
-;RUN: dsaopt %s -dsa-td -analyze -verify-flags "main:ptrExtern+IE"
-;RUN: dsaopt %s -dsa-td -analyze -verify-flags "main:ptr-IE"
-;RUN: dsaopt %s -dsa-td -analyze -verify-flags "main:ptrViaExtern+IE"
-
-;RUN: dsaopt %s -dsa-cbu -analyze -verify-flags "main:ptrExtern+IE"
-;RUN: dsaopt %s -dsa-cbu -analyze -verify-flags "main:ptr-IE"
-;RUN: dsaopt %s -dsa-cbu -analyze -verify-flags "main:ptrViaExtern+IE"
-
-;RUN: dsaopt %s -dsa-eq -analyze -verify-flags "main:ptrExtern+IE"
-;RUN: dsaopt %s -dsa-eq -analyze -verify-flags "main:ptr-IE"
-;RUN: dsaopt %s -dsa-eq -analyze -verify-flags "main:ptrViaExtern+IE"
-
-;RUN: dsaopt %s -dsa-eqtd -analyze -verify-flags "main:ptrExtern+IE"
-;RUN: dsaopt %s -dsa-eqtd -analyze -verify-flags "main:ptr-IE"
-;RUN: dsaopt %s -dsa-eqtd -analyze -verify-flags "main:ptrViaExtern+IE"
-
-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 i32* @getPointerViaExtern() nounwind {
-entry:
- %0 = tail call i32* (...)* @getPointerExtern() nounwind ; <i32*> [#uses=1]
- ret i32* %0
-}
-
-declare i32* @getPointerExtern(...)
-
-define internal noalias i32* @getPointer() nounwind {
-entry:
- %0 = tail call noalias i8* @malloc(i64 4) nounwind ; <i8*> [#uses=1]
- %1 = bitcast i8* %0 to i32* ; <i32*> [#uses=1]
- ret i32* %1
-}
-
-declare noalias i8* @malloc(i64) nounwind
-
-define i32 @main(i32 %argc, i8** nocapture %argv) nounwind {
-entry:
- %ptr = tail call i32* ()* @getPointer() nounwind
- %ptrExtern = tail call i32* (...)* @getPointerExtern() nounwind
- %ptrViaExtern = tail call i32* ()* @getPointerViaExtern() nounwind
- %val1 = load i32* %ptr, align 4
- %val2 = load i32* %ptrExtern, align 4
- %val3 = load i32* %ptrViaExtern, align 4
- %sum_partial = add i32 %val1, %val2
- %sum = add i32 %sum_partial, %val3
- ret i32 %sum
-}
Removed: poolalloc/trunk/test/dsa/td/extern2.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/td/extern2.ll?rev=114758&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/td/extern2.ll (original)
+++ poolalloc/trunk/test/dsa/td/extern2.ll (removed)
@@ -1,38 +0,0 @@
-;Here we get a pointer from an external function and pass it to a callee.
-;We then test that the flags on that pointer are set appropriately.
-;RUN: dsaopt %s -dsa-local -analyze -verify-flags "main:ptr+IE"
-;RUN: dsaopt %s -dsa-local -analyze -verify-flags "takesPointer:ptr+IE"
-
-;RUN: dsaopt %s -dsa-bu -analyze -verify-flags "main:ptr+IE"
-;RUN: dsaopt %s -dsa-bu -analyze -verify-flags "takesPointer:ptr+IE"
-
-;RUN: dsaopt %s -dsa-td -analyze -verify-flags "main:ptr+IE"
-;RUN: dsaopt %s -dsa-td -analyze -verify-flags "takesPointer:ptr+IE"
-
-;RUN: dsaopt %s -dsa-cbu -analyze -verify-flags "main:ptr+IE"
-;RUN: dsaopt %s -dsa-cbu -analyze -verify-flags "takesPointer:ptr+IE"
-
-;RUN: dsaopt %s -dsa-eq -analyze -verify-flags "main:ptr+IE"
-;RUN: dsaopt %s -dsa-eq -analyze -verify-flags "takesPointer:ptr+IE"
-
-;RUN: dsaopt %s -dsa-eqtd -analyze -verify-flags "main:ptr+IE"
-;RUN: dsaopt %s -dsa-eqtd -analyze -verify-flags "takesPointer:ptr+IE"
-
-
-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 i32 @takesPointer(i32* nocapture %ptr) nounwind readonly {
-entry:
- %0 = load i32* %ptr, align 4 ; <i32> [#uses=1]
- ret i32 %0
-}
-
-define i32 @main(i32 %argc, i8** nocapture %argv) nounwind {
-entry:
- %ptr = tail call i32* (...)* @getPointerExtern() nounwind
- %0 = tail call i32 @takesPointer(i32* %ptr) nounwind
- ret i32 %0
-}
-
-declare i32* @getPointerExtern(...)
Removed: poolalloc/trunk/test/dsa/td/extern3.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/td/extern3.ll?rev=114758&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/td/extern3.ll (original)
+++ poolalloc/trunk/test/dsa/td/extern3.ll (removed)
@@ -1,88 +0,0 @@
-; ModuleID = 'extern.c'
-;This tests the various cases that could involve incompleteness due
-;to external code, and additionally verifies these flags are NOT set
-;on internal functions.
-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 i32* @getPointerExtern()
-declare void @takesPointerExtern(i32*)
-declare noalias i8* @malloc(i64) nounwind
-declare void @free(i8*) nounwind
-
-;This should be marked incomplete and external due to the
-;unification-based nature of DSA.
-;RUN: dsaopt %s -dsa-td -analyze -verify-flags "getPointer:ptr+IE"
-define i32* @getPointer() nounwind {
-entry:
- %0 = tail call noalias i8* @malloc(i64 4) nounwind ; <i8*> [#uses=1]
- %ptr = bitcast i8* %0 to i32* ; <i32*> [#uses=1]
- ret i32* %ptr
-}
-
-;This should be marked incomplete and external due to the
-;unification-based nature of DSA.
-;RUN: dsaopt %s -dsa-td -analyze -verify-flags "takesPointer:ptr+IE"
-define i32 @takesPointer(i32* %ptr) nounwind {
-entry:
- %0 = load i32* %ptr, align 4 ; <i32> [#uses=1]
- ret i32 %0
-}
-
-;RUN: dsaopt %s -dsa-td -analyze -verify-flags "getPointerInternal:ptr-IE"
-define internal i32* @getPointerInternal() nounwind {
-entry:
- %0 = tail call noalias i8* @malloc(i64 4) nounwind ; <i8*> [#uses=1]
- %ptr = bitcast i8* %0 to i32* ; <i32*> [#uses=1]
- ret i32* %ptr
-}
-
-;RUN: dsaopt %s -dsa-td -analyze -verify-flags "takesPointerInternal:ptr-IE"
-define internal i32 @takesPointerInternal(i32* %ptr) nounwind {
-entry:
- %0 = load i32* %ptr, align 4 ; <i32> [#uses=1]
- ret i32 %0
-}
-
-define i32 @main(i32 %argc, i8** %argv) nounwind {
-entry:
- call void @checkExterns() nounwind
- call void @checkExternals() nounwind
- call void @checkInternals() nounwind
- ret i32 0
-}
-
-;RUN: dsaopt %s -dsa-td -analyze -verify-flags "checkExterns:get+IE"
-;RUN: dsaopt %s -dsa-td -analyze -verify-flags "checkExterns:take+IE"
-define void @checkExterns() nounwind {
- %get = tail call i32* ()* @getPointerExtern() nounwind ; <i32*> [#uses=0]
- %1 = tail call noalias i8* @malloc(i64 4) nounwind ; <i8*> [#uses=2]
- %take = bitcast i8* %1 to i32* ; <i32*> [#uses=1]
- tail call void @takesPointerExtern(i32* %take) nounwind
- tail call void @free(i8* %1) nounwind
- ret void
-}
-
-;RUN: dsaopt %s -dsa-td -analyze -verify-flags "checkExternals:get+IE"
-;RUN: dsaopt %s -dsa-td -analyze -verify-flags "checkExternals:take+IE"
-define void @checkExternals() nounwind {
-entry:
- %get = tail call i32* ()* @getPointer() nounwind ; <i32*> [#uses=0]
- %0 = tail call noalias i8* @malloc(i64 4) nounwind ; <i8*> [#uses=2]
- %take = bitcast i8* %0 to i32* ; <i32*> [#uses=1]
- tail call i32 @takesPointer(i32* %take) nounwind
- tail call void @free(i8* %0) nounwind
- ret void
-}
-
-;RUN: dsaopt %s -dsa-td -analyze -verify-flags "checkInternals:get-IE"
-;RUN: dsaopt %s -dsa-td -analyze -verify-flags "checkInternals:take-IE"
-define void @checkInternals() nounwind {
-entry:
- %get = tail call i32* ()* @getPointerInternal() nounwind ; <i32*> [#uses=0]
- %0 = tail call noalias i8* @malloc(i64 4) nounwind ; <i8*> [#uses=2]
- %take = bitcast i8* %0 to i32* ; <i32*> [#uses=1]
- tail call i32 @takesPointerInternal(i32* %take) nounwind
- tail call void @free(i8* %0) nounwind
- ret void
-}
Removed: poolalloc/trunk/test/dsa/td/extern_global.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/td/extern_global.ll?rev=114758&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/td/extern_global.ll (original)
+++ poolalloc/trunk/test/dsa/td/extern_global.ll (removed)
@@ -1,49 +0,0 @@
-; ModuleID = 'extern_global.c'
-;This tests how DSA handles external globals and their completeness in TD.
-
-; Externally visible globals should be incomplete
-;RUN: dsaopt %s -dsa-td -analyze -verify-flags globalInt+GIE
-; Externally visible global and what it points to should be incomplete
-;RUN: dsaopt %s -dsa-td -analyze -verify-flags globalIntPtr+GIE
-;RUN: dsaopt %s -dsa-td -analyze -verify-flags globalIntPtr:0+GIE
-; Externally visible global and what it points to should be incomplete,
-; this time with a struct and point to some stack memory...
-;RUN: dsaopt %s -dsa-td -analyze -verify-flags globalStructWithPointers+GIE
-;RUN: dsaopt %s -dsa-td -analyze -verify-flags globalStructWithPointers:8+IE
-;RUN: dsaopt %s -dsa-td -analyze -verify-flags globalStructWithPointers:8:8+IE
-;RUN: dsaopt %s -dsa-td -analyze -verify-flags main:s+IES
-; Globals that aren't marked 'external' shouldn't be incomplete (or external)
-;RUN: dsaopt %s -dsa-td -analyze -verify-flags normalGlobal+G-IE
-;RUN: dsaopt %s -dsa-td -analyze -verify-flags internalGlobal+G-IE
-; Check some edges of the graph
-;RUN: dsaopt %s -dsa-td -analyze -check-same-node=normalGlobal:0,globalIntPtr
-;RUN: dsaopt %s -dsa-td -analyze -check-same-node=internalGlobal:0,normalGlobal
-;RUN: dsaopt %s -dsa-td -analyze -check-same-node=globalStructWithPointers:8,globalStructWithPointers:8:8
-
-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"
-
-%struct.myStruct = type { i32, %struct.myStruct* }
-
- at globalStructWithPointers = external global %struct.myStruct
- at globalIntPtr = external global i32*
- at globalInt = external global i32
- at normalGlobal = global i32** null
- at internalGlobal = internal global i32*** null
-
-define i32 @main() nounwind {
-entry:
-;Create the struct and initialize it
- %s = alloca %struct.myStruct, align 8 ; <%struct.myStruct*> [#uses=1]
- %0 = getelementptr inbounds %struct.myStruct* %s, i32 0, i32 1 ; <%struct.myStruct**> [#uses=1]
- store %struct.myStruct* %s, %struct.myStruct** %0, align 8
- %1 = getelementptr inbounds %struct.myStruct* %s, i32 0, i32 0 ; <i32*> [#uses=1]
- store i32 100, i32* %1, align 8
-;Store the struct into the global
- store %struct.myStruct* %s, %struct.myStruct** getelementptr inbounds (%struct.myStruct* @globalStructWithPointers, i64 0, i32 1), align 8
-;Play around with the rest of the globals
- store i32* @globalInt, i32** @globalIntPtr, align 8
- store i32** @globalIntPtr, i32*** @normalGlobal, align 8
- store i32*** @normalGlobal, i32**** @internalGlobal, align 8
- ret i32 undef
-}
More information about the llvm-commits
mailing list