Treat MO_REG 0 location as undefined in DEBUG_VALUE,
per document.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94693 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp b/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
index b6a3581..9fb6ca4 100644
--- a/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
+++ b/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
@@ -428,10 +428,16 @@
O << V.getName();
O << " <- ";
if (NOps==3) {
- // Register or immediate value
+ // Register or immediate value. Register 0 means undef.
assert(MI->getOperand(0).getType()==MachineOperand::MO_Register ||
MI->getOperand(0).getType()==MachineOperand::MO_Immediate);
- printOperand(MI, 0);
+ if (MI->getOperand(0).getType()==MachineOperand::MO_Register &&
+ MI->getOperand(0).getReg()==0) {
+ // Suppress offset in this case, it is not meaningful.
+ O << "undef";
+ return;
+ } else
+ printOperand(MI, 0);
} else {
// Frame address. Currently handles register +- offset only.
assert(MI->getOperand(0).getType()==MachineOperand::MO_Register);