[PATCH] D139816: [LTO] Don't generate invalid modules if "LTOPostLink" MD already exists

Pierre van Houtryve via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 30 06:55:05 PST 2023


Pierre-vh marked an inline comment as done.
Pierre-vh added inline comments.


================
Comment at: llvm/lib/LTO/LTOCodeGenerator.cpp:632
   // Write LTOPostLink flag for passes that require all the modules.
-  MergedModule->addModuleFlag(Module::Error, "LTOPostLink", 1);
+  MergedModule->setModuleFlag(Module::Error, "LTOPostLink", 1);
 
----------------
arsenm wrote:
> Do you really need a new method? Can you just use ModFlagBehavior::Override?
I tried using 'addModuleFlag` with override and got `module flag identifiers must be unique (or of 'require' type)`

Note that the new function is just for convenience. I could also just call `setModuleFlag` and create a ConstantInt/ConstantAsMetadata here but it'd be uglier


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139816



More information about the llvm-commits mailing list