[PATCH] D142579: [llvm][NFC] Rename variables to match style guide in Local.cpp
Paul Kirth via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 25 13:41:16 PST 2023
paulkirth created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
paulkirth requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D142579
Files:
llvm/lib/Transforms/Utils/Local.cpp
Index: llvm/lib/Transforms/Utils/Local.cpp
===================================================================
--- llvm/lib/Transforms/Utils/Local.cpp
+++ llvm/lib/Transforms/Utils/Local.cpp
@@ -201,16 +201,16 @@
bool Changed = false;
// Figure out which case it goes to.
- for (auto i = SI->case_begin(), e = SI->case_end(); i != e;) {
+ for (auto I = SI->case_begin(), E = SI->case_end(); I != E;) {
// Found case matching a constant operand?
- if (i->getCaseValue() == CI) {
- TheOnlyDest = i->getCaseSuccessor();
+ if (I->getCaseValue() == CI) {
+ TheOnlyDest = I->getCaseSuccessor();
break;
}
// Check to see if this branch is going to the same place as the default
// dest. If so, eliminate it as an explicit compare.
- if (i->getCaseSuccessor() == DefaultDest) {
+ if (I->getCaseSuccessor() == DefaultDest) {
MDNode *MD = getValidBranchWeightMDNode(*SI);
unsigned NCases = SI->getNumCases();
// Fold the case metadata into the default if there will be any branches
@@ -221,11 +221,11 @@
extractBranchWeights(MD, Weights);
// Merge weight of this case to the default weight.
- unsigned idx = i->getCaseIndex();
+ unsigned Idx = I->getCaseIndex();
// TODO: Add overflow check.
- Weights[0] += Weights[idx+1];
+ Weights[0] += Weights[Idx+1];
// Remove weight for this case.
- std::swap(Weights[idx+1], Weights.back());
+ std::swap(Weights[Idx+1], Weights.back());
Weights.pop_back();
SI->setMetadata(LLVMContext::MD_prof,
MDBuilder(BB->getContext()).
@@ -234,14 +234,14 @@
// Remove this entry.
BasicBlock *ParentBB = SI->getParent();
DefaultDest->removePredecessor(ParentBB);
- i = SI->removeCase(i);
- e = SI->case_end();
+ I = SI->removeCase(I);
+ E = SI->case_end();
// Removing this case may have made the condition constant. In that
// case, update CI and restart iteration through the cases.
if (auto *NewCI = dyn_cast<ConstantInt>(SI->getCondition())) {
CI = NewCI;
- i = SI->case_begin();
+ I = SI->case_begin();
}
Changed = true;
@@ -251,11 +251,11 @@
// Otherwise, check to see if the switch only branches to one destination.
// We do this by reseting "TheOnlyDest" to null when we find two non-equal
// destinations.
- if (i->getCaseSuccessor() != TheOnlyDest)
+ if (I->getCaseSuccessor() != TheOnlyDest)
TheOnlyDest = nullptr;
// Increment this iterator as we haven't removed the case.
- ++i;
+ ++I;
}
if (CI && !TheOnlyDest) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142579.492245.patch
Type: text/x-patch
Size: 2817 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230125/8fbddac2/attachment.bin>
More information about the llvm-commits
mailing list