summaryrefslogtreecommitdiff
path: root/test/CodeGen/ARM/2012-10-04-LDRB_POST_IMM-Crash.ll
diff options
context:
space:
mode:
authorStepan Dyatkovskiy <stpworld@narod.ru>2012-10-10 11:43:40 +0000
committerStepan Dyatkovskiy <stpworld@narod.ru>2012-10-10 11:43:40 +0000
commit2c2cb3c09f856975027becadb22dcca370683f30 (patch)
tree091ea6e8eaf47cc0fd5a2170ed1704e5839b6de7 /test/CodeGen/ARM/2012-10-04-LDRB_POST_IMM-Crash.ll
parent661afe75e81431a66de3ed8e22d5aa91443367b3 (diff)
downloadllvm-2c2cb3c09f856975027becadb22dcca370683f30.tar.gz
llvm-2c2cb3c09f856975027becadb22dcca370683f30.tar.bz2
llvm-2c2cb3c09f856975027becadb22dcca370683f30.tar.xz
Fix for LDRB instruction:
SDNode for LDRB_POST_IMM is invalid: number of registers added to SDNode fewer that described in .td. 7 ops is needed, but SDNode with only 6 is created. In more details: In ARMInstrInfo.td, in multiclass AI2_ldridx, in definition _POST_IMM, offset operand is defined as am2offset_imm. am2offset_imm is complex parameter type, and actually it consists from dummy register and imm itself. As I understood trick with dummy reg was made for AsmParser. In ARMISelLowering.cpp, this dummy register was not added to SDNode, and it cause crash in Peephole Optimizer pass. The problem fixed by setting up additional dummy reg when emitting LDRB_POST_IMM instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165617 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/ARM/2012-10-04-LDRB_POST_IMM-Crash.ll')
-rw-r--r--test/CodeGen/ARM/2012-10-04-LDRB_POST_IMM-Crash.ll23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/CodeGen/ARM/2012-10-04-LDRB_POST_IMM-Crash.ll b/test/CodeGen/ARM/2012-10-04-LDRB_POST_IMM-Crash.ll
new file mode 100644
index 0000000000..6eb8fcb2db
--- /dev/null
+++ b/test/CodeGen/ARM/2012-10-04-LDRB_POST_IMM-Crash.ll
@@ -0,0 +1,23 @@
+; RUN: llc < %s -mtriple=armv7-none-linux-gnueabi | FileCheck %s
+; Check that LDRB_POST_IMM instruction emitted properly.
+
+%my_struct_t = type { double, double, double }
+@main.val = private unnamed_addr constant %my_struct_t { double 1.0, double 2.0, double 3.0 }, align 8
+
+declare void @f(i32 %n1, %my_struct_t* byval %val);
+
+
+; CHECK: main:
+define i32 @main() nounwind {
+entry:
+ %val = alloca %my_struct_t, align 8
+ %0 = bitcast %my_struct_t* %val to i8*
+
+; CHECK: ldrb {{(r[0-9]+)}}, {{(\[r[0-9]+\])}}, #1
+ call void @llvm.memcpy.p0i8.p0i8.i32(i8* %0, i8* bitcast (%my_struct_t* @main.val to i8*), i32 24, i32 8, i1 false)
+
+ call void @f(i32 555, %my_struct_t* byval %val)
+ ret i32 0
+}
+
+declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind