Need to EmitAttributes after get the correct feature bit.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
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.
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.
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.