[PATCH] D91477: [DCE] Port -redundant-dbg-inst-elim to NPM
Arthur Eubanks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 14 16:55:45 PST 2020
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6e04da0a5ac9: [DCE] Port -redundant-dbg-inst-elim to NPM (authored by aeubanks).
Changed prior to commit:
https://reviews.llvm.org/D91477?vs=305306&id=305334#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D91477/new/
https://reviews.llvm.org/D91477
Files:
llvm/include/llvm/Transforms/Scalar/DCE.h
llvm/lib/Passes/PassRegistry.def
llvm/lib/Transforms/Scalar/DCE.cpp
llvm/test/Transforms/DCE/dbg-value-removal.ll
Index: llvm/test/Transforms/DCE/dbg-value-removal.ll
===================================================================
--- llvm/test/Transforms/DCE/dbg-value-removal.ll
+++ llvm/test/Transforms/DCE/dbg-value-removal.ll
@@ -1,5 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -S -redundant-dbg-inst-elim | FileCheck %s
+; RUN: opt < %s -S -passes=redundant-dbg-inst-elim | FileCheck %s
; All dbg.value with location "!dbg !19" are redundant in the input.
; FIXME: We do not handle non-overlapping/overlapping fragments perfectly yet.
Index: llvm/lib/Transforms/Scalar/DCE.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/DCE.cpp
+++ llvm/lib/Transforms/Scalar/DCE.cpp
@@ -69,6 +69,18 @@
return new RedundantDbgInstElimination();
}
+PreservedAnalyses
+RedundantDbgInstEliminationPass::run(Function &F, FunctionAnalysisManager &AM) {
+ bool Changed = false;
+ for (auto &BB : F)
+ Changed |= RemoveRedundantDbgInstrs(&BB);
+ if (!Changed)
+ return PreservedAnalyses::all();
+ PreservedAnalyses PA;
+ PA.preserveSet<CFGAnalyses>();
+ return PA;
+}
+
//===--------------------------------------------------------------------===//
// DeadCodeElimination pass implementation
//
Index: llvm/lib/Passes/PassRegistry.def
===================================================================
--- llvm/lib/Passes/PassRegistry.def
+++ llvm/lib/Passes/PassRegistry.def
@@ -285,6 +285,7 @@
FUNCTION_PASS("print-predicateinfo", PredicateInfoPrinterPass(dbgs()))
FUNCTION_PASS("print-mustexecute", MustExecutePrinterPass(dbgs()))
FUNCTION_PASS("reassociate", ReassociatePass())
+FUNCTION_PASS("redundant-dbg-inst-elim", RedundantDbgInstEliminationPass())
FUNCTION_PASS("reg2mem", RegToMemPass())
FUNCTION_PASS("scalarizer", ScalarizerPass())
FUNCTION_PASS("separate-const-offset-from-gep", SeparateConstOffsetFromGEPPass())
Index: llvm/include/llvm/Transforms/Scalar/DCE.h
===================================================================
--- llvm/include/llvm/Transforms/Scalar/DCE.h
+++ llvm/include/llvm/Transforms/Scalar/DCE.h
@@ -23,6 +23,12 @@
public:
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
};
+
+class RedundantDbgInstEliminationPass
+ : public PassInfoMixin<RedundantDbgInstEliminationPass> {
+public:
+ PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+};
}
#endif // LLVM_TRANSFORMS_SCALAR_DCE_H
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91477.305334.patch
Type: text/x-patch
Size: 2483 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201115/86d2e87d/attachment.bin>
More information about the llvm-commits
mailing list