[PATCH] D85379: Reduce dropTriviallyDeadConstantArrays cumulative time percentage from 17% to 4%
Teresa Johnson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 7 11:37:55 PDT 2020
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGaedaa077f58d: Reduce dropTriviallyDeadConstantArrays cumulative time percentage from 17% to 4% (authored by Jianzhou Zhao <jianzhouzh at google.com>, committed by tejohnson).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D85379/new/
https://reviews.llvm.org/D85379
Files:
llvm/lib/IR/LLVMContextImpl.cpp
Index: llvm/lib/IR/LLVMContextImpl.cpp
===================================================================
--- llvm/lib/IR/LLVMContextImpl.cpp
+++ llvm/lib/IR/LLVMContextImpl.cpp
@@ -129,8 +129,15 @@
}
void LLVMContextImpl::dropTriviallyDeadConstantArrays() {
- SmallSetVector<ConstantArray *, 4> WorkList(ArrayConstants.begin(),
- ArrayConstants.end());
+ SmallSetVector<ConstantArray *, 4> WorkList;
+
+ // When ArrayConstants are of substantial size and only a few in them are
+ // dead, starting WorkList with all elements of ArrayConstants can be
+ // wasteful. Instead, starting WorkList with only elements that have empty
+ // uses.
+ for (ConstantArray *C : ArrayConstants)
+ if (C->use_empty())
+ WorkList.insert(C);
while (!WorkList.empty()) {
ConstantArray *C = WorkList.pop_back_val();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85379.283966.patch
Type: text/x-patch
Size: 872 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200807/fdf957c7/attachment.bin>
More information about the llvm-commits
mailing list