[PATCH] D54686: [IR] Add hasNPredecessors, hasNPredecessorsOrMore to BasicBlock
Vedant Kumar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 18 23:37:36 PST 2018
vsk created this revision.
vsk added reviewers: davide, hfinkel, rnk.
Herald added subscribers: dexonsmith, rogfer01, george.burgess.iv, hiraditya.
Add methods to BasicBlock which make it easier to efficiently check
whether a block has N (or more) predecessors.
This can be more efficient than using pred_size(), which is a linear
time operation.
We might consider adding similar methods for successors. I haven't done
so in this patch because succ_size() is already O(1).
With this patch applied, I measured a 0.065% compile-time reduction in
user time for running `opt -O3` on the sqlite3 amalgamation (30 trials).
The change in mergeStoreIntoSuccessor alone saves 45 million linked list
iterations in a stage2 Release build of llc.
See llvm.org/PR39702 for a harder but more general way of achieving
similar results.
https://reviews.llvm.org/D54686
Files:
llvm/include/llvm/ADT/STLExtras.h
llvm/include/llvm/IR/BasicBlock.h
llvm/include/llvm/IR/CFG.h
llvm/lib/Analysis/MemorySSAUpdater.cpp
llvm/lib/IR/BasicBlock.cpp
llvm/lib/IR/Value.cpp
llvm/lib/Transforms/IPO/PartialInlining.cpp
llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
llvm/lib/Transforms/Utils/Local.cpp
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
llvm/lib/Transforms/Vectorize/VPlan.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54686.174562.patch
Type: text/x-patch
Size: 8996 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181119/fd1a7cc7/attachment.bin>
More information about the llvm-commits
mailing list