[llvm] Fix printing of 'pop' alias. (PR #67181)

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 22 12:11:39 PDT 2023


https://github.com/Rot127 created https://github.com/llvm/llvm-project/pull/67181

The condition to print the 'pop' alias could never be fulfilled, because the immediate was encoded for Address Modes 2.

>From a06704d132eaf3232aa5917291cdfa246ae1d08c Mon Sep 17 00:00:00 2001
From: Rot127 <unisono at quyllur.org>
Date: Fri, 22 Sep 2023 14:04:36 -0500
Subject: [PATCH] Fix printing of 'pop' alias.

The condition to print the 'pop' alias could never be fulfilled,
because the immediate was encoded for Address Modes 2.
---
 llvm/lib/Target/ARM/MCTargetDesc/ARMInstPrinter.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMInstPrinter.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMInstPrinter.cpp
index fbd067d79af0b3c..eb321d3ee7b13bf 100644
--- a/llvm/lib/Target/ARM/MCTargetDesc/ARMInstPrinter.cpp
+++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMInstPrinter.cpp
@@ -189,7 +189,7 @@ void ARMInstPrinter::printInst(const MCInst *MI, uint64_t Address,
 
   case ARM::LDR_POST_IMM:
     if (MI->getOperand(2).getReg() == ARM::SP &&
-        MI->getOperand(4).getImm() == 4) {
+        ARM_AM::getAM2Offset(MI->getOperand(4).getImm()) == 4) {
       O << '\t' << "pop";
       printPredicateOperand(MI, 5, STI, O);
       O << "\t{";



More information about the llvm-commits mailing list