[PATCH] D141968: [NFC] Consolidate llvm::CodeGenOpt::Level handling

Sergei Barannikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 17 15:27:47 PST 2023


barannikov88 added inline comments.


================
Comment at: llvm/include/llvm/Support/CodeGen.h:57
+  /// Code generation optimization level.
+  enum Level : IDType {
+    None = 0,      ///< -O0
----------------
arsenm wrote:
> scott.linder wrote:
> > This is ABI breaking, so maybe we don't want/need to define the underlying type?
> This isn't in the C API, and this isn't for a release branch so I don't think it matters
Why did you need to restrict the underlying type?



================
Comment at: llvm/include/llvm/Support/CodeGen.h:72
+  /// Get the integer \c ID of \p Level.
+  inline int getID(CodeGenOpt::Level Level) {
+    return static_cast<IDType>(Level);
----------------
Should return `IDType`.


================
Comment at: llvm/tools/llvm-isel-fuzzer/llvm-isel-fuzzer.cpp:44
              cl::desc("Optimization level. [-O0, -O1, -O2, or -O3] "
-                      "(default = '-O2')"),
-             cl::Prefix, cl::init(' '));
+                      "(default = '-O0')"),
+             cl::Prefix, cl::init('2'));
----------------
This disagrees with cl::init('2')


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141968/new/

https://reviews.llvm.org/D141968



More information about the llvm-commits mailing list