1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

Fix in MachineOperand::printIRValueReference().

Handle the case where getCurrentFunction() returns nullptr by passing -1 to
printIRSlotNumber(). This will result in <badref> being printed instead of an
assertion failure.

Review: Francis Visoiu Mistrih
https://reviews.llvm.org/D53333

llvm-svn: 345342
This commit is contained in:
Jonas Paulsson 2018-10-25 23:39:07 +00:00
parent 7c08c135e3
commit da5fb3c4a3
2 changed files with 21 additions and 1 deletions

View File

@ -461,7 +461,8 @@ static void printIRValueReference(raw_ostream &OS, const Value &V,
printLLVMNameWithoutPrefix(OS, V.getName());
return;
}
MachineOperand::printIRSlotNumber(OS, MST.getLocalSlot(&V));
int Slot = MST.getCurrentFunction() ? MST.getLocalSlot(&V) : -1;
MachineOperand::printIRSlotNumber(OS, Slot);
}
static void printSyncScope(raw_ostream &OS, const LLVMContext &Context,

View File

@ -0,0 +1,19 @@
; RUN: llc < %s -mtriple=s390x-linux-gnu -debug-only=systemz-isel -o - 2>&1 | \
; RUN: FileCheck %s
; REQUIRES: asserts
;
; Check that some debug output is printed without problems.
; CHECK: SystemZAddressingMode
; CHECK: Base
; CHECK: Index
; CHECK: Disp
define void @fun(i64* %ptr) {
entry:
%0 = bitcast i64* %ptr to i32**
%1 = load i32*, i32** %0, align 8
%xpv_pv = getelementptr inbounds i32, i32* %1
store i32 0, i32* %xpv_pv
ret void
}