[llvm] [RISCV][llvm-exegesis] Disable pseudo instructions in allowAsBackToBack. (PR #122986)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 14 15:45:57 PST 2025


https://github.com/topperc created https://github.com/llvm/llvm-project/pull/122986

Prevents crashes trying to encode pseudo instuctions. Tested on HiFive Premier P550.

Fixes #122974

>From d08c584201d64c476fec48c09b6a1faaf1a30a82 Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Tue, 14 Jan 2025 15:40:37 -0800
Subject: [PATCH] [RISCV][llvm-exegesis] Disable pseudo instructions in
 allowAsBackToBack.

Prevents crashes trying to encode pseudo instuctions. Tested on
HiFive Premier P550.
---
 llvm/tools/llvm-exegesis/lib/RISCV/Target.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/llvm/tools/llvm-exegesis/lib/RISCV/Target.cpp b/llvm/tools/llvm-exegesis/lib/RISCV/Target.cpp
index 5636782bdf7f6f..911713d4e0aa59 100644
--- a/llvm/tools/llvm-exegesis/lib/RISCV/Target.cpp
+++ b/llvm/tools/llvm-exegesis/lib/RISCV/Target.cpp
@@ -124,6 +124,10 @@ class ExegesisRISCVTarget : public ExegesisTarget {
 
   ArrayRef<unsigned> getUnavailableRegisters() const override;
 
+  bool allowAsBackToBack(const Instruction &Instr) const override {
+    return !Instr.Description.isPseudo();
+  }
+
   Error randomizeTargetMCOperand(const Instruction &Instr, const Variable &Var,
                                  MCOperand &AssignedValue,
                                  const BitVector &ForbiddenRegs) const override;



More information about the llvm-commits mailing list