[llvm-commits] [poolalloc] r118136 - in /poolalloc/trunk: lib/DSA/DSGraph.cpp test/dsa/extern/extern_global.ll
Will Dietz
wdietz2 at illinois.edu
Tue Nov 2 17:59:08 PDT 2010
Author: wdietz2
Date: Tue Nov 2 19:59:08 2010
New Revision: 118136
URL: http://llvm.org/viewvc/llvm-project?rev=118136&view=rev
Log:
Mark globals that aren't both iniitalized and constant as incomplete
(except when ignoring globals)
Don't care about initializer in external, mark all non-internal globals external.
Update testcase to reflect that default linkage on global is external.
Modified:
poolalloc/trunk/lib/DSA/DSGraph.cpp
poolalloc/trunk/test/dsa/extern/extern_global.ll
Modified: poolalloc/trunk/lib/DSA/DSGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DSGraph.cpp?rev=118136&r1=118135&r2=118136&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/DSGraph.cpp (original)
+++ poolalloc/trunk/lib/DSA/DSGraph.cpp Tue Nov 2 19:59:08 2010
@@ -650,12 +650,13 @@
E = AuxFunctionCalls.end(); I != E; ++I)
markIncomplete(*I);
- // Mark all global nodes as incomplete.
- for (DSScalarMap::global_iterator I = ScalarMap.global_begin(),
- E = ScalarMap.global_end(); I != E; ++I)
- if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(*I))
- if (!GV->isConstant() && (Flags & DSGraph::IgnoreGlobals) == 0)
- markIncompleteNode(ScalarMap[GV].getNode());
+ // Mark all global nodes as incomplete that aren't initialized and constant.
+ if ((Flags & DSGraph::IgnoreGlobals) == 0)
+ for (DSScalarMap::global_iterator I = ScalarMap.global_begin(),
+ E = ScalarMap.global_end(); I != E; ++I)
+ if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(*I))
+ if (!(GV->hasInitializer() && GV->isConstant()))
+ markIncompleteNode(ScalarMap[GV].getNode());
// Mark any node with the VAStart flag as incomplete.
if (Flags & DSGraph::MarkVAStart) {
@@ -790,11 +791,8 @@
E = ScalarMap.global_end(); I != E; ++I) {
if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(*I)) {
// If the global is external... mark it as such!
- // FIXME: It's unclear to me that a global we initialize
- // can't be externally visible. For now following original
- // behavior and marking external.
DSNode * N = ScalarMap[GV].getNode();
- if (!GV->hasInitializer() || N->isExternalNode())
+ if (!GV->hasInternalLinkage() || N->isExternalNode())
markExternalNode(N, processedNodes);
}
}
Modified: poolalloc/trunk/test/dsa/extern/extern_global.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/extern/extern_global.ll?rev=118136&r1=118135&r2=118136&view=diff
==============================================================================
--- poolalloc/trunk/test/dsa/extern/extern_global.ll (original)
+++ poolalloc/trunk/test/dsa/extern/extern_global.ll Tue Nov 2 19:59:08 2010
@@ -3,6 +3,8 @@
; Externally visible globals should be marked external, but complete
;RUN: dsaopt %s -dsa-td -analyze -verify-flags globalInt+GE-I
+; (When linkage is not specified, it is external)
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags normalGlobal+GE-I
; Externally visible global and what it points to should be complete/external
;RUN: dsaopt %s -dsa-td -analyze -verify-flags globalIntPtr+GE-I
;RUN: dsaopt %s -dsa-td -analyze -verify-flags globalIntPtr:0+GE-I
@@ -13,7 +15,6 @@
;RUN: dsaopt %s -dsa-td -analyze -verify-flags globalStructWithPointers:8:8+E-I
;RUN: dsaopt %s -dsa-td -analyze -verify-flags main:s+ES-I
; 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
More information about the llvm-commits
mailing list