This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Fix wrong objfile attribute bug.
AbandonedPublic

Authored by khchen on May 21 2021, 9:00 AM.

Details

Summary

Need to EmitAttributes after get the correct feature bit.

Diff Detail

Event Timeline

khchen created this revision.May 21 2021, 9:00 AM
khchen requested review of this revision.May 21 2021, 9:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 21 2021, 9:00 AM
jrtc27 requested changes to this revision.EditedMay 21 2021, 9:10 AM

As commented in the depended-on revision:

No it shouldn't. This is precisely the kind of IR you get if you want to make an IFUNC specialised for IMAFDC.

This revision now requires changes to proceed.May 21 2021, 9:10 AM
MaskRay requested changes to this revision.EditedMay 23 2021, 7:12 PM

Aside: RTS.emitTargetAttributes(*STI); just uses the last FeatureBits set by setFeatureBits (in RISCVAsmPrinter::runOnMachineFunction). If you have two functions with target features, the last wins.
So in practice the string is likely inferred from whatever the last __attribute__((target(...))). Using the default for the rest functions seems to make more sense.

In the LTO case, I think encoding the feature bits as module flag metadata probably makes sense, but we may need a new merge behavior (see "Max" behavior from D33418 for an example). In the absence of a better behavior, picking the first is probably not-so-bad and will give something which is immediately usable.

This revision now requires changes to proceed.May 23 2021, 7:12 PM

I think this patch is similar to D73339 but it fixes obj file attribute, it is not going to fix different target feature in one complication unit problem.

khchen abandoned this revision.Jul 27 2021, 6:34 PM

D106347 will fix this issue.