[PATCH] D98906: [X86] Improve lowering of the unrolled inline-asm probing

serge via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 22 06:17:36 PDT 2021


serge-sans-paille added a comment.

Thanks for proposing this optimization. There's a reason (which is debatable) why we explicitly `sub` before `mov`ing :

Consider the following:

  0000000000400400 <main>:
    400400:       c7 84 24 fc bf ff ff    movl   $0x1,-0x4004(%rsp)
    400407:       01 00 00 00 
    40040b:       c3                      retq

the mov accesses « unallocated » stack, which may be spotted as illegal by tools verifying memory accesses. When running valgrind on the above, I indeed get

  ==1335611== Invalid write of size 4
  ==1335611==    at 0x400400: main (in /tmp/a.out)
  ==1335611==  Address 0x1ffeffb534 is not stack'd, malloc'd or (recently) free'd


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98906/new/

https://reviews.llvm.org/D98906



More information about the llvm-commits mailing list