Skip to content

Commit 1ebad21

Browse files
committed
[BOLT][NFCI] Remove redundant instance of MCAsmBackend
Use instance of MCAsmBackend from BinaryContext instead of creating a new one. Reviewed By: Amir Differential Revision: https://reviews.llvm.org/D152849
1 parent 54711a6 commit 1ebad21

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

bolt/lib/Rewrite/RewriteInstance.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5730,10 +5730,6 @@ void RewriteInstance::rewriteFile() {
57305730
// Copy allocatable part of the input.
57315731
OS << InputFile->getData().substr(0, FirstNonAllocatableOffset);
57325732

5733-
// We obtain an asm-specific writer so that we can emit nops in an
5734-
// architecture-specific way at the end of the function.
5735-
std::unique_ptr<MCAsmBackend> MAB(
5736-
BC->TheTarget->createMCAsmBackend(*BC->STI, *BC->MRI, MCTargetOptions()));
57375733
auto Streamer = BC->createStreamer(OS);
57385734
// Make sure output stream has enough reserved space, otherwise
57395735
// pwrite() will fail.
@@ -5802,8 +5798,8 @@ void RewriteInstance::rewriteFile() {
58025798
if (Function->getMaxSize() != std::numeric_limits<uint64_t>::max()) {
58035799
uint64_t Pos = OS.tell();
58045800
OS.seek(Function->getFileOffset() + Function->getImageSize());
5805-
MAB->writeNopData(OS, Function->getMaxSize() - Function->getImageSize(),
5806-
&*BC->STI);
5801+
BC->MAB->writeNopData(
5802+
OS, Function->getMaxSize() - Function->getImageSize(), &*BC->STI);
58075803

58085804
OS.seek(Pos);
58095805
}

0 commit comments

Comments
 (0)