Lines Matching full:cases

137     // Remove additional occurrences coming from condensed cases and keep the
306 /// Transform simple list of \p SI's cases into list of CaseRange's \p Cases.
307 /// \post \p Cases wouldn't contain references to \p SI's default BB.
308 /// \returns Number of \p SI's cases that do not reference \p SI's default BB.
309 unsigned Clusterify(CaseVector &Cases, SwitchInst *SI) {
312 // Start with "simple" cases
313 for (auto Case : SI->cases()) {
316 Cases.push_back(CaseRange(Case.getCaseValue(), Case.getCaseValue(),
321 llvm::sort(Cases, CaseCmp());
324 if (Cases.size() >= 2) {
325 CaseItr I = Cases.begin();
326 for (CaseItr J = std::next(I), E = Cases.end(); J != E; ++J) {
332 // If the two neighboring cases go to the same destination, merge them
335 "Cases should be strictly ascending");
343 Cases.erase(std::next(I), Cases.end());
367 // Prepare cases vector.
368 CaseVector Cases;
369 const unsigned NumSimpleCases = Clusterify(Cases, SI);
376 LLVM_DEBUG(dbgs() << "Clusterify finished. Total clusters: " << Cases.size()
377 << ". Total non-default cases: " << NumSimpleCases
378 << "\nCase clusters: " << Cases << "\n");
381 if (Cases.empty()) {
397 LowerBound = Cases.front().Low;
398 UpperBound = Cases.back().High;
408 // roughly C icmp's per switch, where C is the number of cases in the
418 // We delegate removal of unreachable non-default cases to other passes. In
420 // maintain the invariant that all the cases lie between the bounds. This
422 const APInt &Low = Cases.front().Low->getValue();
423 const APInt &High = Cases.back().High->getValue();
443 for (const auto &I : Cases) {
490 // cases.
492 llvm::erase_if(Cases,
495 // If there are no cases left, just branch.
496 if (Cases.empty()) {
499 // As all the cases have been replaced with a single branch, only keep
514 SwitchConvert(Cases.begin(), Cases.end(), LowerBound, UpperBound, Val,