When function has different attributes from module, emit the .option <attribute> before the function body. This allows non-integrated assemblers to properly assemble the functions (which may contain instructions dependent on the extra target features).
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/test/CodeGen/RISCV/riscv-func-attr-target.ll | ||
---|---|---|
2 ↗ | (On Diff #539904) | I think you want a test function that _doesn't_ have any additional target-features, and you can then verify that .option arch isn't blindly emitted for every function (rather than just those where it differs to the module). |
llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp | ||
---|---|---|
256 | Suggestion: if (STI->hasFeature(Feature.Value) == MCSTI.hasFeature(Feature.Value)) continue; auto Delta = STI->hasFeature(Feature.Value) ? RISCVOptionArchArgType::Plus : RISCVOptionArchArgType::Minus; NeedEmitStdOptionArgs.emplace_back(Delta, Feature.Key); | |
llvm/test/CodeGen/RISCV/riscv-func-attr-target.ll | ||
1 ↗ | (On Diff #539904) | Change the test name to riscv-func-target-feature.ll |
Comment Actions
- reorder hasFeature and isSupportedExtensionFeature
- Add disabling extension directive test and remove some testcase
Suggestion: