This is an archive of the discontinued LLVM Phabricator instance.

[clang] NFC: Extend comdat validation in target multiversion function tests.
ClosedPublic

Authored by tahonermann on Apr 1 2022, 7:23 PM.

Details

Diff Detail

Event Timeline

tahonermann created this revision.Apr 1 2022, 7:23 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 1 2022, 7:23 PM
tahonermann added inline comments.Apr 2 2022, 9:44 AM
clang/test/CodeGen/attr-target-mv.c
95–111

The non-inline non-resolver cases here are surprising to me; they aren't COMDAT on Linux. Is this intentional?

369–380

These additions add validation that was previously missing.

tahonermann published this revision for review.Apr 2 2022, 2:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 2 2022, 2:11 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
erichkeane added inline comments.Apr 4 2022, 6:43 AM
clang/test/CodeGen/attr-target-mv.c
95–111

I don't think so, we perhaps messed that up.

erichkeane accepted this revision.Apr 4 2022, 1:03 PM

I'm ok with treating the COMDAT issue on non-resolvers as a separate patch.

This revision is now accepted and ready to land.Apr 4 2022, 1:03 PM
tahonermann closed this revision.Apr 5 2022, 3:53 PM

Closing per commit 3531a4fa3b7038d43ac20f56871da88aa25bf53d (I failed to add "Differential Revision" to the commit message).

tahonermann marked an inline comment as done.Apr 12 2022, 2:19 PM
tahonermann added inline comments.
clang/test/CodeGen/attr-target-mv.c
95–111

Actually, I misread the code previously. The non-resolver cases do correspond to inline function definitions, so it is on the Linux side that these are emitted as non-COMDAT symbols. Perhaps it has something to do with ELF vs COFF/PE; the linkage and preemption specifiers differ as well (linkonce vs linkonce_odr dso_local as shown below). At any rate, it isn't clear to me that there is anything that should be changed here.

Linux:

define linkonce void @foo_multi(i32 noundef %i, double noundef %d) #12 {
...
define linkonce void @foo_multi.avx_sse4.2(i32 noundef %i, double noundef %d) #13 {

Windows:

$foo_multi = comdat any
...
$foo_multi.avx_sse4.2 = comdat any
...
define linkonce_odr dso_local void @foo_multi(i32 noundef %i, double noundef %d) #12 comdat {
...
define linkonce_odr dso_local void @foo_multi.avx_sse4.2(i32 noundef %i, double noundef %d) #13 comdat {