diff --git a/llvm/lib/CodeGen/CFIInstrInserter.cpp b/llvm/lib/CodeGen/CFIInstrInserter.cpp index 14098bc821617..1a0e222da98cd 100644 --- a/llvm/lib/CodeGen/CFIInstrInserter.cpp +++ b/llvm/lib/CodeGen/CFIInstrInserter.cpp @@ -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()); } diff --git a/llvm/test/CodeGen/RISCV/cfi-multiple-locations.mir b/llvm/test/CodeGen/RISCV/cfi-multiple-locations.mir index d2e5a8208cecf..55515aa364016 100644 --- a/llvm/test/CodeGen/RISCV/cfi-multiple-locations.mir +++ b/llvm/test/CodeGen/RISCV/cfi-multiple-locations.mir @@ -1,7 +1,8 @@ -# RUN: llc -x mir < %s -mtriple=riscv64 \ +# RUN: not --crash llc %s -mtriple=riscv64 \ # 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. diff --git a/llvm/test/CodeGen/X86/cfi-inserter-verify-inconsistent-loc.mir b/llvm/test/CodeGen/X86/cfi-inserter-verify-inconsistent-loc.mir index ef9fb22476a71..8211f8940d27a 100644 --- a/llvm/test/CodeGen/X86/cfi-inserter-verify-inconsistent-loc.mir +++ b/llvm/test/CodeGen/X86/cfi-inserter-verify-inconsistent-loc.mir @@ -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 @@ -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: