diff options
author | CL <48561979+coderchenlin@users.noreply.github.com> | 2024-04-26 17:57:37 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-26 10:57:37 +0100 |
commit | 2e3e0868748635b779ba89a772eae3664bd822e4 (patch) | |
tree | 199d0516279c0b4927d944575fad020e7c5fb306 /llvm/lib/Transforms/Utils/BasicBlockUtils.cpp | |
parent | 213ab9610ced9152f70f5b9777347c28e777a0ff (diff) | |
download | llvm-2e3e0868748635b779ba89a772eae3664bd822e4.zip llvm-2e3e0868748635b779ba89a772eae3664bd822e4.tar.gz llvm-2e3e0868748635b779ba89a772eae3664bd822e4.tar.bz2 |
[BasicBlockUtils] Remove redundant llvm.dbg instructions after blocks to reduce compile time (#89069)
this patch is to fix the compile time for some cases, before this
change, some targets (riscv-64, ve) will spend much more compile time on
this case (https://godbolt.org/z/rrov17cTo). With this change, the
compile time was reduced a lot.
Fixes https://github.com/llvm/llvm-project/issues/89073
PR: https://github.com/llvm/llvm-project/pull/89069
Diffstat (limited to 'llvm/lib/Transforms/Utils/BasicBlockUtils.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/BasicBlockUtils.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp index 5396038..4941f92 100644 --- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp +++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp @@ -333,6 +333,10 @@ 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 have been merged. + if (PredBB->getParent()->getSubprogram()) + RemoveRedundantDbgInstrs(PredBB); + return true; } |