Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion llvm/lib/CodeGen/CFIInstrInserter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ void CFIInstrInserter::calculateOutgoingCFAInfo(MBBCFAInfo &MBBInfo) {
CSRLocMap.insert(
{CFI.getRegister(), CSRSavedLocation(CSRReg, CSROffset)});
} else if (It->second.Reg != CSRReg || It->second.Offset != CSROffset) {
llvm_unreachable("Different saved locations for the same CSR");
reportFatalInternalError(
"Different saved locations for the same CSR");
}
CSRSaved.set(CFI.getRegister());
}
Expand Down
7 changes: 4 additions & 3 deletions llvm/test/CodeGen/RISCV/cfi-multiple-locations.mir
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# RUN: llc -x mir < %s -mtriple=riscv64 \
# RUN: not --crash llc %s -mtriple=riscv64 \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this change llc will now open cfi-multiple-locations.s for writing in the local directory (which may be write protected). Can we add back the "-x mir < " or add "-o -" or something to avoid this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# RUN: -run-pass=cfi-instr-inserter \
# RUN: -riscv-enable-cfi-instr-inserter=true
# UNSUPPORTED: target={{.*}}
# RUN: -riscv-enable-cfi-instr-inserter=true 2>&1 | FileCheck %s

# CHECK: LLVM ERROR: Different saved locations for the same CSR

# Technically, it is possible that a callee-saved register is saved in multiple different locations.
# CFIInstrInserter should handle this, but currently it does not.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# REQUIRES: asserts
# RUN: not --crash llc -o - %s -mtriple=x86_64-- \
# RUN: -run-pass=cfi-instr-inserter 2>&1 | FileCheck %s
# Test that CSR being saved in multiple locations can be caught by
Expand All @@ -10,8 +9,7 @@
}
...
---
# CHECK: Different saved locations for the same CSR
# CHECK-NEXT: UNREACHABLE executed
# CHECK: LLVM ERROR: Different saved locations for the same CSR
name: inconsistentlocs
body: |
bb.0:
Expand Down