Skip to content

Commit 30d7001

Browse files
Revert "[llvm-exegesis] Add in snippet address annotation (llvm#74218)"
This reverts commit 3ab41f9. Unit tests break after recent changes. Will investigate/reland.
1 parent fa5486e commit 30d7001

File tree

8 files changed

+5
-76
lines changed

8 files changed

+5
-76
lines changed

llvm/test/tools/llvm-exegesis/X86/latency/memory-annotations-unsupported.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# RUN: not llvm-exegesis -mtriple=x86_64-unknown-unknown -snippets-file=%s -mode=latency 2>&1 | FileCheck %s
44

5-
# CHECK: llvm-exegesis error: Memory and snippet address annotations are only supported in subprocess execution mode
5+
# CHECK: llvm-exegesis error: Memory annotations are only supported in subprocess execution mode
66

77
# LLVM-EXEGESIS-MEM-DEF test1 4096 ff
88

llvm/test/tools/llvm-exegesis/X86/latency/snippet-address-annotations-unsupported.s

Lines changed: 0 additions & 9 deletions
This file was deleted.

llvm/test/tools/llvm-exegesis/X86/latency/subprocess-address-annotation.s

Lines changed: 0 additions & 26 deletions
This file was deleted.

llvm/tools/llvm-exegesis/lib/BenchmarkResult.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@ struct BenchmarkKey {
7070
// An opaque configuration, that can be used to separate several benchmarks of
7171
// the same instruction under different configurations.
7272
std::string Config;
73-
// The address that the snippet should be loaded in at if the execution mode
74-
// being used supports it.
75-
intptr_t SnippetAddress = 0;
7673
};
7774

7875
struct BenchmarkMeasure {

llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -416,17 +416,9 @@ class SubProcessFunctionExecutorImpl
416416
#endif // GLIBC_INITS_RSEQ
417417

418418
size_t FunctionDataCopySize = this->Function.FunctionBytes.size();
419-
void *MapAddress = NULL;
420-
int MapFlags = MAP_PRIVATE | MAP_ANONYMOUS;
421-
422-
if (Key.SnippetAddress != 0) {
423-
MapAddress = reinterpret_cast<void *>(Key.SnippetAddress);
424-
MapFlags |= MAP_FIXED_NOREPLACE;
425-
}
426-
427419
char *FunctionDataCopy =
428-
(char *)mmap(MapAddress, FunctionDataCopySize, PROT_READ | PROT_WRITE,
429-
MapFlags, 0, 0);
420+
(char *)mmap(NULL, FunctionDataCopySize, PROT_READ | PROT_WRITE,
421+
MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
430422
if ((intptr_t)FunctionDataCopy == -1)
431423
exit(ChildProcessExitCodeE::FunctionDataMappingFailed);
432424

llvm/tools/llvm-exegesis/lib/SnippetFile.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -131,19 +131,6 @@ class BenchmarkCodeStreamer : public MCStreamer, public AsmCommentConsumer {
131131
Result->Key.MemoryMappings.push_back(std::move(MemMap));
132132
return;
133133
}
134-
if (CommentText.consume_front("SNIPPET-ADDRESS")) {
135-
// LLVM-EXEGESIS-SNIPPET-ADDRESS <address>
136-
if (!to_integer<intptr_t>(CommentText.trim(), Result->Key.SnippetAddress,
137-
16)) {
138-
errs() << "invalid comment 'LLVM-EXEGESIS-SNIPPET-ADDRESS "
139-
<< CommentText
140-
<< "', expected <ADDRESS> to contain a valid integer in "
141-
"hexadecimal format";
142-
++InvalidComments;
143-
return;
144-
}
145-
return;
146-
}
147134
}
148135

149136
unsigned numInvalidComments() const { return InvalidComments; }

llvm/tools/llvm-exegesis/llvm-exegesis.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -533,10 +533,8 @@ void benchmarkMain() {
533533
for (const auto &Configuration : Configurations) {
534534
if (ExecutionMode != BenchmarkRunner::ExecutionModeE::SubProcess &&
535535
(Configuration.Key.MemoryMappings.size() != 0 ||
536-
Configuration.Key.MemoryValues.size() != 0 ||
537-
Configuration.Key.SnippetAddress != 0))
538-
ExitWithError("Memory and snippet address annotations are only "
539-
"supported in subprocess "
536+
Configuration.Key.MemoryValues.size() != 0))
537+
ExitWithError("Memory annotations are only supported in subprocess "
540538
"execution mode");
541539
}
542540
}

llvm/unittests/tools/llvm-exegesis/X86/SnippetFileTest.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -209,16 +209,6 @@ TEST_F(X86SnippetFileTest, MemoryMappingNoDefinition) {
209209
consumeError(std::move(Error));
210210
}
211211

212-
TEST_F(X86SnippetFileTest, SnippetAddress) {
213-
auto Snippets = TestCommon(R"(
214-
# LLVM-EXEGESIS-SNIPPET-ADDRESS 0x10000
215-
)");
216-
ASSERT_TRUE(static_cast<bool>(Snippets));
217-
EXPECT_THAT(*Snippets, SizeIs(1));
218-
const auto &Snippet = (*Snippets)[0];
219-
EXPECT_EQ(Snippet.Key.SnippetAddress, 0x10000);
220-
}
221-
222212
} // namespace
223213
} // namespace exegesis
224214
} // namespace llvm

0 commit comments

Comments
 (0)