[llvm] [BOLT] Move instrumentation option check (NFC) (PR #71581)
Vladislav Khmelevsky via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 7 12:06:55 PST 2023
https://github.com/yota9 updated https://github.com/llvm/llvm-project/pull/71581
>From 89e3eb9a00037091c540e3faf7af4bee099a57f8 Mon Sep 17 00:00:00 2001
From: Vladislav Khmelevsky <och95 at yandex.ru>
Date: Tue, 7 Nov 2023 23:49:17 +0400
Subject: [PATCH] [BOLT] Move instrumentation option check (NFC)
Move options check from emitBinary to more proper
adjustCommandLineOptions.
---
.../RuntimeLibs/InstrumentationRuntimeLibrary.cpp | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/bolt/lib/RuntimeLibs/InstrumentationRuntimeLibrary.cpp b/bolt/lib/RuntimeLibs/InstrumentationRuntimeLibrary.cpp
index cc36406543f3995..c6c284a3f784e7d 100644
--- a/bolt/lib/RuntimeLibs/InstrumentationRuntimeLibrary.cpp
+++ b/bolt/lib/RuntimeLibs/InstrumentationRuntimeLibrary.cpp
@@ -57,6 +57,14 @@ void InstrumentationRuntimeLibrary::adjustCommandLineOptions(
"the input binary\n";
exit(1);
}
+
+ if (BC.IsStaticExecutable && !opts::InstrumentationSleepTime) {
+ errs() << "BOLT-ERROR: instrumentation of static binary currently does not "
+ "support profile output on binary finalization, so it "
+ "requires -instrumentation-sleep-time=N (N>0) usage\n";
+ exit(1);
+ }
+
if (!BC.FiniFunctionAddress && !BC.IsStaticExecutable) {
errs() << "BOLT-ERROR: input binary lacks DT_FINI entry in the dynamic "
"section but instrumentation currently relies on patching "
@@ -89,13 +97,6 @@ void InstrumentationRuntimeLibrary::emitBinary(BinaryContext &BC,
"__BOLT", "__counters", MachO::S_REGULAR,
SectionKind::getData()));
- if (BC.IsStaticExecutable && !opts::InstrumentationSleepTime) {
- errs() << "BOLT-ERROR: instrumentation of static binary currently does not "
- "support profile output on binary finalization, so it "
- "requires -instrumentation-sleep-time=N (N>0) usage\n";
- exit(1);
- }
-
Section->setAlignment(llvm::Align(BC.RegularPageSize));
Streamer.switchSection(Section);
More information about the llvm-commits
mailing list