llvm-mc/X86: Encode constant MCValue's correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80485 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/X86/X86CodeEmitter.cpp b/lib/Target/X86/X86CodeEmitter.cpp
index d4d43af..0c472a7 100644
--- a/lib/Target/X86/X86CodeEmitter.cpp
+++ b/lib/Target/X86/X86CodeEmitter.cpp
@@ -971,6 +971,12 @@
if (!Op.isMCValue())
return false;
+ const MCValue &Val = Op.getMCValue();
+ if (Val.isAbsolute()) {
+ Instr->addOperand(MachineOperand::CreateImm(Val.getConstant()));
+ return true;
+ }
+
// FIXME: Relocation / fixup.
Instr->addOperand(MachineOperand::CreateImm(0));
return true;