llvm.org GIT mirror llvm / 2ca4715
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313222 91177308-0d34-0410-b5e6-96231b3b80d8 Hans Wennborg 3 years ago
3 changed file(s) with 8 addition(s) and 29 deletion(s). Raw diff Collapse all Expand all
487487 while (!Worklist.empty()) {
488488 auto VI = Worklist.pop_back_val();
489489 for (auto &Summary : VI.getSummaryList()) {
490 GlobalValueSummary *Base = Summary.get();
491 if (auto *AS = dyn_cast(Base))
492 Base = &AS->getAliasee();
493 for (auto Ref : Base->refs())
490 for (auto Ref : Summary->refs())
494491 visit(Ref);
495 if (auto *FS = dyn_cast(Base))
492 if (auto *FS = dyn_cast(Summary.get()))
496493 for (auto Call : FS->calls())
497494 visit(Call.first);
495 if (auto *AS = dyn_cast(Summary.get())) {
496 auto AliaseeGUID = AS->getAliasee().getOriginalName();
497 ValueInfo AliaseeVI = Index.getValueInfo(AliaseeGUID);
498 if (AliaseeVI)
499 visit(AliaseeVI);
500 }
498501 }
499502 }
500503 Index.setWithGlobalValueDeadStripping();
+0
-4
test/LTO/Resolution/X86/Inputs/dead-strip-alias.ll less more
None target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
1 target triple = "x86_64-unknown-linux-gnu"
2
3 @external = global i8 42
+0
-20
test/LTO/Resolution/X86/dead-strip-alias.ll less more
None ; RUN: opt -module-summary -o %t %s
1 ; RUN: opt -module-summary -o %t2 %S/Inputs/dead-strip-alias.ll
2 ; RUN: llvm-lto2 run %t -r %t,main,px -r %t,alias,p -r %t,external, \
3 ; RUN: %t2 -r %t2,external,p \
4 ; RUN: -save-temps -o %t3
5 ; RUN: llvm-nm %t3.1 | FileCheck %s
6
7 ; CHECK: D external
8
9 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
10 target triple = "x86_64-unknown-linux-gnu"
11
12 @alias = alias i8*, i8** @internal
13
14 @internal = internal global i8* @external
15 @external = external global i8
16
17 define i8** @main() {
18 ret i8** @alias
19 }