[llvm] [Draft] Use Module to get Triple in getDefaultSubtargetFeatures (PR #100833)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 26 16:34:00 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 4f5ad22b95ba2ee44f6207fc71b81860a48854ef 6052288616de4b46fc51ae6bc1adc793ffac3ab2 --extensions h,cpp -- llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h llvm/include/llvm/TargetParser/SubtargetFeature.h llvm/lib/LTO/LTOBackend.cpp llvm/lib/LTO/LTOCodeGenerator.cpp llvm/lib/LTO/LTOModule.cpp llvm/lib/LTO/ThinLTOCodeGenerator.cpp llvm/lib/TargetParser/SubtargetFeature.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
index 62b58de3dd..c9353f8ee2 100644
--- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
+++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
@@ -582,7 +582,8 @@ void ThinLTOCodeGenerator::crossReferenceSymbol(StringRef Name) {
 }
 
 // TargetMachine factory
-std::unique_ptr<TargetMachine> TargetMachineBuilder::create(const Module &M) const {
+std::unique_ptr<TargetMachine>
+TargetMachineBuilder::create(const Module &M) const {
   std::string ErrMsg;
   const Target *TheTarget =
       TargetRegistry::lookupTarget(TheTriple.str(), ErrMsg);
@@ -920,8 +921,8 @@ void ThinLTOCodeGenerator::optimize(Module &TheModule) {
   initTMBuilder(TMBuilder, Triple(TheModule.getTargetTriple()));
 
   // Optimize now
-  optimizeModule(TheModule, *TMBuilder.create(TheModule), OptLevel, Freestanding,
-                 DebugPassManager, nullptr);
+  optimizeModule(TheModule, *TMBuilder.create(TheModule), OptLevel,
+                 Freestanding, DebugPassManager, nullptr);
 }
 
 /// Write out the generated object file, either from CacheEntryPath or from
@@ -1189,11 +1190,10 @@ void ThinLTOCodeGenerator::run() {
         TargetMachine &TM = *TMBuilder.create(*TheModule);
         // Run the main process now, and generates a binary
         auto OutputBuffer = ProcessThinLTOModule(
-            *TheModule, *Index, ModuleMap, TM, ImportList,
-            ExportList, GUIDPreservedSymbols,
-            ModuleToDefinedGVSummaries[ModuleIdentifier], CacheOptions,
-            DisableCodeGen, SaveTempsDir, Freestanding, OptLevel, count,
-            DebugPassManager);
+            *TheModule, *Index, ModuleMap, TM, ImportList, ExportList,
+            GUIDPreservedSymbols, ModuleToDefinedGVSummaries[ModuleIdentifier],
+            CacheOptions, DisableCodeGen, SaveTempsDir, Freestanding, OptLevel,
+            count, DebugPassManager);
 
         // Commit to the cache (if enabled)
         CacheEntry.write(*OutputBuffer);

``````````

</details>


https://github.com/llvm/llvm-project/pull/100833


More information about the llvm-commits mailing list