[PATCH] D97982: [MC] Introduce NeverAlign fragment type

Amir Ayupov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 4 23:48:19 PDT 2021


Amir added a comment.

@lebedev.ri:

> Where is this fragment going to be added? The alignment will differ per CPU.

Sorry, didn't understand this question then. Do you mean handling of X86 subtargets?

> But this problem exists regardless of BOLT, so shouldn't this also happen without BOLT?

Yes, the issue exists regardless of BOLT. Clang currently doesn't ensure the alignment restriction of macro-fusion. I'm proposing a mechanism in D101817 <https://reviews.llvm.org/D101817> to address that inside Streamer, similar to JCC erratum mitigation. The mechanism can potentially be enabled by the driver in -O3 mode. 
But this diff exposes the fragment type used by BOLT where we see entire basic block in advance and control the emitting, so don't have to incur overheads of automatic alignment insertion.

> I understand that, i just think generalizing a bit may result in a somewhat more generally useful solution.

What exactly do you think is worth generalizing? If you mean automatic macro-fusion alignment insertion, which would cover both MC clients (BOLT) and compiler, it's proposed in D101817 <https://reviews.llvm.org/D101817>. But unfortunately the overhead in BOLT use case is significantly higher than with NeverAlign fragment insertion.


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

https://reviews.llvm.org/D97982



More information about the llvm-commits mailing list