[llvm] [BOLT] Add --pad-funcs-before=func:n (PR #117924)

Amir Ayupov via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 6 12:57:32 PST 2025


================
@@ -70,11 +74,12 @@ X86AlignBranchBoundaryHotOnly("x86-align-branch-boundary-hot-only",
   cl::init(true),
   cl::cat(BoltOptCategory));
 
-size_t padFunction(const BinaryFunction &Function) {
+size_t padFunction(const cl::list<std::string> &Spec,
+                   const BinaryFunction &Function) {
   static std::map<std::string, size_t> FunctionPadding;
----------------
aaupov wrote:

There's an issue here with the static map. 

If either `opts::FunctionPadSpec` or `opts::FunctionPadBeforeSpec` are set, the map is going to be populated with the respective spec in the first invocation of `BinaryEmitter::emitFunction`. The subsequent invocations will pick up the padding from the map irrespective of whether `opts::FunctionPadSpec` or `opts::FunctionPadBeforeSpec` is passed as a parameter.

This breaks one of our internal tests so I'm going to revert this patch.

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


More information about the llvm-commits mailing list