[PATCH] D92524: [IRSimilarity] Strip out the findSimilarity call from the constructor
Nathan Lanza via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 2 16:38:04 PST 2020
lanza created this revision.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
lanza requested review of this revision.
Both `doInitialize` and `runOnModule` were running the entire analysis
due to the actual work being done in the constructor. Strip it out here
and only get the similarity during `runOnModule`.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D92524
Files:
llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
llvm/lib/Analysis/IRSimilarityIdentifier.cpp
Index: llvm/lib/Analysis/IRSimilarityIdentifier.cpp
===================================================================
--- llvm/lib/Analysis/IRSimilarityIdentifier.cpp
+++ llvm/lib/Analysis/IRSimilarityIdentifier.cpp
@@ -651,7 +651,7 @@
}
bool IRSimilarityIdentifierWrapperPass::doInitialization(Module &M) {
- IRSI.reset(new IRSimilarityIdentifier(M));
+ IRSI.reset(new IRSimilarityIdentifier());
return false;
}
@@ -662,7 +662,7 @@
bool IRSimilarityIdentifierWrapperPass::runOnModule(Module &M) {
// All the real work is done in the constructor for the pass.
- IRSI.reset(new IRSimilarityIdentifier(M));
+ IRSI->findSimilarity(M);
return false;
}
@@ -670,7 +670,9 @@
IRSimilarityIdentifier IRSimilarityAnalysis::run(Module &M,
ModuleAnalysisManager &) {
- return IRSimilarityIdentifier(M);
+ auto IRSI = IRSimilarityIdentifier();
+ IRSI.findSimilarity(M);
+ return IRSI;
}
PreservedAnalyses
Index: llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
===================================================================
--- llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
+++ llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
@@ -611,12 +611,6 @@
IRSimilarityIdentifier()
: Mapper(&InstDataAllocator, &InstDataListAllocator) {}
- /// \param M the module to find similarity in.
- explicit IRSimilarityIdentifier(Module &M)
- : Mapper(&InstDataAllocator, &InstDataListAllocator) {
- findSimilarity(M);
- }
-
private:
/// Map the instructions in the module to unsigned integers, using mapping
/// already present in the Mapper if possible.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92524.309100.patch
Type: text/x-patch
Size: 1659 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201203/93a4aac6/attachment.bin>
More information about the llvm-commits
mailing list