[PATCH] D152849: [BOLT][NFCI] Remove redundant instance of MCAsmBackend

Maksim Panchenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 13 13:14:28 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG1ebad216ef04: [BOLT][NFCI] Remove redundant instance of MCAsmBackend (authored by maksfb).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152849/new/

https://reviews.llvm.org/D152849

Files:
  bolt/lib/Rewrite/RewriteInstance.cpp


Index: bolt/lib/Rewrite/RewriteInstance.cpp
===================================================================
--- bolt/lib/Rewrite/RewriteInstance.cpp
+++ bolt/lib/Rewrite/RewriteInstance.cpp
@@ -5730,10 +5730,6 @@
   // Copy allocatable part of the input.
   OS << InputFile->getData().substr(0, FirstNonAllocatableOffset);
 
-  // We obtain an asm-specific writer so that we can emit nops in an
-  // architecture-specific way at the end of the function.
-  std::unique_ptr<MCAsmBackend> MAB(
-      BC->TheTarget->createMCAsmBackend(*BC->STI, *BC->MRI, MCTargetOptions()));
   auto Streamer = BC->createStreamer(OS);
   // Make sure output stream has enough reserved space, otherwise
   // pwrite() will fail.
@@ -5802,8 +5798,8 @@
     if (Function->getMaxSize() != std::numeric_limits<uint64_t>::max()) {
       uint64_t Pos = OS.tell();
       OS.seek(Function->getFileOffset() + Function->getImageSize());
-      MAB->writeNopData(OS, Function->getMaxSize() - Function->getImageSize(),
-                        &*BC->STI);
+      BC->MAB->writeNopData(
+          OS, Function->getMaxSize() - Function->getImageSize(), &*BC->STI);
 
       OS.seek(Pos);
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152849.531043.patch
Type: text/x-patch
Size: 1170 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230613/4f0165d5/attachment.bin>


More information about the llvm-commits mailing list