[llvm] r345342 - Fix in MachineOperand::printIRValueReference().
Jonas Paulsson via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 25 16:39:07 PDT 2018
Author: jonpa
Date: Thu Oct 25 16:39:07 2018
New Revision: 345342
URL: http://llvm.org/viewvc/llvm-project?rev=345342&view=rev
Log:
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
Added:
llvm/trunk/test/CodeGen/SystemZ/isel-debug.ll
Modified:
llvm/trunk/lib/CodeGen/MachineOperand.cpp
Modified: llvm/trunk/lib/CodeGen/MachineOperand.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineOperand.cpp?rev=345342&r1=345341&r2=345342&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineOperand.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineOperand.cpp Thu Oct 25 16:39:07 2018
@@ -461,7 +461,8 @@ static void printIRValueReference(raw_os
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,
Added: llvm/trunk/test/CodeGen/SystemZ/isel-debug.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SystemZ/isel-debug.ll?rev=345342&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/SystemZ/isel-debug.ll (added)
+++ llvm/trunk/test/CodeGen/SystemZ/isel-debug.ll Thu Oct 25 16:39:07 2018
@@ -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
+}
More information about the llvm-commits
mailing list