[clang] [lld] [llvm] [MachineOutliner][CGData] Append Content Hash To Outlined Function Name (PR #90400)

via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 28 09:07:25 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 b6824c9d459da059e247a60c1ebd1aeb580dacc2 6186c576e8ebfb80af7a58c6d8d24ca0f7277ade -- clang/test/Driver/codegen-data.c llvm/include/llvm/CodeGenData/CodeGenData.h llvm/include/llvm/CodeGenData/CodeGenData.inc llvm/include/llvm/CodeGenData/CodeGenDataReader.h llvm/include/llvm/CodeGenData/CodeGenDataWriter.h llvm/include/llvm/CodeGenData/OutlinedHashTree.h llvm/include/llvm/CodeGenData/OutlinedHashTreeRecord.h llvm/lib/CodeGenData/CodeGenData.cpp llvm/lib/CodeGenData/CodeGenDataReader.cpp llvm/lib/CodeGenData/CodeGenDataWriter.cpp llvm/lib/CodeGenData/OutlinedHashTree.cpp llvm/lib/CodeGenData/OutlinedHashTreeRecord.cpp llvm/tools/llvm-cgdata/llvm-cgdata.cpp llvm/unittests/CodeGenData/OutlinedHashTreeRecordTest.cpp llvm/unittests/CodeGenData/OutlinedHashTreeTest.cpp clang/lib/CodeGen/BackendUtil.cpp clang/lib/Driver/ToolChains/CommonArgs.cpp clang/lib/Driver/ToolChains/Darwin.cpp lld/MachO/Config.h lld/MachO/Driver.cpp lld/MachO/InputSection.h llvm/include/llvm/CodeGen/MachineOutliner.h llvm/include/llvm/CodeGen/TargetInstrInfo.h llvm/include/llvm/LTO/LTOBackend.h llvm/lib/CodeGen/MachineOutliner.cpp llvm/lib/CodeGen/MachineStableHash.cpp llvm/lib/LTO/LTO.cpp llvm/lib/LTO/LTOBackend.cpp llvm/lib/Target/AArch64/AArch64InstrInfo.cpp llvm/lib/Target/AArch64/AArch64InstrInfo.h
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/CodeGen/MachineOutliner.cpp b/llvm/lib/CodeGen/MachineOutliner.cpp
index 1da93c154d..5d8c54bf27 100644
--- a/llvm/lib/CodeGen/MachineOutliner.cpp
+++ b/llvm/lib/CodeGen/MachineOutliner.cpp
@@ -134,10 +134,12 @@ static cl::opt<bool>
                                     "the codegen data generation or use"),
                            cl::init(false));
 
-static cl::opt<bool>
-    AppendContentHashToOutlinedName("append-content-hash-outlined-name", cl::Hidden,
-cl::desc("This appends the content hash to the globally outlined function name. It's beneficial for enhancing the precision of the stable hash and for ordering the outlined functions."),
-                           cl::init(false));
+static cl::opt<bool> AppendContentHashToOutlinedName(
+    "append-content-hash-outlined-name", cl::Hidden,
+    cl::desc("This appends the content hash to the globally outlined function "
+             "name. It's beneficial for enhancing the precision of the stable "
+             "hash and for ordering the outlined functions."),
+    cl::init(false));
 
 namespace {
 
@@ -862,8 +864,10 @@ void MachineOutliner::computeAndPublishHashSequence(MachineFunction &MF,
 
   // Append a unique name based on the non-empty hash sequence.
   if (AppendContentHashToOutlinedName && !OutlinedHashSequence.empty()) {
-    auto CombinedHash = stable_hash_combine_range(OutlinedHashSequence.begin(), OutlinedHashSequence.end());
-    auto NewName = MF.getName().str() + ".content." + std::to_string(CombinedHash);
+    auto CombinedHash = stable_hash_combine_range(OutlinedHashSequence.begin(),
+                                                  OutlinedHashSequence.end());
+    auto NewName =
+        MF.getName().str() + ".content." + std::to_string(CombinedHash);
     MF.getFunction().setName(NewName);
   }
 

``````````

</details>


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


More information about the cfe-commits mailing list