[llvm] 2e83a0e - [asan] Fixed a runtime crash.
Kirill Stoimenov via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 26 13:31:09 PDT 2021
Author: Kirill Stoimenov
Date: 2021-08-26T20:30:25Z
New Revision: 2e83a0efb9065fdc526b92cfe0f89ca53ca547d7
URL: https://github.com/llvm/llvm-project/commit/2e83a0efb9065fdc526b92cfe0f89ca53ca547d7
DIFF: https://github.com/llvm/llvm-project/commit/2e83a0efb9065fdc526b92cfe0f89ca53ca547d7.diff
LOG: [asan] Fixed a runtime crash.
Looks like the NoRegister has some effect on the final code that is generated. My guess is that some optimization kicks in at the end?
When I use -S to dump the assembly I get the correct version with 'shrq $3, %r8':
movq %r9, %r8
shrq $3, %r8
movsbl 2147450880(%r8), %r8d
But, when I disassemble the final binary I get RAX in stead of R8:
mov %r9,%r8
shr $0x3,%rax
movsbl 0x7fff8000(%r8),%r8d
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D108745
Added:
Modified:
llvm/lib/Target/X86/X86MCInstLower.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86MCInstLower.cpp b/llvm/lib/Target/X86/X86MCInstLower.cpp
index c7740113f89e2..e827afef848bd 100644
--- a/llvm/lib/Target/X86/X86MCInstLower.cpp
+++ b/llvm/lib/Target/X86/X86MCInstLower.cpp
@@ -1370,12 +1370,12 @@ void X86AsmPrinter::emitAsanMemaccessPartial(Module &M, unsigned Reg,
STI);
OutStreamer->emitInstruction(MCInstBuilder(X86::SHR64ri)
.addReg(X86::R8)
- .addReg(X86::NoRegister)
+ .addReg(X86::R8)
.addImm(MappingScale),
STI);
if (OrShadowOffset) {
OutStreamer->emitInstruction(MCInstBuilder(X86::OR64ri32)
- .addReg(X86::NoRegister)
+ .addReg(X86::R8)
.addReg(X86::R8)
.addImm(ShadowBase),
STI);
More information about the llvm-commits
mailing list