[llvm-commits] [llvm] r51617 - /llvm/trunk/tools/lto2/LTOModule.cpp
Chris Lattner
clattner at apple.com
Tue May 27 17:00:19 PDT 2008
On May 27, 2008, at 3:07 PM, Nick Kledzik wrote:
> URL: http://llvm.org/viewvc/llvm-project?rev=51617&view=rev
> Log:
> fix infinite recursion if a global's initializer references the global
Hey Nick,
Please expand the tabs into spaces, thanks!
-Chris
>
>
> 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)) {
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list