Commit 4e3b0376 authored by Jim Lin's avatar Jim Lin
Browse files

[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
parent 57b8b2cc
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -598,7 +598,7 @@ 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(SrcReg);

  // Push low byte onto stack if necessary.
  if (TmpReg)
+1 −1
Original line number Diff line number Diff line
; 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
+1 −1
Original line number Diff line number Diff line
; 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

+1 −1
Original line number Diff line number Diff line
; 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:
+1 −1
Original line number Diff line number Diff line
@@ -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