Skip to content

Commit 6fe8cfa

Browse files
lenaryGeorgeARM
authored andcommitted
[RISCV] Fix Defs/Uses for SiFive CLIC Support (llvm#137724)
The expensive checks bots found issues with llvm#132481, due to not setting defs/uses correctly. In 31bd7a5 I added verify flags, so that the failure is reproduced without requiring expensive checks, and xfailed the test. This change: - Ensures that registers are correctly marked as defs/uses. - Removes the xfail. - Leaves the tests with `-verify-machineinstrs` which should have been present originally.
1 parent 92fe08f commit 6fe8cfa

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

llvm/lib/Target/RISCV/RISCVFrameLowering.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ static void emitSiFiveCLICPreemptibleSaves(MachineFunction &MF,
293293

294294
// Enable interrupts.
295295
BuildMI(MBB, MBBI, DL, TII->get(RISCV::CSRRSI))
296-
.addReg(RISCV::X0)
296+
.addReg(RISCV::X0, RegState::Define)
297297
.addImm(RISCVSysReg::mstatus)
298298
.addImm(8)
299299
.setMIFlag(MachineInstr::FrameSetup);
@@ -315,7 +315,7 @@ static void emitSiFiveCLICPreemptibleRestores(MachineFunction &MF,
315315

316316
// Disable interrupts.
317317
BuildMI(MBB, MBBI, DL, TII->get(RISCV::CSRRCI))
318-
.addReg(RISCV::X0)
318+
.addReg(RISCV::X0, RegState::Define)
319319
.addImm(RISCVSysReg::mstatus)
320320
.addImm(8)
321321
.setMIFlag(MachineInstr::FrameSetup);
@@ -324,12 +324,12 @@ static void emitSiFiveCLICPreemptibleRestores(MachineFunction &MF,
324324
// in the function, they have already been restored once, so now have the
325325
// value stored in `emitSiFiveCLICPreemptibleSaves`.
326326
BuildMI(MBB, MBBI, DL, TII->get(RISCV::CSRRW))
327-
.addReg(RISCV::X0)
327+
.addReg(RISCV::X0, RegState::Define)
328328
.addImm(RISCVSysReg::mepc)
329329
.addReg(RISCV::X9, RegState::Kill)
330330
.setMIFlag(MachineInstr::FrameSetup);
331331
BuildMI(MBB, MBBI, DL, TII->get(RISCV::CSRRW))
332-
.addReg(RISCV::X0)
332+
.addReg(RISCV::X0, RegState::Define)
333333
.addImm(RISCVSysReg::mcause)
334334
.addReg(RISCV::X8, RegState::Kill)
335335
.setMIFlag(MachineInstr::FrameSetup);

llvm/test/CodeGen/RISCV/sifive-interrupt-attr.ll

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
; RUN: llc -mtriple riscv64-unknown-elf -mattr=+experimental-xsfmclic -o - %s \
55
; RUN: -verify-machineinstrs | FileCheck %s --check-prefix=RV64
66

7-
;; These are failing to verify.
8-
; XFAIL: *
9-
107
; Test Handling of the SiFive-CLIC interrupt attributes.
118
;
129
; "stack-swap" means that sp should be swapped into `sf.mscratchcsw`

0 commit comments

Comments
 (0)