Author: Phoebe Wang Date: 2021-12-23T12:44:33+08:00 New Revision: a954558e878ed9e97e99036229e99af8c6b6c881
URL: https://github.com/llvm/llvm-project/commit/a954558e878ed9e97e99036229e99af8c6b6c881 DIFF: https://github.com/llvm/llvm-project/commit/a954558e878ed9e97e99036229e99af8c6b6c881.diff LOG: Revert "[X86][MS-InlineAsm] Use exact conditions to recognize MS global variables" This reverts commit 682d01a1c1c52bd95d3d06267d6017395770256b. Revert for buildbot fails. Added: Modified: clang/test/CodeGen/ms-inline-asm-functions.c llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp llvm/lib/Target/X86/AsmParser/X86Operand.h Removed: ################################################################################ diff --git a/clang/test/CodeGen/ms-inline-asm-functions.c b/clang/test/CodeGen/ms-inline-asm-functions.c index 1a6ead9286dff..c958d88038716 100644 --- a/clang/test/CodeGen/ms-inline-asm-functions.c +++ b/clang/test/CodeGen/ms-inline-asm-functions.c @@ -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 } diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp index 2ba0b97229cc6..6bae55695f3d8 100644 --- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -1759,8 +1759,7 @@ 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, - FrontendSize)); + End, Size, Identifier, Decl)); return false; } // Otherwise, we set the base register to a non-zero value diff --git a/llvm/lib/Target/X86/AsmParser/X86Operand.h b/llvm/lib/Target/X86/AsmParser/X86Operand.h index 0116c081541b1..6d20c6af5fd2c 100644 --- a/llvm/lib/Target/X86/AsmParser/X86Operand.h +++ b/llvm/lib/Target/X86/AsmParser/X86Operand.h @@ -286,9 +286,10 @@ struct X86Operand final : public MCParsedAsmOperand { bool isOffsetOfLocal() const override { return isImm() && Imm.LocalRef; } bool isMemPlaceholder(const MCInstrDesc &Desc) const override { - // Only MS InlineAsm uses global variables with registers rather than - // rip/eip. - return !Mem.DefaultBaseReg && Mem.FrontendSize; + // 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; } bool needAddressOf() const override { return AddressOf; } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits