Skip to content

Commit 0ed0823

Browse files
tclin914dylanmckay
authored andcommitted
[AVR] Fix incorrect register state for LDRdPtr
Summary: LDRdPtr expanded from LDWRdPtr shouldn't define its second operand(SrcReg). The second operand is its source register. Add -verify-machineinstrs into command line of testcases can trigger this error. Reviewers: dylanmckay Reviewed By: dylanmckay Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D75437
1 parent 96075fc commit 0ed0823

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

llvm/lib/Target/AVR/AVRExpandPseudoInsts.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,8 +597,8 @@ bool AVRExpandPseudo::expand<AVR::LDWRdPtr>(Block &MBB, BlockIt MBBI) {
597597

598598
// Load low byte.
599599
auto MIBLO = buildMI(MBB, MBBI, OpLo)
600-
.addReg(CurDstLoReg, RegState::Define)
601-
.addReg(SrcReg, RegState::Define);
600+
.addReg(CurDstLoReg, RegState::Define)
601+
.addReg(SrcReg);
602602

603603
// Push low byte onto stack if necessary.
604604
if (TmpReg)

llvm/test/CodeGen/AVR/PR37143.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: llc -mattr=avr6,sram < %s -march=avr | FileCheck %s
1+
; RUN: llc -mattr=avr6,sram < %s -march=avr -verify-machineinstrs | FileCheck %s
22

33
; CHECK: ld {{r[0-9]+}}, [[PTR:[XYZ]]]
44
; CHECK: ldd {{r[0-9]+}}, [[PTR]]+1

llvm/test/CodeGen/AVR/brind.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: llc -mattr=sram,eijmpcall < %s -march=avr | FileCheck %s
1+
; RUN: llc -mattr=sram,eijmpcall < %s -march=avr -verify-machineinstrs | FileCheck %s
22

33
@brind.k = private unnamed_addr constant [2 x i8*] [i8* blockaddress(@brind, %return), i8* blockaddress(@brind, %b)], align 1
44

llvm/test/CodeGen/AVR/load.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: llc -mattr=avr6,sram < %s -march=avr | FileCheck %s
1+
; RUN: llc -mattr=avr6,sram < %s -march=avr -verify-machineinstrs | FileCheck %s
22

33
define i8 @load8(i8* %x) {
44
; CHECK-LABEL: load8:

llvm/test/CodeGen/AVR/pseudo/LDWRdPtr.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ body: |
1717
1818
; CHECK-LABEL: test_ldwrdptr
1919
20-
; CHECK: $r0, $r31r30 = LDRdPtr
20+
; CHECK: $r0 = LDRdPtr $r31r30
2121
; CHECK-NEXT: $r1 = LDDRdPtrQ $r31r30, 1
2222
2323
$r1r0 = LDWRdPtr $r31r30

0 commit comments

Comments
 (0)