From 0de206d8d6339283c80fd25c54b634f351bf0c8e Mon Sep 17 00:00:00 2001
From: Akira Hatanaka <ahatanaka@apple.com>
Date: Sat, 28 Mar 2015 20:44:05 +0000
Subject: [PATCH] [Objdump] Pass the correct subtarget to printInst.

This fixes a bug I introduced in r233411.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233484 91177308-0d34-0410-b5e6-96231b3b80d8
---
 .../AArch64/Inputs/print-mrs.obj.macho-aarch64    | Bin 0 -> 348 bytes
 .../llvm-objdump/AArch64/macho-print-mrs.test     |   3 +++
 tools/llvm-objdump/MachODump.cpp                  |   4 ++--
 3 files changed, 5 insertions(+), 2 deletions(-)
 create mode 100644 test/tools/llvm-objdump/AArch64/Inputs/print-mrs.obj.macho-aarch64
 create mode 100644 test/tools/llvm-objdump/AArch64/macho-print-mrs.test

diff --git a/test/tools/llvm-objdump/AArch64/Inputs/print-mrs.obj.macho-aarch64 b/test/tools/llvm-objdump/AArch64/Inputs/print-mrs.obj.macho-aarch64
new file mode 100644
index 0000000000000000000000000000000000000000..06cb13d07dafc5fa60ab0981ef0d3a22a371e835
GIT binary patch
literal 348
zcmX^A>+L@t1_nk3AOI1}Fopt%!N4F1#52Gw>;zCR7$|^EU|@jp*@2=U3>9XGk1t8B
zD1oR2k@4{%t`Q*!K8yv^4>FGlCJ3Tg7#fhdAUO#j)`6<?0n!3MJ~t2t05J%F?1o_!
uv%s=M5})j^GB7j*9bk^X2J#Od$UrCnG5L}B4Do6C`9=&mCAkF#ASD3PO%vDv

literal 0
HcmV?d00001

diff --git a/test/tools/llvm-objdump/AArch64/macho-print-mrs.test b/test/tools/llvm-objdump/AArch64/macho-print-mrs.test
new file mode 100644
index 00000000000..cc1d14faf8d
--- /dev/null
+++ b/test/tools/llvm-objdump/AArch64/macho-print-mrs.test
@@ -0,0 +1,3 @@
+RUN: llvm-objdump -d -m -no-show-raw-insn %p/Inputs/print-mrs.obj.macho-aarch64 | FileCheck %s
+
+CHECK: 0:  mrs x0, S3_7_C15_C2_0
diff --git a/tools/llvm-objdump/MachODump.cpp b/tools/llvm-objdump/MachODump.cpp
index 08573eeb0d2..43cf6671e61 100644
--- a/tools/llvm-objdump/MachODump.cpp
+++ b/tools/llvm-objdump/MachODump.cpp
@@ -3349,7 +3349,7 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF,
           if (isThumb)
             ThumbIP->printInst(&Inst, FormattedOS, AnnotationsStr, *ThumbSTI);
           else
-            IP->printInst(&Inst, FormattedOS, AnnotationsStr, *ThumbSTI);
+            IP->printInst(&Inst, FormattedOS, AnnotationsStr, *STI);
           emitComments(CommentStream, CommentsToEmit, FormattedOS, *AsmInfo);
 
           // Print debug info.
@@ -3408,7 +3408,7 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF,
             outs() << "\t";
             DumpBytes(ArrayRef<uint8_t>(Bytes.data() + Index, InstSize));
           }
-          IP->printInst(&Inst, outs(), "", *ThumbSTI);
+          IP->printInst(&Inst, outs(), "", *STI);
           outs() << "\n";
         } else {
           unsigned int Arch = MachOOF->getArch();
-- 
2.34.1