[llvm] [DebugInfo][RemoveDIs] Instrument loop-rotate for DPValues (PR #72997)

via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 21 06:42:40 PST 2023


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 6088e9cdba902f78d88bbd3e7ff21c6ddb8fcf98 5469ba403086abecc70d5c7c4976021b45351cdf -- llvm/include/llvm/IR/DebugInfoMetadata.h llvm/lib/IR/DebugInfoMetadata.cpp llvm/lib/Transforms/Utils/Local.cpp llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index 0d599be49e..7156388c4f 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -1974,14 +1974,15 @@ bool llvm::LowerDbgDeclare(Function &F) {
 
 // RemoveDIs: re-implementation of insertDebugValuesForPHIs, but which pulls the
 // debug-info out of the blocks DPValues rather than dbg.value intrinsics.
-static void insertDebugValuesForPHIsDDD(BasicBlock *BB,
-                                    SmallVectorImpl<PHINode *> &InsertedPHIs) {
+static void
+insertDebugValuesForPHIsDDD(BasicBlock *BB,
+                            SmallVectorImpl<PHINode *> &InsertedPHIs) {
   assert(BB && "No BasicBlock to clone DPValue(s) from.");
   if (InsertedPHIs.size() == 0)
     return;
 
   // Map existing PHI nodes to their DPValues.
-  DenseMap<Value*, DPValue *> DbgValueMap;
+  DenseMap<Value *, DPValue *> DbgValueMap;
   for (auto &I : *BB) {
     for (auto &DPV : I.getDbgValueRange()) {
       for (Value *V : DPV.location_ops())
@@ -1996,9 +1997,7 @@ static void insertDebugValuesForPHIsDDD(BasicBlock *BB,
   // so that if a DPValue is being rewritten to use more than one of the
   // inserted PHIs in the same destination BB, we can update the same DPValue
   // with all the new PHIs instead of creating one copy for each.
-  MapVector<std::pair<BasicBlock *, DPValue *>,
-            DPValue *>
-      NewDbgValueMap;
+  MapVector<std::pair<BasicBlock *, DPValue *>, DPValue *> NewDbgValueMap;
   // Then iterate through the new PHIs and look to see if they use one of the
   // previously mapped PHIs. If so, create a new DPValue that will propagate
   // the info through the new PHI. If we use more than one new PHI in a single
diff --git a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
index 402816b11c..8177cd5d59 100644
--- a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
+++ b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
@@ -602,10 +602,12 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
           !Inst->mayWriteToMemory() && !Inst->isTerminator() &&
           !isa<DbgInfoIntrinsic>(Inst) && !isa<AllocaInst>(Inst)) {
 
-        auto DbgValueRange = LoopEntryBranch->cloneDebugInfoFrom(Inst, NextDbgInst);
+        auto DbgValueRange =
+            LoopEntryBranch->cloneDebugInfoFrom(Inst, NextDbgInst);
         // Remap any new instructions,
         if (LoopEntryBranch->getParent()->IsNewDbgInfoFormat)
-          RemapDPValueRange(M, DbgValueRange, ValueMap, RF_NoModuleLevelChanges | RF_IgnoreMissingLocals);
+          RemapDPValueRange(M, DbgValueRange, ValueMap,
+                            RF_NoModuleLevelChanges | RF_IgnoreMissingLocals);
 
         NextDbgInst = I->getDbgValueRange().begin();
         Inst->moveBefore(LoopEntryBranch);
@@ -626,7 +628,8 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
         for (DPValue &DPV : make_early_inc_range(Range))
           if (DbgIntrinsics.count(makeHashDPV(DPV)))
             DPV.eraseFromParent();
-        RemapDPValueRange(M, Range, ValueMap, RF_NoModuleLevelChanges | RF_IgnoreMissingLocals);
+        RemapDPValueRange(M, Range, ValueMap,
+                          RF_NoModuleLevelChanges | RF_IgnoreMissingLocals);
         NextDbgInst = std::nullopt;
       }
 

``````````

</details>


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


More information about the llvm-commits mailing list