efriedma-quic wrote:

> > I'm skeptical this actually makes sense in its current form. LLVM 
> > internally has a thing it calls a basic block, but what exactly counts is, 
> > to some extent, machine-specific, and can change from version to version.
> 
> I guess regardless of whether we call it BB alignment or label alignment, the 
> concept is already supported on the frontend side for loops. My idea was that 
> we could lift it to the function level, forcing all the function "labels" be 
> aligned on a certain boundary.

Aligning the targets of branches is a different thing from what you've 
implemented.  There are basic blocks which are not branch targets, and there 
are branch targets which are not at the beginning of a basic block.  (Branch 
targets that aren't at the beginning of a basic block are rare on most targets, 
but it doesn't seem like something we should completely ignore.)

"Loop alignment" is specifically a request to override the normal compiler 
heuristics for aligning the loop header i.e. the target of the loop backedges.  
This is best-effort; a "loop" in C code might not lower to something that 
actually has a header we can align.

"-malign-branch-boundary" specifically inserts padding so branch instructions 
don't cross a 32-byte boundary; it isn't trying to align anything.

https://github.com/llvm/llvm-project/pull/80765
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to