diff options
| author | Justin Bogner <mail@justinbogner.com> | 2015-04-13 12:23:19 +0000 |
|---|---|---|
| committer | Justin Bogner <mail@justinbogner.com> | 2015-04-13 12:23:19 +0000 |
| commit | 1c21c28b9e0b8c90dbbb23e23be008a258fd6e6b (patch) | |
| tree | ba3c7015d6306160748bffa80e7111301b945624 /clang/lib/CodeGen/CodeGenPGO.cpp | |
| parent | cced470374a43dda437e3413673971bd204eff75 (diff) | |
| download | bcm5719-llvm-1c21c28b9e0b8c90dbbb23e23be008a258fd6e6b.tar.gz bcm5719-llvm-1c21c28b9e0b8c90dbbb23e23be008a258fd6e6b.zip | |
InstrProf: Simplify getStmtCount by using an Optional
llvm-svn: 234750
Diffstat (limited to 'clang/lib/CodeGen/CodeGenPGO.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CodeGenPGO.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CodeGenPGO.cpp b/clang/lib/CodeGen/CodeGenPGO.cpp index 557828db0d0..cc6ac20dd7b 100644 --- a/clang/lib/CodeGen/CodeGenPGO.cpp +++ b/clang/lib/CodeGen/CodeGenPGO.cpp @@ -880,12 +880,10 @@ llvm::MDNode *CodeGenPGO::createLoopWeights(const Stmt *Cond, if (!haveRegionCounts()) return nullptr; uint64_t LoopCount = Cnt.getCount(); - uint64_t CondCount = 0; - bool Found = getStmtCount(Cond, CondCount); - assert(Found && "missing expected loop condition count"); - (void)Found; - if (CondCount == 0) + Optional<uint64_t> CondCount = getStmtCount(Cond); + assert(CondCount.hasValue() && "missing expected loop condition count"); + if (*CondCount == 0) return nullptr; return createBranchWeights(LoopCount, - std::max(CondCount, LoopCount) - LoopCount); + std::max(*CondCount, LoopCount) - LoopCount); } |

