[X86] Adjust nop emission by compiler to consider target decode limitations
authorPhilip Reames <listmail@philipreames.com>
Sat, 11 Jan 2020 16:41:35 +0000 (08:41 -0800)
committerPhilip Reames <listmail@philipreames.com>
Sat, 11 Jan 2020 16:45:17 +0000 (08:45 -0800)
commit1d641daf260308815d014d1bf1b424a1ed1e7277
tree7cd41d9cdd3f1aca5f49cfb7f124eeb7f7802e2f
parent563d3e344452c8923db09b043b8db471fc413b1e
[X86] Adjust nop emission by compiler to consider target decode limitations

The primary motivation of this change is to bring the code more closely in sync behavior wise with the assembler's version of nop emission.  I'd like to eventually factor them into one, but that's hard to do when one has features the other doesn't.

The longest encodeable nop on x86 is 15 bytes, but many processors - for instance all intel chips - can't decode the 15 byte form efficiently.  On those processors, it's better to use either a 10 byte or 11 byte sequence depending.
llvm/lib/Target/X86/X86MCInstLower.cpp
llvm/test/CodeGen/X86/align-branch-boundary-suppressions.ll
llvm/test/CodeGen/X86/stackmap-nops.ll
llvm/test/MC/X86/stackmap-nops.ll