[PATCH] D119815: [FuncSpec]Save compilation time by caching uses of replaced value
Bin Cheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 15 18:47:01 PST 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rGdfec0b3053b9: [FuncSpec] Save compilation time by caching uses for propagation (authored by bin.cheng).
Changed prior to commit:
https://reviews.llvm.org/D119815?vs=408747&id=409120#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119815/new/
https://reviews.llvm.org/D119815
Files:
llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
Index: llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
===================================================================
--- llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
+++ llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
@@ -344,12 +344,17 @@
LLVM_DEBUG(dbgs() << "FnSpecialization: Replacing " << *V
<< "\nFnSpecialization: with " << *Const << "\n");
- V->replaceAllUsesWith(Const);
-
- for (auto *U : Const->users())
+ // Record uses of V to avoid visiting irrelevant uses of const later.
+ SmallVector<Instruction *> UseInsts;
+ for (auto *U : V->users())
if (auto *I = dyn_cast<Instruction>(U))
if (Solver.isBlockExecutable(I->getParent()))
- Solver.visit(I);
+ UseInsts.push_back(I);
+
+ V->replaceAllUsesWith(Const);
+
+ for (auto *I : UseInsts)
+ Solver.visit(I);
// Remove the instruction from Block and Solver.
if (auto *I = dyn_cast<Instruction>(V)) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119815.409120.patch
Type: text/x-patch
Size: 979 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220216/b5744574/attachment.bin>
More information about the llvm-commits
mailing list