[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
This commit is contained in:
Jim Lin 2020-03-03 16:52:20 +08:00
parent 57b8b2cc50
commit 4e3b037665
5 changed files with 6 additions and 6 deletions

View File

@ -597,8 +597,8 @@ bool AVRExpandPseudo::expand<AVR::LDWRdPtr>(Block &MBB, BlockIt MBBI) {
// Load low byte.
auto MIBLO = buildMI(MBB, MBBI, OpLo)
.addReg(CurDstLoReg, RegState::Define)
.addReg(SrcReg, RegState::Define);
.addReg(CurDstLoReg, RegState::Define)
.addReg(SrcReg);
// Push low byte onto stack if necessary.
if (TmpReg)

View File

@ -1,4 +1,4 @@
; RUN: llc -mattr=avr6,sram < %s -march=avr | FileCheck %s
; RUN: llc -mattr=avr6,sram < %s -march=avr -verify-machineinstrs | FileCheck %s
; CHECK: ld {{r[0-9]+}}, [[PTR:[XYZ]]]
; CHECK: ldd {{r[0-9]+}}, [[PTR]]+1

View File

@ -1,4 +1,4 @@
; RUN: llc -mattr=sram,eijmpcall < %s -march=avr | FileCheck %s
; RUN: llc -mattr=sram,eijmpcall < %s -march=avr -verify-machineinstrs | FileCheck %s
@brind.k = private unnamed_addr constant [2 x i8*] [i8* blockaddress(@brind, %return), i8* blockaddress(@brind, %b)], align 1

View File

@ -1,4 +1,4 @@
; RUN: llc -mattr=avr6,sram < %s -march=avr | FileCheck %s
; RUN: llc -mattr=avr6,sram < %s -march=avr -verify-machineinstrs | FileCheck %s
define i8 @load8(i8* %x) {
; CHECK-LABEL: load8:

View File

@ -17,7 +17,7 @@ body: |
; CHECK-LABEL: test_ldwrdptr
; CHECK: $r0, $r31r30 = LDRdPtr
; CHECK: $r0 = LDRdPtr $r31r30
; CHECK-NEXT: $r1 = LDDRdPtrQ $r31r30, 1
$r1r0 = LDWRdPtr $r31r30