summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/AsmParser/X86Operand.h
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Target/X86/AsmParser/X86Operand.h')
-rw-r--r--llvm/lib/Target/X86/AsmParser/X86Operand.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Target/X86/AsmParser/X86Operand.h b/llvm/lib/Target/X86/AsmParser/X86Operand.h
index 591e6f4102f..37479954a70 100644
--- a/llvm/lib/Target/X86/AsmParser/X86Operand.h
+++ b/llvm/lib/Target/X86/AsmParser/X86Operand.h
@@ -262,10 +262,10 @@ struct X86Operand final : public MCParsedAsmOperand {
bool isImmUnsignedi4() const {
if (!isImm()) return false;
- // If this isn't a constant expr, just assume it fits and let relaxation
- // handle it.
+ // If this isn't a constant expr, reject it. The immediate byte is shared
+ // with a register encoding. We can't have it affected by a relocation.
const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(getImm());
- if (!CE) return true;
+ if (!CE) return false;
return isImmUnsignedi4Value(CE->getValue());
}
OpenPOWER on IntegriCloud