[PATCH] D92611: [LTO][Legacy] Decouple option parsing from LTOCodeGenerator

Steven Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 22 15:20:34 PDT 2021


steven_wu added a comment.

I still don't like this implementation, but fine if you have to do this.

But please rename the function, this is no longer a `lto_codegen` function. Just named it something like `lto_set_debug_options`, which is also cleaner.



================
Comment at: llvm/tools/lto/lto.cpp:426
+  if (optionParsingState != OptParsingState::Done) {
+    // Parse options if any were set by the lto_codegen_debug_options* function.
     unwrap(cg)->parseCodeGenDebugOptions();
----------------
Shouldn't this be:
```
if (optionParsingState ==  OptParsingState::NotParsed)
  unwrap(cg)->parseCodeGenDebugOptions();

if (optionParsingState !=  OptParsingState::Done)
    lto_add_attrs(cg);

optionParsingState = OptParsingState::Done;
```


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

https://reviews.llvm.org/D92611



More information about the llvm-commits mailing list