[llvm] r313222 - Revert r313157 "ThinLTO: Correctly follow aliasee references when dead stripping."
Hans Wennborg via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 13 17:40:14 PDT 2017
Author: hans
Date: Wed Sep 13 17:40:14 2017
New Revision: 313222
URL: http://llvm.org/viewvc/llvm-project?rev=313222&view=rev
Log:
Revert r313157 "ThinLTO: Correctly follow aliasee references when dead stripping."
This broke Chromium's CFI build; see crbug.com/765004.
> We were previously handling aliases during dead stripping by adding
> the aliased global's "original name" GUID to the worklist. This will
> lead to incorrect behaviour if the global has local linkage because
> the original name GUID will not correspond to the global's GUID in
> the summary.
>
> Because an alias is just another name for the global that it
> references, there is no need to mark the referenced global as used,
> or to follow references from any other copies of the global. So all
> we need to do is to follow references from the aliasee's summary
> instead of the alias.
>
> Differential Revision: https://reviews.llvm.org/D37789
Removed:
llvm/trunk/test/LTO/Resolution/X86/Inputs/dead-strip-alias.ll
llvm/trunk/test/LTO/Resolution/X86/dead-strip-alias.ll
Modified:
llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp
Modified: llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp?rev=313222&r1=313221&r2=313222&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp Wed Sep 13 17:40:14 2017
@@ -488,14 +488,17 @@ void llvm::computeDeadSymbols(
while (!Worklist.empty()) {
auto VI = Worklist.pop_back_val();
for (auto &Summary : VI.getSummaryList()) {
- GlobalValueSummary *Base = Summary.get();
- if (auto *AS = dyn_cast<AliasSummary>(Base))
- Base = &AS->getAliasee();
- for (auto Ref : Base->refs())
+ for (auto Ref : Summary->refs())
visit(Ref);
- if (auto *FS = dyn_cast<FunctionSummary>(Base))
+ if (auto *FS = dyn_cast<FunctionSummary>(Summary.get()))
for (auto Call : FS->calls())
visit(Call.first);
+ if (auto *AS = dyn_cast<AliasSummary>(Summary.get())) {
+ auto AliaseeGUID = AS->getAliasee().getOriginalName();
+ ValueInfo AliaseeVI = Index.getValueInfo(AliaseeGUID);
+ if (AliaseeVI)
+ visit(AliaseeVI);
+ }
}
}
Index.setWithGlobalValueDeadStripping();
Removed: llvm/trunk/test/LTO/Resolution/X86/Inputs/dead-strip-alias.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/LTO/Resolution/X86/Inputs/dead-strip-alias.ll?rev=313221&view=auto
==============================================================================
--- llvm/trunk/test/LTO/Resolution/X86/Inputs/dead-strip-alias.ll (original)
+++ llvm/trunk/test/LTO/Resolution/X86/Inputs/dead-strip-alias.ll (removed)
@@ -1,4 +0,0 @@
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-unknown-linux-gnu"
-
- at external = global i8 42
Removed: llvm/trunk/test/LTO/Resolution/X86/dead-strip-alias.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/LTO/Resolution/X86/dead-strip-alias.ll?rev=313221&view=auto
==============================================================================
--- llvm/trunk/test/LTO/Resolution/X86/dead-strip-alias.ll (original)
+++ llvm/trunk/test/LTO/Resolution/X86/dead-strip-alias.ll (removed)
@@ -1,20 +0,0 @@
-; RUN: opt -module-summary -o %t %s
-; RUN: opt -module-summary -o %t2 %S/Inputs/dead-strip-alias.ll
-; RUN: llvm-lto2 run %t -r %t,main,px -r %t,alias,p -r %t,external, \
-; RUN: %t2 -r %t2,external,p \
-; RUN: -save-temps -o %t3
-; RUN: llvm-nm %t3.1 | FileCheck %s
-
-; CHECK: D external
-
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-unknown-linux-gnu"
-
- at alias = alias i8*, i8** @internal
-
- at internal = internal global i8* @external
- at external = external global i8
-
-define i8** @main() {
- ret i8** @alias
-}
More information about the llvm-commits
mailing list