diff --git a/llvm/lib/CodeGen/MIRPrinter.cpp b/llvm/lib/CodeGen/MIRPrinter.cpp index fa336c5edad9..6c3c63f919af 100644 --- a/llvm/lib/CodeGen/MIRPrinter.cpp +++ b/llvm/lib/CodeGen/MIRPrinter.cpp @@ -552,6 +552,10 @@ void MIPrinter::print(const MachineInstr &MI) { if (MI.getFlag(MachineInstr::FrameSetup)) OS << "frame-setup "; OS << TII->getName(MI.getOpcode()); + if (isPreISelGenericOpcode(MI.getOpcode())) { + assert(MI.getType() && "Generic instructions must have a type"); + OS << ' ' << *MI.getType(); + } if (I < E) OS << ' '; diff --git a/llvm/test/CodeGen/MIR/X86/generic-virtual-registers.mir b/llvm/test/CodeGen/MIR/X86/generic-virtual-registers.mir index 16f5488a6456..f3d2bc5a0247 100644 --- a/llvm/test/CodeGen/MIR/X86/generic-virtual-registers.mir +++ b/llvm/test/CodeGen/MIR/X86/generic-virtual-registers.mir @@ -13,6 +13,6 @@ registers: body: | bb.0.entry: liveins: %edi - ; CHECK: %0(32) = G_ADD %edi + ; CHECK: %0(32) = G_ADD i32 %edi %0(32) = G_ADD i32 %edi, %edi ...