[llvm] r290537 - Test the different scenarios of GlobalDCE and comdats more
Rafael Avila de Espindola via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 5 09:49:15 PST 2017
Chandler Carruth via llvm-commits <llvm-commits at lists.llvm.org> writes:
> For example, it seemed like a bug that GlobalDCE didn't consider comdat
> participation of ifuncs. Specifically it seemed like an accident because
> testing didn't really cover that case. But in fact, ifuncs specifically
> cannot participate in a comdat despite having that API. The new test
> case covers this and explicitly documents that DCE gets to fire here
> even though there are comdats involved.
I think your first impression was correct and you found a bug.
Given just
$test5_c = comdat any
@test5_if = linkonce_odr ifunc void (), void ()* @test5_f
define linkonce_odr void @test5_f() comdat($test5_c) {
ret void
}
llc produces
.weak test5_if
.type test5_if, at function
.type test5_if, at gnu_indirect_function
test5_if = test5_f
which both gas and MC map to test5_f and test5_if having the same
section and that section being in a comdat:
COMDAT group section [ 3] `.group' [test5_c] contains 1 sections:
[Index] Name
[ 4] .text.test5_f
Symbol table '.symtab' contains 6 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000000 0 FILE LOCAL DEFAULT ABS test.ll
2: 0000000000000000 0 NOTYPE LOCAL DEFAULT 3 test5_c
3: 0000000000000000 0 SECTION LOCAL DEFAULT 4
4: 0000000000000000 1 FUNC WEAK DEFAULT 4 test5_f
5: 0000000000000000 1 IFUNC WEAK DEFAULT 4 test5_if
So if this comdat is not selected, the linker will treat test5_f and
test5_if as undefined.
Cheers,
Rafael
More information about the llvm-commits
mailing list