[PATCH] D124347: [BOLT] RFC: Add golang support

Vladislav Khmelevsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 24 12:48:02 PDT 2022


yota9 added a comment.

@tschuett please checkout the answer above, I'm not sure if i will use llvm-objdump or will use other methods right now.



================
Comment at: bolt/lib/Passes/BinaryPasses.cpp:1235
+        (opts::ReorderFunctions == ReorderFunctions::RT_NONE &&
+         Function.hasProfile()))
       Function.setCodeSectionName(BC.getMainCodeSectionName());
----------------
The problem here that if we set hot section based on the hasProfile insetad of hasValidIndex we will break LongJmp (tentativeLayoutRelocMode checks index), so we need to remove hasProfile case at all here (I will remove it with the next reupload). AFAIR the problem here is that if the function has profile but don't have exec count (which is not set if the main entry point does not have profile information for some reason) we would and up with split function with invalid index both parts of which will be emitted one by one in cold section. So we need to fix either function reordering alg to set hot index if the function has a profile (not exec count)  or add check during profile read so that if the function hasPprofile() set exec count to be at least 1. Looking for your suggestions here too, probably I will separate this part from this commit to another one


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124347



More information about the llvm-commits mailing list