[llvm] [BOLT][AArch64] Check Last Element Instead of Returning `nullptr` in `lookupStubFromGroup` (PR #114015)
Paschalis Mpeis via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 20 01:59:33 PST 2024
================
@@ -130,9 +130,9 @@ BinaryBasicBlock *LongJmpPass::lookupStubFromGroup(
const std::pair<uint64_t, BinaryBasicBlock *> &RHS) {
return LHS.first < RHS.first;
});
- if (Cand == Candidates.end())
- return nullptr;
- if (Cand != Candidates.begin()) {
+ if (Cand == Candidates.end()) {
+ Cand = std::prev(Cand);
----------------
paschalis-mpeis wrote:
Indeed, it would take some time to finish.
I quickly explored two directions, but it looks like they won't do it. They are briefly described below.
Not sure if Meta has any other suggestions? Or if we can relax the test requirement?
---
One idea was to generate a temp file with nops, and then include it in the test.
Using something like `yes 'nop' | head -n 33554432` is really fast but lit does not work well with it.
Another idea was to use a split function, with two hot blocks conditionally jumping with a shorter-range instruction (like `tbz`) to a cold block. Such shorter range would require way less repetitions, making the test fast.
However, I don't see this working, as I believe a [frontier](https://github.com/llvm/llvm-project/blob/c0919e3b48ef08dee5740f4a944eb79d95277808/bolt/lib/Passes/LongJmp.cpp#L608) address will always be picked, which will have a higher address than the requested `DotAddress`. Therefore, it won't trigger this case.
https://github.com/llvm/llvm-project/pull/114015
More information about the llvm-commits
mailing list