forked from OSchip/llvm-project
Reland "[X86][MS-InlineAsm] Use exact conditions to recognize MS global variables"
This reverts commit a954558e87
.
Thanks Yuanfang's help. I think I found the root cause of the buildbot
fail.
The failed test has both Memory and Immediate X86Operand. All data of
different operand kinds share the same memory space by a union
definition. So it has chance we get the wrong result if we don't check
the operand kind.
It's probably it happen to be the correct value in my local environment
so that I can't reproduce the fail.
Differential Revision: https://reviews.llvm.org/D116090
This commit is contained in:
parent
034e66e76c
commit
24c68ea1eb
|
@ -39,7 +39,7 @@ int bar() {
|
|||
int baz() {
|
||||
// CHECK-LABEL: _baz:
|
||||
__asm mov eax, k;
|
||||
// CHECK: movl k, %eax
|
||||
// CHECK: movl _k, %eax
|
||||
__asm mov eax, kptr;
|
||||
// CHECK: movl _kptr, %eax
|
||||
}
|
||||
|
|
|
@ -1759,7 +1759,8 @@ bool X86AsmParser::CreateMemForMSInlineAsm(
|
|||
// registers in a mmory expression, and though unaccessible via rip/eip.
|
||||
if (IsGlobalLV && (BaseReg || IndexReg)) {
|
||||
Operands.push_back(X86Operand::CreateMem(getPointerWidth(), Disp, Start,
|
||||
End, Size, Identifier, Decl));
|
||||
End, Size, Identifier, Decl,
|
||||
FrontendSize));
|
||||
return false;
|
||||
}
|
||||
// Otherwise, we set the base register to a non-zero value
|
||||
|
|
|
@ -286,10 +286,9 @@ struct X86Operand final : public MCParsedAsmOperand {
|
|||
bool isOffsetOfLocal() const override { return isImm() && Imm.LocalRef; }
|
||||
|
||||
bool isMemPlaceholder(const MCInstrDesc &Desc) const override {
|
||||
// Add more restrictions to avoid the use of global symbols. This helps
|
||||
// with reducing the code size.
|
||||
return !Desc.isRematerializable() && !Desc.isCall() && isMem() &&
|
||||
!Mem.BaseReg && !Mem.IndexReg;
|
||||
// Only MS InlineAsm uses global variables with registers rather than
|
||||
// rip/eip.
|
||||
return isMem() && !Mem.DefaultBaseReg && Mem.FrontendSize;
|
||||
}
|
||||
|
||||
bool needAddressOf() const override { return AddressOf; }
|
||||
|
|
Loading…
Reference in New Issue