[llvm-branch-commits] Driver, CodeGen: Handle -falign-functions, -fno-align-functions and -falign-functions=1 correctly. (PR #149445)

2025-07-18 Thread Fangrui Song via llvm-branch-commits

MaskRay wrote:

Can use some description what is the correct behavior.

Perhaps 
https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-falign-functions

> If n is not specified or is zero, use a machine-dependent default.

https://github.com/llvm/llvm-project/pull/149445
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] Driver, CodeGen: Handle -falign-functions, -fno-align-functions and -falign-functions=1 correctly. (PR #149445)

2025-07-18 Thread Peter Collingbourne via llvm-branch-commits


@@ -5516,12 +5517,10 @@ void Clang::ConstructJob(Compilation &C, const 
JobAction &JA,
 
   CheckCodeGenerationOptions(D, Args);
 
-  unsigned FunctionAlignment = ParseFunctionAlignment(TC, Args);
-  assert(FunctionAlignment <= 31 && "function alignment will be truncated!");
-  if (FunctionAlignment) {
-CmdArgs.push_back("-function-alignment");
-CmdArgs.push_back(Args.MakeArgString(std::to_string(FunctionAlignment)));
-  }
+  llvm::MaybeAlign FunctionAlignment = ParseFunctionAlignment(TC, Args);
+  CmdArgs.push_back("-function-alignment");
+  CmdArgs.push_back(
+  Args.MakeArgString(std::to_string(llvm::encode(FunctionAlignment;

pcc wrote:

Done

https://github.com/llvm/llvm-project/pull/149445
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] Driver, CodeGen: Handle -falign-functions, -fno-align-functions and -falign-functions=1 correctly. (PR #149445)

2025-07-18 Thread Peter Collingbourne via llvm-branch-commits

https://github.com/pcc updated https://github.com/llvm/llvm-project/pull/149445


___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] Driver, CodeGen: Handle -falign-functions, -fno-align-functions and -falign-functions=1 correctly. (PR #149445)

2025-07-18 Thread Peter Collingbourne via llvm-branch-commits

https://github.com/pcc updated https://github.com/llvm/llvm-project/pull/149445


___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits