[llvm] r269471 - use range-loops; NFCI
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Fri May 13 13:24:54 PDT 2016
Author: spatel
Date: Fri May 13 15:24:53 2016
New Revision: 269471
URL: http://llvm.org/viewvc/llvm-project?rev=269471&view=rev
Log:
use range-loops; NFCI
Modified:
llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=269471&r1=269470&r2=269471&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Fri May 13 15:24:53 2016
@@ -3865,12 +3865,12 @@ static bool EliminateDeadSwitchCases(Swi
// Gather dead cases.
SmallVector<ConstantInt*, 8> DeadCases;
- for (SwitchInst::CaseIt I = SI->case_begin(), E = SI->case_end(); I != E; ++I) {
- if ((I.getCaseValue()->getValue() & KnownZero) != 0 ||
- (I.getCaseValue()->getValue() & KnownOne) != KnownOne) {
- DeadCases.push_back(I.getCaseValue());
+ for (auto &Case : SI->cases()) {
+ if ((Case.getCaseValue()->getValue() & KnownZero) != 0 ||
+ (Case.getCaseValue()->getValue() & KnownOne) != KnownOne) {
+ DeadCases.push_back(Case.getCaseValue());
DEBUG(dbgs() << "SimplifyCFG: switch case '"
- << I.getCaseValue() << "' is dead.\n");
+ << Case.getCaseValue() << "' is dead.\n");
}
}
@@ -3905,8 +3905,8 @@ static bool EliminateDeadSwitchCases(Swi
}
// Remove dead cases from the switch.
- for (unsigned I = 0, E = DeadCases.size(); I != E; ++I) {
- SwitchInst::CaseIt Case = SI->findCaseValue(DeadCases[I]);
+ for (ConstantInt *DeadCase : DeadCases) {
+ SwitchInst::CaseIt Case = SI->findCaseValue(DeadCase);
assert(Case != SI->case_default() &&
"Case was not found. Probably mistake in DeadCases forming.");
if (HasWeight) {
More information about the llvm-commits
mailing list