[PATCH] D156767: [AArch64] [BranchRelaxation] Optimize for hot code size in AArch64 branch relaxation

Daniel Hoekwater via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 16 14:02:52 PDT 2023


dhoekwater added inline comments.


================
Comment at: llvm/test/CodeGen/AArch64/branch-relax-b.ll:134
 
+define void @relax_b_x16_taken() {
+; CHECK-LABEL:    relax_b_x16_taken:                      // @relax_b_x16_taken
----------------
mingmingl wrote:
> nit: add a brief comment about which case (in the breakdown list) is being tested for posterity.
> 
> If I read correctly, `bb.3` is the cold block (that would be split out by MFS), and the restore block `.LBB2_4` is the restore block and put at the end of the function. For my information, is `x16` spilled as the 4th or 6th case?
Added a comment explaining the case a bit further. In this test, machine function splitting isn't enabled at all, so the function is made up of entirely hot blocks. For this case, the only thing that matters is that we're branching _from_ the hot section, so we don't need to use function splitting in this test.


================
Comment at: llvm/test/CodeGen/AArch64/branch-relax-cross-section.mir:69-71
+    br label %cold
+  
+  cold:                                             ; preds = %entry
----------------
mingmingl wrote:
> for my information, how does branch-relaxation pass tell `cold:` is a cold block for test case `all_used_cold_to_hot`? It seems `entry` will branch to `cold` unconditionally but I may miss something.
This part of the test (the LLVM IR) is only present so llc is happy; the brunt of the test details are specified in the MIR sections below. For this specific test case, it is specified in

```
218    bb.2.iftrue (bbsections Cold):
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D156767



More information about the llvm-commits mailing list