Skip to content

Commit c2e4816

Browse files
Mirko BrkusaninMirko Brkusanin
authored andcommitted
[Mips] Fix 374055
EXPENSIVE_CHECKS build was failing on new test. This is fixed by marking $ra register as undef. Test now has -verify-machineinstrs to check for operand flags. llvm-svn: 374320
1 parent b6f1d1f commit c2e4816

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

llvm/lib/Target/Mips/MipsSEISelDAGToDAG.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,17 +129,17 @@ void MipsSEDAGToDAGISel::emitMCountABI(MachineInstr &MI, MachineBasicBlock &MBB,
129129
MachineInstrBuilder MIB(MF, &MI);
130130
if (!Subtarget->isABI_O32()) { // N32, N64
131131
// Save current return address.
132-
BuildMI(MBB, &MI, MI.getDebugLoc(), TII->get(Mips::OR))
132+
BuildMI(MBB, &MI, MI.getDebugLoc(), TII->get(Mips::OR64))
133133
.addDef(Mips::AT_64)
134-
.addUse(Mips::RA_64)
134+
.addUse(Mips::RA_64, RegState::Undef)
135135
.addUse(Mips::ZERO_64);
136136
// Stops instruction above from being removed later on.
137137
MIB.addUse(Mips::AT_64, RegState::Implicit);
138138
} else { // O32
139139
// Save current return address.
140140
BuildMI(MBB, &MI, MI.getDebugLoc(), TII->get(Mips::OR))
141141
.addDef(Mips::AT)
142-
.addUse(Mips::RA)
142+
.addUse(Mips::RA, RegState::Undef)
143143
.addUse(Mips::ZERO);
144144
// _mcount pops 2 words from stack.
145145
BuildMI(MBB, &MI, MI.getDebugLoc(), TII->get(Mips::ADDiu))

llvm/test/CodeGen/Mips/mcount.ll

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
22

3-
; RUN: llc -march=mips < %s | FileCheck %s -check-prefix=MIPS32
4-
; RUN: llc -march=mips -relocation-model=pic < %s | FileCheck %s -check-prefix=MIPS32-PIC
5-
; RUN: llc -march=mips64 < %s | FileCheck %s -check-prefix=MIPS64
6-
; RUN: llc -march=mips64 -relocation-model=pic < %s | FileCheck %s -check-prefix=MIPS64-PIC
7-
; RUN: llc -march=mips -mattr=+micromips < %s | FileCheck %s -check-prefix=MIPS32-MM
8-
; RUN: llc -march=mips -relocation-model=pic -mattr=+micromips < %s | FileCheck %s -check-prefix=MIPS32-MM-PIC
3+
; RUN: llc -march=mips -verify-machineinstrs \
4+
; RUN: < %s | FileCheck %s -check-prefix=MIPS32
5+
; RUN: llc -march=mips -verify-machineinstrs -relocation-model=pic \
6+
; RUN: < %s | FileCheck %s -check-prefix=MIPS32-PIC
7+
; RUN: llc -march=mips64 -verify-machineinstrs \
8+
; RUN: < %s | FileCheck %s -check-prefix=MIPS64
9+
; RUN: llc -march=mips64 -verify-machineinstrs -relocation-model=pic \
10+
; RUN: < %s | FileCheck %s -check-prefix=MIPS64-PIC
11+
; RUN: llc -march=mips -verify-machineinstrs -mattr=+micromips \
12+
; RUN: < %s | FileCheck %s -check-prefix=MIPS32-MM
13+
; RUN: llc -march=mips -verify-machineinstrs -relocation-model=pic -mattr=+micromips \
14+
; RUN: < %s | FileCheck %s -check-prefix=MIPS32-MM-PIC
915

1016
; Test that checks ABI for _mcount calls.
1117

@@ -49,7 +55,7 @@ define void @foo() #0 {
4955
; MIPS64-NEXT: .cfi_def_cfa_offset 16
5056
; MIPS64-NEXT: sd $ra, 8($sp) # 8-byte Folded Spill
5157
; MIPS64-NEXT: .cfi_offset 31, -8
52-
; MIPS64-NEXT: or $1, $ra, $zero
58+
; MIPS64-NEXT: move $1, $ra
5359
; MIPS64-NEXT: jal _mcount
5460
; MIPS64-NEXT: nop
5561
; MIPS64-NEXT: ld $ra, 8($sp) # 8-byte Folded Reload
@@ -68,7 +74,7 @@ define void @foo() #0 {
6874
; MIPS64-PIC-NEXT: daddu $1, $1, $25
6975
; MIPS64-PIC-NEXT: daddiu $gp, $1, %lo(%neg(%gp_rel(foo)))
7076
; MIPS64-PIC-NEXT: ld $25, %call16(_mcount)($gp)
71-
; MIPS64-PIC-NEXT: or $1, $ra, $zero
77+
; MIPS64-PIC-NEXT: move $1, $ra
7278
; MIPS64-PIC-NEXT: .reloc .Ltmp0, R_MIPS_JALR, _mcount
7379
; MIPS64-PIC-NEXT: .Ltmp0:
7480
; MIPS64-PIC-NEXT: jalr $25

0 commit comments

Comments
 (0)