OSDN Git Service

[ARM] Handle t2ADDri in ARMAsmPrinter::EmitUnwindingInstruction.
authorAkira Hatanaka <ahatanaka@apple.com>
Tue, 10 Nov 2015 00:10:41 +0000 (00:10 +0000)
committerAkira Hatanaka <ahatanaka@apple.com>
Tue, 10 Nov 2015 00:10:41 +0000 (00:10 +0000)
This fixes a bug in ARMAsmPrinter::EmitUnwindingInstruction where
llvm_unreachable was reached because t2ADDri wasn't handled.

Test case provided by Tim Northover.

rdar://problem/23270609

http://reviews.llvm.org/D14518

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252557 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMAsmPrinter.cpp
test/CodeGen/Thumb2/emit-unwinding.ll [new file with mode: 0644]

index ef56a01..67ebfa2 100644 (file)
@@ -1125,6 +1125,7 @@ void ARMAsmPrinter::EmitUnwindingInstruction(const MachineInstr *MI) {
         Offset = 0;
         break;
       case ARM::ADDri:
+      case ARM::t2ADDri:
         Offset = -MI->getOperand(2).getImm();
         break;
       case ARM::SUBri:
diff --git a/test/CodeGen/Thumb2/emit-unwinding.ll b/test/CodeGen/Thumb2/emit-unwinding.ll
new file mode 100644 (file)
index 0000000..1f1ea1b
--- /dev/null
@@ -0,0 +1,11 @@
+; RUN: llc -mtriple thumbv7em-apple-unknown-eabi-macho %s -o - -O0 | FileCheck %s
+
+; CHECK: add.w r11, sp, #{{[1-9]+}}
+
+define void @foo1() {
+  call void asm sideeffect "", "~{r4}"()
+  call void @foo2()
+  ret void
+}
+
+declare void @foo2()