[llvm] [BOLT][AArch64] Support cdsplit for AArch64 (PR #121475)

Paschalis Mpeis via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 23 01:15:26 PST 2025


================
@@ -672,11 +672,11 @@ class BinaryBasicBlock {
 
   bool isSplit() const { return Fragment != FragmentNum::main(); }
 
-  bool isCold() const {
-    assert(Fragment.get() < 2 &&
-           "Function is split into more than two (hot/cold)-fragments");
-    return isSplit();
-  }
+  bool isCold() const { return Fragment == FragmentNum::cold(); }
----------------
paschalis-mpeis wrote:

### Suggesting a conditional assertion:
Not sure if that is a good idea, but we could make `isCold` to know whether it has support for warm blocks, assume by default that it does, and conditionally assert. Something like:

```suggestion
  bool isCold(bool SupportsCdsplit = true) const {
  assert(SupportsCdsplit || Fragment.get() < 2 &&
           "Function is split into more than two (hot/cold)-fragments");
    return isSplit();
  }
```

---

Then, at each callsite we could explicitly pass false like below:
`isCold(/*SupportsCdsplit*/ false)`

Each area that adds supports in the future will revert to the default value (ie use `isCold()` again). When all cases are handled we can drop the parameter and the assertion.


https://github.com/llvm/llvm-project/pull/121475


More information about the llvm-commits mailing list