diff --git a/llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp b/llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp --- a/llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp +++ b/llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp @@ -46,13 +46,12 @@ namespace { class RISCVAsmPrinter : public AsmPrinter { - const MCSubtargetInfo *MCSTI; const RISCVSubtarget *STI; public: explicit RISCVAsmPrinter(TargetMachine &TM, std::unique_ptr Streamer) - : AsmPrinter(TM, std::move(Streamer)), MCSTI(TM.getMCSubtargetInfo()) {} + : AsmPrinter(TM, std::move(Streamer)) {} StringRef getPassName() const override { return "RISCV Assembly Printer"; } @@ -189,12 +188,6 @@ } bool RISCVAsmPrinter::runOnMachineFunction(MachineFunction &MF) { - // Set the current MCSubtargetInfo to a copy which has the correct - // feature bits for the current MachineFunction - MCSubtargetInfo &NewSTI = - OutStreamer->getContext().getSubtargetCopy(*TM.getMCSubtargetInfo()); - NewSTI.setFeatureBits(MF.getSubtarget().getFeatureBits()); - MCSTI = &NewSTI; STI = &MF.getSubtarget(); SetupMachineFunction(MF); @@ -224,7 +217,7 @@ void RISCVAsmPrinter::emitAttributes() { RISCVTargetStreamer &RTS = static_cast(*OutStreamer->getTargetStreamer()); - RTS.emitTargetAttributes(*MCSTI); + RTS.emitTargetAttributes(*TM.getMCSubtargetInfo()); } void RISCVAsmPrinter::emitFunctionEntryLabel() {