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

via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 14 15:46:28 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-tools-llvm-exegesis

Author: Craig Topper (topperc)

<details>
<summary>Changes</summary>

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

Fixes #<!-- -->122974

---
Full diff: https://github.com/llvm/llvm-project/pull/122986.diff


1 Files Affected:

- (modified) llvm/tools/llvm-exegesis/lib/RISCV/Target.cpp (+4) 


``````````diff
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;

``````````

</details>


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


More information about the llvm-commits mailing list