[clang] [NFC][CodeGen] Change CodeGenOpt::Level/CodeGenFileType into enum classes (PR #66295)
@@ -661,27 +661,27 @@ static bool FixupInvocation(CompilerInvocation , static unsigned getOptimizationLevel(ArgList , InputKind IK, DiagnosticsEngine ) { - unsigned DefaultOpt = llvm::CodeGenOpt::None; + unsigned DefaultOpt = 0; if ((IK.getLanguage() == Language::OpenCL || IK.getLanguage() == Language::OpenCLCXX) && !Args.hasArg(OPT_cl_opt_disable)) -DefaultOpt = llvm::CodeGenOpt::Default; +DefaultOpt = 2; pogo59 wrote: Actually it looks to me like clang only cares about 0/not-0, and the specific non-zero number is irrelevant. So, internally clang codegen would be better off with a simple Optimize bool. (It looks like LangOpts does it this way already.) CodeGenOpts probably does need to track the actual user-specified level to pass down to LLVM, but it doesn't need it for its own purposes. https://github.com/llvm/llvm-project/pull/66295 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][CodeGen] Change CodeGenOpt::Level/CodeGenFileType into enum classes (PR #66295)
@@ -661,27 +661,27 @@ static bool FixupInvocation(CompilerInvocation , static unsigned getOptimizationLevel(ArgList , InputKind IK, DiagnosticsEngine ) { - unsigned DefaultOpt = llvm::CodeGenOpt::None; + unsigned DefaultOpt = 0; if ((IK.getLanguage() == Language::OpenCL || IK.getLanguage() == Language::OpenCLCXX) && !Args.hasArg(OPT_cl_opt_disable)) -DefaultOpt = llvm::CodeGenOpt::Default; +DefaultOpt = 2; aeubanks wrote: We do eventually map the opt level here to a `CodeGenOpt` via `CodeGenOpt::getLevel()`, but we also use the opt level here for a bunch of other things in the clang codegen process. So whatever the "default" llvm codegen pipeline opt level is shouldn't be tied to a clang frontend opt level default. Maybe I'm not understanding your comment. https://github.com/llvm/llvm-project/pull/66295 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][CodeGen] Change CodeGenOpt::Level/CodeGenFileType into enum classes (PR #66295)
@@ -661,27 +661,27 @@ static bool FixupInvocation(CompilerInvocation , static unsigned getOptimizationLevel(ArgList , InputKind IK, DiagnosticsEngine ) { - unsigned DefaultOpt = llvm::CodeGenOpt::None; + unsigned DefaultOpt = 0; if ((IK.getLanguage() == Language::OpenCL || IK.getLanguage() == Language::OpenCLCXX) && !Args.hasArg(OPT_cl_opt_disable)) -DefaultOpt = llvm::CodeGenOpt::Default; +DefaultOpt = 2; pogo59 wrote: Not that different; `CodeGenOpt::getLevel()` just uses a static_cast to implement the inverse mapping. This direction of the conversion should be consistent IMO. https://github.com/llvm/llvm-project/pull/66295 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][CodeGen] Change CodeGenOpt::Level/CodeGenFileType into enum classes (PR #66295)
https://github.com/aeubanks closed https://github.com/llvm/llvm-project/pull/66295 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][CodeGen] Change CodeGenOpt::Level/CodeGenFileType into enum classes (PR #66295)
https://github.com/rnk approved this pull request. https://github.com/llvm/llvm-project/pull/66295 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][CodeGen] Change CodeGenOpt::Level/CodeGenFileType into enum classes (PR #66295)
@@ -661,27 +661,27 @@ static bool FixupInvocation(CompilerInvocation , static unsigned getOptimizationLevel(ArgList , InputKind IK, DiagnosticsEngine ) { - unsigned DefaultOpt = llvm::CodeGenOpt::None; + unsigned DefaultOpt = 0; if ((IK.getLanguage() == Language::OpenCL || IK.getLanguage() == Language::OpenCLCXX) && !Args.hasArg(OPT_cl_opt_disable)) -DefaultOpt = llvm::CodeGenOpt::Default; +DefaultOpt = 2; aeubanks wrote: `llvm::CodeGenOpt` is for LLVM's codegen pipeline, but here it's getting overloaded to be used in clang's IR codegen. These are two different concepts where the defaults happen to have the same value. https://github.com/llvm/llvm-project/pull/66295 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][CodeGen] Change CodeGenOpt::Level/CodeGenFileType into enum classes (PR #66295)
https://github.com/banach-space approved this pull request. Flang driver changes LGTM, thanks! https://github.com/llvm/llvm-project/pull/66295 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][CodeGen] Change CodeGenOpt::Level/CodeGenFileType into enum classes (PR #66295)
@@ -661,27 +661,27 @@ static bool FixupInvocation(CompilerInvocation , static unsigned getOptimizationLevel(ArgList , InputKind IK, DiagnosticsEngine ) { - unsigned DefaultOpt = llvm::CodeGenOpt::None; + unsigned DefaultOpt = 0; if ((IK.getLanguage() == Language::OpenCL || IK.getLanguage() == Language::OpenCLCXX) && !Args.hasArg(OPT_cl_opt_disable)) -DefaultOpt = llvm::CodeGenOpt::Default; +DefaultOpt = 2; banach-space wrote: +1 Otherwise the the default is effectively defined twice in two different places. https://github.com/llvm/llvm-project/pull/66295 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][CodeGen] Change CodeGenOpt::Level/CodeGenFileType into enum classes (PR #66295)
@@ -661,27 +661,27 @@ static bool FixupInvocation(CompilerInvocation , static unsigned getOptimizationLevel(ArgList , InputKind IK, DiagnosticsEngine ) { - unsigned DefaultOpt = llvm::CodeGenOpt::None; + unsigned DefaultOpt = 0; if ((IK.getLanguage() == Language::OpenCL || IK.getLanguage() == Language::OpenCLCXX) && !Args.hasArg(OPT_cl_opt_disable)) -DefaultOpt = llvm::CodeGenOpt::Default; +DefaultOpt = 2; pogo59 wrote: I'm not keen on having these as magic numbers. Surely you can `static_cast(CodeGenOptLevel::Default)` or whatever. https://github.com/llvm/llvm-project/pull/66295 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][CodeGen] Change CodeGenOpt::Level/CodeGenFileType into enum classes (PR #66295)
ldionne wrote: There shouldn't be any changes under libcxxabi. Those changes are not necessary. https://github.com/llvm/llvm-project/pull/66295 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][CodeGen] Change CodeGenOpt::Level/CodeGenFileType into enum classes (PR #66295)
https://github.com/mshockwave approved this pull request. https://github.com/llvm/llvm-project/pull/66295 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits