forked from OSchip/llvm-project
COFF: Add a test for ICF which LLD cannot handle yet.
In this test, we have two functions, foo and bar. MSVC linker can choose one and discard the other using ICF. LLD cannot. I add this test as a TODO. foo and bar are conceptually equivalent to the following: void foo() { foo(); } void bar() { foo(); } foo and bar are effectively the same function. If foo and bar are compiled to the same instructions, both their contents (foo and bar) and relocation targets (foo) become the same, so from the ICF point of view, they are reducible. But their graphs are not isomorphic! LLD's ICF algorithm cannot handle this case yet. llvm-svn: 247721
This commit is contained in:
parent
151c032c86
commit
c26bbfe6b6
|
@ -0,0 +1,69 @@
|
|||
# RUN: yaml2obj < %s > %t.obj
|
||||
# RUN: lld-link /entry:foo /out:%t.exe /subsystem:console /include:bar \
|
||||
# RUN: /opt:lldicf /verbose %t.obj > %t.log 2>&1
|
||||
# RUN: FileCheck %s < %t.log
|
||||
|
||||
# TODO: LLD should be able to merge foo and bar.
|
||||
# CHECK-NOT: Replaced bar
|
||||
|
||||
---
|
||||
header:
|
||||
Machine: IMAGE_FILE_MACHINE_AMD64
|
||||
Characteristics: []
|
||||
sections:
|
||||
- Name: '.text$mn'
|
||||
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
|
||||
Alignment: 16
|
||||
SectionData: 4883EC28E8000000004883C428C3
|
||||
Relocations:
|
||||
- VirtualAddress: 5
|
||||
SymbolName: foo
|
||||
Type: IMAGE_REL_AMD64_REL32
|
||||
- Name: '.text$mn'
|
||||
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
|
||||
Alignment: 16
|
||||
SectionData: 4883EC28E8000000004883C428C3
|
||||
Relocations:
|
||||
- VirtualAddress: 5
|
||||
SymbolName: foo
|
||||
Type: IMAGE_REL_AMD64_REL32
|
||||
symbols:
|
||||
- Name: '.text$mn'
|
||||
Value: 0
|
||||
SectionNumber: 1
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||
StorageClass: IMAGE_SYM_CLASS_STATIC
|
||||
SectionDefinition:
|
||||
Length: 14
|
||||
NumberOfRelocations: 1
|
||||
NumberOfLinenumbers: 0
|
||||
CheckSum: 1682752513
|
||||
Number: 0
|
||||
Selection: IMAGE_COMDAT_SELECT_NODUPLICATES
|
||||
- Name: '.text$mn'
|
||||
Value: 0
|
||||
SectionNumber: 2
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||
StorageClass: IMAGE_SYM_CLASS_STATIC
|
||||
SectionDefinition:
|
||||
Length: 14
|
||||
NumberOfRelocations: 1
|
||||
NumberOfLinenumbers: 0
|
||||
CheckSum: 1682752513
|
||||
Number: 0
|
||||
Selection: IMAGE_COMDAT_SELECT_NODUPLICATES
|
||||
- Name: foo
|
||||
Value: 0
|
||||
SectionNumber: 1
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_FUNCTION
|
||||
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
|
||||
- Name: bar
|
||||
Value: 0
|
||||
SectionNumber: 2
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_FUNCTION
|
||||
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
|
||||
...
|
Loading…
Reference in New Issue