[llvm] [LoopUnroll] Remove redundant llvm.dbg instructions after blocks (PR #89069)

via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 17 06:15:16 PDT 2024


https://github.com/coderchenlin created https://github.com/llvm/llvm-project/pull/89069

merged.

>From fd402b773fb5b1df8cf338bf90354005eb2623be Mon Sep 17 00:00:00 2001
From: coderchenlin <chenlin048830 at gmail.com>
Date: Wed, 17 Apr 2024 21:01:52 +0800
Subject: [PATCH] [LoopUnroll] Remove redundant llvm.dbg instructions after
 blocks merged.

---
 llvm/lib/Transforms/Utils/BasicBlockUtils.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
index 5aa59acfa6df99..ca9d7649ea9826 100644
--- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
+++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
@@ -333,6 +333,9 @@ bool llvm::MergeBlockIntoPredecessor(BasicBlock *BB, DomTreeUpdater *DTU,
   // Finally, erase the old block and update dominator info.
   DeleteDeadBlock(BB, DTU);
 
+  // Remove redundant "llvm.dbg" instrunctions after blocks merged.
+  RemoveRedundantDbgInstrs(PredBB);
+
   return true;
 }
 



More information about the llvm-commits mailing list