[llvm-commits] CVS: llvm/lib/Transforms/IPO/FunctionResolution.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sat May 31 16:58:00 PDT 2003
Changes in directory llvm/lib/Transforms/IPO:
FunctionResolution.cpp updated: 1.30 -> 1.31
---
Log message:
Fix bug: FunctionResolve/2003-05-31-AllInternalDecls.ll
---
Diffs of the changes:
Index: llvm/lib/Transforms/IPO/FunctionResolution.cpp
diff -u llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.30 llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.31
--- llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.30 Sat May 31 16:08:45 2003
+++ llvm/lib/Transforms/IPO/FunctionResolution.cpp Sat May 31 16:57:06 2003
@@ -309,6 +309,23 @@
}
if (Globals.size() > 1) { // Found a multiply defined global...
+ // If there are no external declarations, and there is at most one
+ // externally visible instance of the global, then there is nothing to do.
+ //
+ bool HasExternal = false;
+ unsigned NumInstancesWithExternalLinkage = 0;
+
+ for (unsigned i = 0, e = Globals.size(); i != e; ++i) {
+ if (Globals[i]->isExternal())
+ HasExternal = true;
+ else if (!Globals[i]->hasInternalLinkage())
+ NumInstancesWithExternalLinkage++;
+ }
+
+ if (!HasExternal && NumInstancesWithExternalLinkage <= 1)
+ return false; // Nothing to do? Must have multiple internal definitions.
+
+
// We should find exactly one concrete function definition, which is
// probably the implementation. Change all of the function definitions and
// uses to use it instead.
More information about the llvm-commits
mailing list