diff options
author | chenlin <chenlin138@huawei.com> | 2024-05-14 00:42:04 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-13 09:42:04 -0700 |
commit | 79643565a890d29560782fea23877ae61ea5b987 (patch) | |
tree | 2499f6d48e2bd401713e4fe67ff892f2f7b39552 /llvm/lib/Transforms/Utils/LoopUnroll.cpp | |
parent | 1066eb55477044a3a92f3a40471375194dfcdbc8 (diff) | |
download | llvm-79643565a890d29560782fea23877ae61ea5b987.zip llvm-79643565a890d29560782fea23877ae61ea5b987.tar.gz llvm-79643565a890d29560782fea23877ae61ea5b987.tar.bz2 |
[LoopUnroll] Remove redundant debug instructions after blocks have been merged (#91246)
Remove redundant debug instructions after blocks have been merged into
the predecessor, It can reduce some compile time in some cases.
This change only fixes the situation of loop unrolling, and other
situations are not considered. "RemoveRedundantDbgInstrs" seems to be
very time-consuming. Thus, we just add here after the "Dest" has been
merged into the "Fold", this may be a more targeted solution!!!
fixes: https://github.com/llvm/llvm-project/issues/89073
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUnroll.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopUnroll.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUnroll.cpp b/llvm/lib/Transforms/Utils/LoopUnroll.cpp index 20978cf..1216538 100644 --- a/llvm/lib/Transforms/Utils/LoopUnroll.cpp +++ b/llvm/lib/Transforms/Utils/LoopUnroll.cpp @@ -377,6 +377,10 @@ void llvm::simplifyLoopAfterUnroll(Loop *L, bool SimplifyIVs, LoopInfo *LI, const DataLayout &DL = L->getHeader()->getModule()->getDataLayout(); SmallVector<WeakTrackingVH, 16> DeadInsts; for (BasicBlock *BB : L->getBlocks()) { + // Remove repeated debug instructions after loop unrolling. + if (BB->getParent()->getSubprogram()) + RemoveRedundantDbgInstrs(BB); + for (Instruction &Inst : llvm::make_early_inc_range(*BB)) { if (Value *V = simplifyInstruction(&Inst, {DL, nullptr, DT, AC})) if (LI->replacementPreservesLCSSAForm(&Inst, V)) |