[llvm] r258362 - Simplify the logic. NFC.
Mehdi Amini via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 29 14:00:51 PST 2016
Hi Rafael,
You mentioned “NFC" in you commit message but I have a test case where it is actually not. Before you patch the definition of foo in the destination module was (incorrectly) changed to external_weak.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: to.ll
Type: application/octet-stream
Size: 146 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160129/513f87d9/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: from.ll
Type: application/octet-stream
Size: 116 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160129/513f87d9/attachment-0001.obj>
-------------- next part --------------
llvm-as -function-summary to.ll ;
llvm-as -function-summary from.ll ;
llvm-lto -thinlto -o summary from.bc to.bc ;
opt -function-import to.bc -summary-file=summary.thinlto.bc -S
While this actually fixes a bug I had, you may want to double check the logic here to make sure it won’t break other cases.
—
Mehdi
> On Jan 20, 2016, at 2:38 PM, Rafael Espindola via llvm-commits <llvm-commits at lists.llvm.org> wrote:
>
> Author: rafael
> Date: Wed Jan 20 16:38:23 2016
> New Revision: 258362
>
> URL: http://llvm.org/viewvc/llvm-project?rev=258362&view=rev
> Log:
> Simplify the logic. NFC.
>
> Found while reviewing the change for PR26152.
>
> Modified:
> llvm/trunk/lib/Linker/IRMover.cpp
>
> Modified: llvm/trunk/lib/Linker/IRMover.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/IRMover.cpp?rev=258362&r1=258361&r2=258362&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Linker/IRMover.cpp (original)
> +++ llvm/trunk/lib/Linker/IRMover.cpp Wed Jan 20 16:38:23 2016
> @@ -1005,23 +1005,6 @@ Constant *IRLinker::linkAppendingVarProt
> return Ret;
> }
>
> -static bool useExistingDest(GlobalValue &SGV, GlobalValue *DGV,
> - bool ShouldLink) {
> - if (!DGV)
> - return false;
> -
> - if (SGV.isDeclaration())
> - return true;
> -
> - if (DGV->isDeclarationForLinker() && !SGV.isDeclarationForLinker())
> - return false;
> -
> - if (ShouldLink)
> - return false;
> -
> - return true;
> -}
> -
> bool IRLinker::shouldLink(GlobalValue *DGV, GlobalValue &SGV) {
> // Already imported all the values. Just map to the Dest value
> // in case it is referenced in the metadata.
> @@ -1037,7 +1020,7 @@ bool IRLinker::shouldLink(GlobalValue *D
> if (SGV.hasLocalLinkage())
> return true;
>
> - if (DGV && !DGV->isDeclaration())
> + if (DGV && !DGV->isDeclarationForLinker())
> return false;
>
> if (SGV.hasAvailableExternallyLinkage())
> @@ -1077,7 +1060,7 @@ Constant *IRLinker::linkGlobalValueProto
> cast<GlobalVariable>(SGV));
>
> GlobalValue *NewGV;
> - if (useExistingDest(*SGV, DGV, ShouldLink)) {
> + if (DGV && !ShouldLink) {
> NewGV = DGV;
> } else {
> // If we are done linking global value bodies (i.e. we are performing
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list