[PATCH] D141970: [Clang][LLD] Add --lto-CGO[0-3] option
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 30 15:33:58 PST 2023
MaskRay requested changes to this revision.
MaskRay added inline comments.
This revision now requires changes to proceed.
================
Comment at: lld/COFF/Driver.cpp:1774
error("/opt:lldlto: invalid optimization level: " + optLevel);
+ } else if (s.startswith("lldltocgo=")) {
+ StringRef optLevel = s.substr(10);
----------------
`s.consume_front(...)` then just use `s` below
================
Comment at: lld/COFF/LTO.cpp:93
+ ctx.config.ltocgo.value_or(args::getCGOptLevel(ctx.config.ltoo)));
+ assert(optLevelOrNone && "Invalid optimization level!");
+ c.CGOptLevel = *optLevelOrNone;
----------------
This introduces a crash in an assertion build if ltoo is larger than 3.
A proper error message like existing `invalid optimization level` should be used.
================
Comment at: lld/wasm/Driver.cpp:429
+ args::getInteger(args, OPT_lto_CGO, args::getCGOptLevel(config->ltoo)));
+ assert(optLevelOrNone && "Invalid optimization level!");
+ config->ltocgo = *optLevelOrNone;
----------------
This introduces a crash in an assertion build if ltoo is larger than 3.
A proper error message like existing `invalid optimization level` should be used.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D141970/new/
https://reviews.llvm.org/D141970
More information about the llvm-commits
mailing list