[llvm] 9d2f064 - [llvm-exegesis] Ignore instructions using custom inserter
Qiu Chaofan via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 19 01:05:43 PST 2021
Author: Qiu Chaofan
Date: 2021-02-19T17:04:27+08:00
New Revision: 9d2f06445ffaceb501abd9477d3b5ce7231af49d
URL: https://github.com/llvm/llvm-project/commit/9d2f06445ffaceb501abd9477d3b5ce7231af49d
DIFF: https://github.com/llvm/llvm-project/commit/9d2f06445ffaceb501abd9477d3b5ce7231af49d.diff
LOG: [llvm-exegesis] Ignore instructions using custom inserter
Some instructions defined in table-gen files sets usesCustomInserter
bit, which means it has to be lowered by target code and isn't actually
valid instruction at MC level. So we should treat them like pseudo
instructions.
Reviewed By: gchatelet
Differential Revision: https://reviews.llvm.org/D94898
Added:
llvm/test/tools/llvm-exegesis/PowerPC/unsupported-opcode.s
Modified:
llvm/tools/llvm-exegesis/lib/SerialSnippetGenerator.cpp
llvm/tools/llvm-exegesis/llvm-exegesis.cpp
Removed:
################################################################################
diff --git a/llvm/test/tools/llvm-exegesis/PowerPC/unsupported-opcode.s b/llvm/test/tools/llvm-exegesis/PowerPC/unsupported-opcode.s
new file mode 100644
index 000000000000..67348ef01fee
--- /dev/null
+++ b/llvm/test/tools/llvm-exegesis/PowerPC/unsupported-opcode.s
@@ -0,0 +1,3 @@
+# RUN: llvm-exegesis -mode=latency -opcode-name=SELECT_I8 2>&1 | FileCheck %s
+
+CHECK: Unsupported opcode: isPseudo/usesCustomInserter
diff --git a/llvm/tools/llvm-exegesis/lib/SerialSnippetGenerator.cpp b/llvm/tools/llvm-exegesis/lib/SerialSnippetGenerator.cpp
index 504e7bdcc5cb..f5940bd4d8ad 100644
--- a/llvm/tools/llvm-exegesis/lib/SerialSnippetGenerator.cpp
+++ b/llvm/tools/llvm-exegesis/lib/SerialSnippetGenerator.cpp
@@ -51,7 +51,7 @@ computeAliasingInstructions(const LLVMState &State, const Instruction *Instr,
const Instruction &OtherInstr = State.getIC().getInstr(OtherOpcode);
const MCInstrDesc &OtherInstrDesc = OtherInstr.Description;
// Ignore instructions that we cannot run.
- if (OtherInstrDesc.isPseudo() ||
+ if (OtherInstrDesc.isPseudo() || OtherInstrDesc.usesCustomInsertionHook() ||
OtherInstrDesc.isBranch() || OtherInstrDesc.isIndirectBranch() ||
OtherInstrDesc.isCall() || OtherInstrDesc.isReturn()) {
continue;
diff --git a/llvm/tools/llvm-exegesis/llvm-exegesis.cpp b/llvm/tools/llvm-exegesis/llvm-exegesis.cpp
index 2d20d0ea278c..9cbcc1b0b6e2 100644
--- a/llvm/tools/llvm-exegesis/llvm-exegesis.cpp
+++ b/llvm/tools/llvm-exegesis/llvm-exegesis.cpp
@@ -251,8 +251,9 @@ generateSnippets(const LLVMState &State, unsigned Opcode,
const Instruction &Instr = State.getIC().getInstr(Opcode);
const MCInstrDesc &InstrDesc = Instr.Description;
// Ignore instructions that we cannot run.
- if (InstrDesc.isPseudo())
- return make_error<Failure>("Unsupported opcode: isPseudo");
+ if (InstrDesc.isPseudo() || InstrDesc.usesCustomInsertionHook())
+ return make_error<Failure>(
+ "Unsupported opcode: isPseudo/usesCustomInserter");
if (InstrDesc.isBranch() || InstrDesc.isIndirectBranch())
return make_error<Failure>("Unsupported opcode: isBranch/isIndirectBranch");
if (InstrDesc.isCall() || InstrDesc.isReturn())
More information about the llvm-commits
mailing list