@@ -2120,29 +2120,33 @@ tools::ParsePICArgs(const ToolChain &ToolChain, const ArgList &Args) {
21202120// [0, 65536]. If the value is not a power-of-two, it will be rounded up to
21212121// the nearest power-of-two.
21222122//
2123- // If we return `0 `, the frontend will default to the backend's preferred
2124- // alignment.
2123+ // If we return `MaybeAlign() `, the frontend will default to the backend's
2124+ // preferred alignment.
21252125//
21262126// NOTE: icc only allows values between [0, 4096]. icc uses `-falign-functions`
21272127// to mean `-falign-functions=16`. GCC defaults to the backend's preferred
21282128// alignment. For unaligned functions, we default to the backend's preferred
21292129// alignment.
2130- unsigned tools::ParseFunctionAlignment (const ToolChain &TC,
2131- const ArgList &Args) {
2130+ llvm::MaybeAlign tools::ParseFunctionAlignment (const ToolChain &TC,
2131+ const ArgList &Args) {
21322132 const Arg *A = Args.getLastArg (options::OPT_falign_functions,
21332133 options::OPT_falign_functions_EQ,
21342134 options::OPT_fno_align_functions);
2135- if (!A || A->getOption ().matches (options::OPT_fno_align_functions))
2136- return 0 ;
2135+ if (!A)
2136+ return llvm::MaybeAlign ();
2137+
2138+ if (A->getOption ().matches (options::OPT_fno_align_functions))
2139+ return llvm::Align (1 );
21372140
21382141 if (A->getOption ().matches (options::OPT_falign_functions))
2139- return 0 ;
2142+ return llvm::MaybeAlign () ;
21402143
21412144 unsigned Value = 0 ;
21422145 if (StringRef (A->getValue ()).getAsInteger (10 , Value) || Value > 65536 )
21432146 TC.getDriver ().Diag (diag::err_drv_invalid_int_value)
21442147 << A->getAsString (Args) << A->getValue ();
2145- return Value ? llvm::Log2_32_Ceil (std::min (Value, 65536u )) : Value;
2148+ return Value ? llvm::Align (1 << llvm::Log2_32_Ceil (std::min (Value, 65536u )))
2149+ : llvm::MaybeAlign ();
21462150}
21472151
21482152void tools::addDebugInfoKind (
0 commit comments