llvm.org GIT mirror llvm / 2c2cb3c
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 Stepan Dyatkovskiy 7 years ago
2 changed file(s) with 25 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
64176417 } else {
64186418 AddDefaultPred(BuildMI(*BB, MI, dl,
64196419 TII->get(ldrOpc),scratch)
6420 .addReg(srcOut, RegState::Define).addReg(srcIn).addImm(1));
6420 .addReg(srcOut, RegState::Define).addReg(srcIn)
6421 .addReg(0).addImm(1));
64216422
64226423 AddDefaultPred(BuildMI(*BB, MI, dl, TII->get(strOpc), destOut)
64236424 .addReg(scratch).addReg(destIn)
0 ; RUN: llc < %s -mtriple=armv7-none-linux-gnueabi | FileCheck %s
1 ; Check that LDRB_POST_IMM instruction emitted properly.
2
3 %my_struct_t = type { double, double, double }
4 @main.val = private unnamed_addr constant %my_struct_t { double 1.0, double 2.0, double 3.0 }, align 8
5
6 declare void @f(i32 %n1, %my_struct_t* byval %val);
7
8
9 ; CHECK: main:
10 define i32 @main() nounwind {
11 entry:
12 %val = alloca %my_struct_t, align 8
13 %0 = bitcast %my_struct_t* %val to i8*
14
15 ; CHECK: ldrb {{(r[0-9]+)}}, {{(\[r[0-9]+\])}}, #1
16 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %0, i8* bitcast (%my_struct_t* @main.val to i8*), i32 24, i32 8, i1 false)
17
18 call void @f(i32 555, %my_struct_t* byval %val)
19 ret i32 0
20 }
21
22 declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind