Skip to content

Commit 1581183

Browse files
committed
Revert "[llvm-ml] Fix RIP-relative addressing for ptr operands (#107618)"
This reverts commit 7543d09. This change caused failed asserts when building the openmp assembly sources, reproducible with: $ llvm-ml -m64 -D_M_AMD64 -c -Fo out.obj openmp/runtime/src/z_Windows_NT-586_asm.asm llvm-ml: ../lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp:624: void {anonymous}::X86MCCodeEmitter::emitMemModRMByte(const llvm::MCInst&, unsigned int, unsigned int, uint64_t, {anonymous}::PrefixKind, uint64_t, llvm::SmallVectorImpl<char>&, llvm::SmallVectorImpl<llvm::MCFixup>&, const llvm::MCSubtargetInfo&, bool) const: Assertion `IndexReg.getReg() == 0 && !ForceSIB && "Invalid rip-relative address"' failed. The assert can also be triggered with one lone instruction: lea rdx, QWORD PTR [rax*8+16]
1 parent 1c334de commit 1581183

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2707,7 +2707,7 @@ bool X86AsmParser::parseIntelOperand(OperandVector &Operands, StringRef Name) {
27072707
bool MaybeDirectBranchDest = true;
27082708

27092709
if (Parser.isParsingMasm()) {
2710-
if (is64BitMode() && (PtrInOperand || SM.getElementSize() > 0)) {
2710+
if (is64BitMode() && SM.getElementSize() > 0) {
27112711
DefaultBaseReg = X86::RIP;
27122712
}
27132713
if (IsUnconditionalBranch) {

llvm/test/tools/llvm-ml/rip_relative_addressing.asm

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,4 @@ mov eax, [t8]
5353
; CHECK-LABEL: t8:
5454
; CHECK: mov eax, dword ptr [t8]
5555

56-
t9:
57-
mov eax, dword ptr [bar]
58-
; CHECK-LABEL: t9:
59-
; CHECK-32: mov eax, dword ptr [bar]
60-
; CHECK-64: mov eax, dword ptr [rip + bar]
61-
62-
END
56+
END

0 commit comments

Comments
 (0)