[llvm-commits] [llvm] r51617 - /llvm/trunk/tools/lto2/LTOModule.cpp
Nick Kledzik
kledzik at apple.com
Tue May 27 15:07:08 PDT 2008
Author: kledzik
Date: Tue May 27 17:07:08 2008
New Revision: 51617
URL: http://llvm.org/viewvc/llvm-project?rev=51617&view=rev
Log:
fix infinite recursion if a global's initializer references the global
Modified:
llvm/trunk/tools/lto2/LTOModule.cpp
Modified: llvm/trunk/tools/lto2/LTOModule.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto2/LTOModule.cpp?rev=51617&r1=51616&r2=51617&view=diff
==============================================================================
--- llvm/trunk/tools/lto2/LTOModule.cpp (original)
+++ llvm/trunk/tools/lto2/LTOModule.cpp Tue May 27 17:07:08 2008
@@ -161,7 +161,7 @@
addDefinedSymbol(v, mangler, false);
// add external symbols referenced by this data.
- for (unsigned count = 0, total = v->getNumOperands();\
+ for (unsigned count = 0, total = v->getNumOperands();
count != total; ++count) {
findExternalRefs(v->getOperand(count), mangler);
}
@@ -234,8 +234,13 @@
if (GlobalValue* gv = dyn_cast<GlobalValue>(value)) {
if ( !gv->hasExternalLinkage() )
addPotentialUndefinedSymbol(gv, mangler);
+ // If this is a variable definition, do not recursively process
+ // initializer. It might contain a reference to this variable
+ // and cause an infinite loop. The initializer will be
+ // processed in addDefinedDataSymbol().
+ return;
}
-
+
// GlobalValue, even with InternalLinkage type, may have operands with
// ExternalLinkage type. Do not ignore these operands.
if (Constant* c = dyn_cast<Constant>(value)) {
More information about the llvm-commits
mailing list