[llvm-commits] [poolalloc] r156353 - in /poolalloc/trunk/test/dsa/td: scc-flags.ll scc-global.ll
Will Dietz
wdietz2 at illinois.edu
Mon May 7 18:35:54 PDT 2012
Author: wdietz2
Date: Mon May 7 20:35:54 2012
New Revision: 156353
URL: http://llvm.org/viewvc/llvm-project?rev=156353&view=rev
Log:
Add (failing!) testcases demonstrating bad TD behavior re:SCC's.
This is certainly related to underlying issue in PR12744,
thanks to Jingyue Wu for reporting that issue and getting
TD some apparently much-needed attention!
Added:
poolalloc/trunk/test/dsa/td/scc-flags.ll
poolalloc/trunk/test/dsa/td/scc-global.ll
Added: poolalloc/trunk/test/dsa/td/scc-flags.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/td/scc-flags.ll?rev=156353&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/td/scc-flags.ll (added)
+++ poolalloc/trunk/test/dsa/td/scc-flags.ll Mon May 7 20:35:54 2012
@@ -0,0 +1,39 @@
+; This tests some basic TD functionality--but "obscures" it a tad
+; with a callgraph that has DSCallGraph finding SCC's that are
+; not discovered during BU.
+; When this happens, TD misses all kinds of call edges.
+; Same underlying issue as PR12744.
+
+; Clearly 'ptr' in main should have the 'stack allocated' flag :)
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "main:ptr+S"
+
+; When TD runs, if we're inlining properly, we'll propagate the +S from
+; main down to B. Check this.
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "main:ptr+S"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "A:ptr+S"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "B:ptr+S"
+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 @main() {
+ %ptr = alloca i32
+ call void @A(i32* %ptr)
+ ret i32 0
+}
+
+define internal void @A(i32* %ptr) {
+entry:
+ call void @B(void (void (i32*)*, i32*)* @C, i32* %ptr)
+ ret void
+}
+
+define internal void @B(void (void (i32*)*, i32*)* %FP, i32* %ptr) {
+entry:
+ call void %FP(void (i32*)* @A, i32* null)
+ ret void
+}
+
+define internal void @C(void (i32*)* %FP, i32* %ptr) {
+ call void %FP(i32* %ptr)
+ ret void
+}
Added: poolalloc/trunk/test/dsa/td/scc-global.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/td/scc-global.ll?rev=156353&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/td/scc-global.ll (added)
+++ poolalloc/trunk/test/dsa/td/scc-global.ll Mon May 7 20:35:54 2012
@@ -0,0 +1,52 @@
+; See scc-flags.ll for the reasoning behind this CFG pattern.
+; This builds on it, but goes a step further to demonstrate:
+; a)we lose track of nodes (Globals, at that!) not just flags
+; b)there's another bug lurking that prevents inlining through
+; the dummy callsites constructed in TD. This is tested
+; by checking that information is indeed propagated from B
+; to C through the callsite within B.
+
+; Clearly 'ptr' in main should have the 'stack allocated' flag :)
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "main:ptr+S"
+
+; When TD runs, if we're doing things properly, we'll propagate @Global from
+; main down to the load in C.
+; Additionally, at each stage @Global should point to a +S DSNode
+; Check that this is so:
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "main:ptr+S"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "A:ptr+G"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "A:ptr:0+S"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "B:ptr+G"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "B:ptr:0+S"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "C:ptr+G"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "C:ptr:0+S"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "C:addr+S"
+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"
+
+ at Global = internal global i32* null
+
+define i32 @main() {
+ %ptr = alloca i32
+ store i32* %ptr, i32** @Global
+ call void @A(i32** @Global)
+ ret i32 0
+}
+
+define internal void @A(i32** %ptr) {
+entry:
+ call void @B(void (void (i32**)*, i32**)* @C, i32** %ptr)
+ ret void
+}
+
+define internal void @B(void (void (i32**)*, i32**)* %FP, i32** %ptr) {
+entry:
+ call void %FP(void (i32**)* @A, i32** %ptr)
+ ret void
+}
+
+define internal void @C(void (i32**)* %FP, i32** %ptr) {
+ %addr = load i32** %ptr
+ call void %FP(i32** null)
+ ret void
+}
More information about the llvm-commits
mailing list