[llvm] r323407 - [IRMover] Add comment and fix test case
Eugene Leviant via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 25 00:35:52 PST 2018
Author: evgeny777
Date: Thu Jan 25 00:35:52 2018
New Revision: 323407
URL: http://llvm.org/viewvc/llvm-project?rev=323407&view=rev
Log:
[IRMover] Add comment and fix test case
Modified:
llvm/trunk/lib/Linker/IRMover.cpp
llvm/trunk/test/Linker/type-unique-dst-types.ll
Modified: llvm/trunk/lib/Linker/IRMover.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/IRMover.cpp?rev=323407&r1=323406&r2=323407&view=diff
==============================================================================
--- llvm/trunk/lib/Linker/IRMover.cpp (original)
+++ llvm/trunk/lib/Linker/IRMover.cpp Thu Jan 25 00:35:52 2018
@@ -95,6 +95,12 @@ void TypeMapTy::addTypeMapping(Type *Dst
for (StructType *Ty : SpeculativeDstOpaqueTypes)
DstResolvedOpaqueTypes.erase(Ty);
} else {
+ // SrcTy and DstTy are recursively ismorphic. We clear names of SrcTy
+ // and all its descendants to lower amount of renaming in LLVM context
+ // Renaming occurs because we load all source modules to the same context
+ // and declaration with existing name gets renamed (i.e Foo -> Foo.42).
+ // As a result we may get several different types in the destination
+ // module, which are in fact the same.
for (Type *Ty : SpeculativeTypes)
if (auto *STy = dyn_cast<StructType>(Ty))
if (STy->hasName())
Modified: llvm/trunk/test/Linker/type-unique-dst-types.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/type-unique-dst-types.ll?rev=323407&r1=323406&r2=323407&view=diff
==============================================================================
--- llvm/trunk/test/Linker/type-unique-dst-types.ll (original)
+++ llvm/trunk/test/Linker/type-unique-dst-types.ll Thu Jan 25 00:35:52 2018
@@ -1,6 +1,8 @@
; RUN: llvm-link %p/type-unique-dst-types.ll \
; RUN: %p/Inputs/type-unique-dst-types2.ll \
-; RUN: %p/Inputs/type-unique-dst-types3.ll -S -o - | FileCheck %s
+; RUN: %p/Inputs/type-unique-dst-types3.ll -S -o %t1.ll
+; RUN: cat %t1.ll | FileCheck %s
+; RUN: cat %t1.ll | FileCheck --check-prefix=RENAMED %s
; This tests the importance of keeping track of which types are part of the
; destination module.
@@ -14,6 +16,8 @@
; CHECK: @g1 = external global %A
; CHECK: @g2 = external global %A
+; RENAMED-NOT: A.11
+
%A = type { %B }
%B = type { i8 }
@g3 = external global %A
More information about the llvm-commits
mailing list