[PATCH] D123679: [RISCV] Don't getDebugLoc for the end node of MBB iterator
luxufan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 22 02:05:33 PDT 2022
StephenFan updated this revision to Diff 424407.
StephenFan added a comment.
ChangeLog:
1. rename test file to pr53662.mir
2. reduce pr53662.mir test file
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D123679/new/
https://reviews.llvm.org/D123679
Files:
llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
llvm/test/CodeGen/RISCV/pr53662.mir
Index: llvm/test/CodeGen/RISCV/pr53662.mir
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/RISCV/pr53662.mir
@@ -0,0 +1,18 @@
+# RUN: llc -mtriple=riscv64 -run-pass=prologepilog -o - %s | FileCheck %s
+...
+name: b
+frameInfo:
+ savePoint: '%bb.0'
+ restorePoint: '%bb.1'
+body: |
+ bb.0 :
+ PseudoBR %bb.1
+
+ bb.1:
+ ; CHECK: DBG_VALUE $noreg
+ DBG_VALUE $noreg
+
+ bb.2:
+ PseudoRET implicit killed $x10
+
+...
Index: llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
+++ llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
@@ -561,15 +561,11 @@
MachineBasicBlock::iterator MBBI = MBB.end();
DebugLoc DL;
if (!MBB.empty()) {
+ MBBI = MBB.getLastNonDebugInstr();
+ if (MBBI != MBB.end())
+ DL = MBBI->getDebugLoc();
+
MBBI = MBB.getFirstTerminator();
- if (MBBI == MBB.end())
- MBBI = MBB.getLastNonDebugInstr();
- DL = MBBI->getDebugLoc();
-
- // If this is not a terminator, the actual insert location should be after the
- // last instruction.
- if (!MBBI->isTerminator())
- MBBI = std::next(MBBI);
// If callee-saved registers are saved via libcall, place stack adjustment
// before this call.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123679.424407.patch
Type: text/x-patch
Size: 1372 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220422/d0e78c3c/attachment.bin>
More information about the llvm-commits
mailing list