[flang-commits] [clang] [flang] [llvm] [mlir] [polly] Revert "[IR] Use persistent metadata IDs for printing" (PR #220334)

via flang-commits flang-commits at lists.llvm.org
Tue Sep 1 11:52:55 PDT 2026


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 origin/main HEAD --extensions cpp,h -- clang/lib/CodeGen/BackendUtil.cpp clang/tools/cir-translate/cir-translate.cpp clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp clang/tools/clang-import-test/clang-import-test.cpp flang/include/flang/Optimizer/CodeGen/CodeGen.h flang/lib/Frontend/FrontendActions.cpp llvm/include/llvm/CodeGen/MachineModuleSlotTracker.h llvm/include/llvm/IR/IRPrintingPasses.h llvm/include/llvm/IR/Metadata.h llvm/include/llvm/IR/Module.h llvm/include/llvm/IR/ModuleSlotTracker.h llvm/include/llvm/IRPrinter/IRPrintingPasses.h llvm/lib/CodeGen/MIRParser/MIParser.cpp llvm/lib/CodeGen/MIRPrintingPass.cpp llvm/lib/CodeGen/MachineBasicBlock.cpp llvm/lib/CodeGen/MachineModuleSlotTracker.cpp llvm/lib/CodeGen/MachineOperand.cpp llvm/lib/IR/AsmWriter.cpp llvm/lib/IR/Core.cpp llvm/lib/IR/IRPrintingPasses.cpp llvm/lib/IR/LLVMContextImpl.cpp llvm/lib/IR/LLVMContextImpl.h llvm/lib/IR/Metadata.cpp llvm/lib/IR/MetadataImpl.h llvm/lib/IR/SSAContext.cpp llvm/lib/IRPrinter/IRPrintingPasses.cpp llvm/lib/Target/DirectX/DXILPrettyPrinter.cpp llvm/tools/llvm-dis/llvm-dis.cpp llvm/tools/llvm-extract/llvm-extract.cpp llvm/tools/llvm-link/llvm-link.cpp llvm/tools/llvm-reduce/ReducerWorkItem.cpp llvm/tools/llvm-split/llvm-split.cpp llvm/tools/llvm-stress/llvm-stress.cpp llvm/tools/opt/NewPMDriver.cpp llvm/tools/opt/optdriver.cpp llvm/tools/verify-uselistorder/verify-uselistorder.cpp llvm/unittests/AsmParser/AsmParserTest.cpp llvm/unittests/IR/AsmWriterTest.cpp llvm/unittests/IR/MetadataTest.cpp llvm/unittests/IR/ModuleTest.cpp llvm/unittests/MIR/MachineMetadata.cpp mlir/lib/Target/LLVMIR/ConvertToLLVMIR.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index 313d57bb0..f23a4b0bc 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -817,7 +817,7 @@ private:
   unsigned fNext = 0;
 
   /// mdnMap - Map for MDNodes.
-  DenseMap<const MDNode*, unsigned> mdnMap;
+  DenseMap<const MDNode *, unsigned> mdnMap;
   unsigned mdnNext = 0;
 
   /// asMap - The slot map for attribute sets.
@@ -5122,8 +5122,7 @@ void BasicBlock::print(raw_ostream &ROS, AssemblyAnnotationWriter *AAW,
                      bool IsForDebug) const {
   SlotTracker SlotTable(this->getParent());
   formatted_raw_ostream OS(ROS);
-  AssemblyWriter W(OS, SlotTable, this->getModule(), AAW,
-                   IsForDebug,
+  AssemblyWriter W(OS, SlotTable, this->getModule(), AAW, IsForDebug,
                    ShouldPreserveUseListOrder);
   W.printBasicBlock(this);
 }
diff --git a/llvm/unittests/MIR/MachineMetadata.cpp b/llvm/unittests/MIR/MachineMetadata.cpp
index f58a3cac1..242c14a36 100644
--- a/llvm/unittests/MIR/MachineMetadata.cpp
+++ b/llvm/unittests/MIR/MachineMetadata.cpp
@@ -405,12 +405,13 @@ body:             |
       [&](const Function &F) { return MMI.getMachineFunction(F); }, MF);
   // Print that MI with new machine metadata, which slot numbers should be
   // assigned.
-  EXPECT_EQ("%1:gr32 = MOV32rm %0, 1, $noreg, 0, $noreg :: (load (s32) from %ir.p, "
-            "!alias.scope !0, !noalias !3)",
-            print([&](raw_ostream &OS) {
-              MI.print(OS, MST, /*IsStandalone=*/false, /*SkipOpers=*/false,
-                       /*SkipDebugLoc=*/false, /*AddNewLine=*/false);
-            }));
+  EXPECT_EQ(
+      "%1:gr32 = MOV32rm %0, 1, $noreg, 0, $noreg :: (load (s32) from %ir.p, "
+      "!alias.scope !0, !noalias !3)",
+      print([&](raw_ostream &OS) {
+        MI.print(OS, MST, /*IsStandalone=*/false, /*SkipOpers=*/false,
+                 /*SkipDebugLoc=*/false, /*AddNewLine=*/false);
+      }));
 
   std::vector<const MDNode *> Generated{Domain, Scope0, Scope1, Set0, Set1};
   // Examine machine metadata collected. They should match ones

``````````

</details>


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


More information about the flang-commits mailing list