[llvm-commits] [poolalloc] r168381 - in /poolalloc/trunk: lib/DSA/TopDownClosure.cpp test/dsa/regression/2012-11-20.TDUnresolvedIncomplete.ll
Will Dietz
wdietz2 at illinois.edu
Tue Nov 20 11:45:51 PST 2012
Author: wdietz2
Date: Tue Nov 20 13:45:51 2012
New Revision: 168381
URL: http://llvm.org/viewvc/llvm-project?rev=168381&view=rev
Log:
Don't clear AuxCalls at start of TD, we need these to track Incomplete.
Partially reverts r122039, adds test verifying expected behavior.
Should fix PR14190.
Added:
poolalloc/trunk/test/dsa/regression/2012-11-20.TDUnresolvedIncomplete.ll
Modified:
poolalloc/trunk/lib/DSA/TopDownClosure.cpp
Modified: poolalloc/trunk/lib/DSA/TopDownClosure.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/TopDownClosure.cpp?rev=168381&r1=168380&r2=168381&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/TopDownClosure.cpp (original)
+++ poolalloc/trunk/lib/DSA/TopDownClosure.cpp Tue Nov 20 13:45:51 2012
@@ -77,13 +77,6 @@
init(useEQBU ? &getAnalysis<EquivBUDataStructures>()
: &getAnalysis<BUDataStructures>(),
true, true, true, false);
-
- for (Module::iterator F = M.begin(); F != M.end(); ++F) {
- if (!(F->isDeclaration())){
- DSGraph *G = getOrCreateGraph(F);
- G->getAuxFunctionCalls().clear();
- }
- }
// Figure out which functions must not mark their arguments complete because
// they are accessible outside this compilation unit. Currently, these
// arguments are functions which are reachable by incomplete or external
Added: poolalloc/trunk/test/dsa/regression/2012-11-20.TDUnresolvedIncomplete.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/regression/2012-11-20.TDUnresolvedIncomplete.ll?rev=168381&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/regression/2012-11-20.TDUnresolvedIncomplete.ll (added)
+++ poolalloc/trunk/test/dsa/regression/2012-11-20.TDUnresolvedIncomplete.ll Tue Nov 20 13:45:51 2012
@@ -0,0 +1,71 @@
+; PR14190
+; Verify that TD keeps unresolved callsites and properly
+; marks nodes reachable from them as incomplete.
+; This is important as otherwise a DSA client (like DSAA) will
+; erroneously conclude that retptr/ptr in @indirect cannot alias.
+
+; Verify we do eventually discover direct/indirect/indirect2 call foo
+; RUN: dsaopt %s -dsa-td -analyze -check-callees=direct,foo
+; RUN: dsaopt %s -dsa-td -analyze -check-callees=indirect,foo
+; RUN: dsaopt %s -dsa-td -analyze -check-callees=indirect2,foo
+; Within each, by the end of TD, we should either know the effects of calling @foo
+; or mark the related nodes incomplete.
+; Check this:
+; RUN: dsaopt %s -dsa-td -analyze -check-same-node=@direct:ptr, at direct:retptr
+; RUN: dsaopt %s -dsa-td -analyze -verify-flags=@direct:ptr-I, at direct:retptr-I
+; RUN: dsaopt %s -dsa-td -analyze -check-not-same-node=@indirect:ptr, at indirect:retptr
+; RUN: dsaopt %s -dsa-td -analyze -verify-flags=@indirect:ptr+I, at indirect:retptr+I
+; RUN: dsaopt %s -dsa-td -analyze -check-not-same-node=@indirect2:ptr, at indirect2:retptr
+; RUN: dsaopt %s -dsa-td -analyze -verify-flags=@indirect2:ptr+I, at indirect2:retptr+I
+; Check that EQTD also has this behavior.
+; RUN: dsaopt %s -dsa-eqtd -analyze -check-same-node=@direct:ptr, at direct:retptr
+; RUN: dsaopt %s -dsa-eqtd -analyze -verify-flags=@direct:ptr-I, at direct:retptr-I
+; RUN: dsaopt %s -dsa-eqtd -analyze -check-not-same-node=@indirect:ptr, at indirect:retptr
+; RUN: dsaopt %s -dsa-eqtd -analyze -verify-flags=@indirect:ptr+I, at indirect:retptr+I
+; RUN: dsaopt %s -dsa-eqtd -analyze -check-not-same-node=@indirect2:ptr, at indirect2:retptr
+; RUN: dsaopt %s -dsa-eqtd -analyze -verify-flags=@indirect2:ptr+I, at indirect2:retptr+I
+; ModuleID = 'test-fp.bc'
+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-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define i8* @foo(i8* %ptr) nounwind {
+ ret i8* %ptr
+}
+
+; Call foo with ptr
+define void @direct(i8* %ptr) {
+ %retptr = call i8* @foo(i8* %ptr)
+ %val = load i8* %retptr
+ ret void
+}
+
+; Same, but using indirect fp not resolved until inlined into main
+define void @indirect(i8* (i8*)* %fp, i8* %ptr) {
+ %retptr = call i8* %fp(i8* %ptr)
+ %val = load i8* %retptr
+ ret void
+}
+
+; Same, but using indirect fp not resolved until inlined into main
+; with an additional level of indirection
+define void @indirect2(i8* (i8*)** %fpp, i8* %ptr) {
+ %fp = load i8* (i8*)** %fpp
+ %retptr = call i8* %fp(i8* %ptr)
+ %val = load i8* %retptr
+ ret void
+}
+
+define i32 @main(i32 %argc, i8** nocapture %argv) nounwind {
+ ; Conjure some i8*
+ %ptr = load i8** %argv, align 8
+
+ call void @direct(i8* %ptr)
+
+ call void @indirect(i8* (i8*)* @foo, i8* %ptr)
+
+ %fpp = alloca i8* (i8*)*, align 8
+ store i8* (i8*)* @foo, i8* (i8*)** %fpp, align 8
+ call void @indirect2(i8* (i8*)** %fpp, i8* %ptr)
+
+ ret i32 0
+}
More information about the llvm-commits
mailing list