diff options
author | Vedant Kumar <vsk@apple.com> | 2018-05-10 23:01:54 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2018-05-10 23:01:54 +0000 |
commit | e0b5f86b3083747beaf5d7639333af0109c9e6ef (patch) | |
tree | f76486dec408880ad53ce624064ccb10f2b9faea /llvm/lib/CodeGen/CodeGenPrepare.cpp | |
parent | 4855c5f717fde5207033e97989b20b273298a57b (diff) | |
download | llvm-e0b5f86b3083747beaf5d7639333af0109c9e6ef.zip llvm-e0b5f86b3083747beaf5d7639333af0109c9e6ef.tar.gz llvm-e0b5f86b3083747beaf5d7639333af0109c9e6ef.tar.bz2 |
[STLExtras] Add distance() for ranges, pred_size(), and succ_size()
This commit adds a wrapper for std::distance() which works with ranges.
As it would be a common case to write `distance(predecessors(BB))`, this
also introduces `pred_size()` and `succ_size()` helpers to make that
easier to write.
Differential Revision: https://reviews.llvm.org/D46668
llvm-svn: 332057
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r-- | llvm/lib/CodeGen/CodeGenPrepare.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index 3bc8cc1..87cb2f9 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -3094,8 +3094,7 @@ private: Instruction *CurrentI = cast<Instruction>(CurrentValue); bool IsDefinedInThisBB = CurrentI->getParent() == CurrentBlock; - unsigned PredCount = - std::distance(pred_begin(CurrentBlock), pred_end(CurrentBlock)); + unsigned PredCount = pred_size(CurrentBlock); // if Current Value is not defined in this basic block we are interested // in values in predecessors. if (!IsDefinedInThisBB) { |