diff options
author | Hans Wennborg <hans@hanshq.net> | 2012-09-10 07:44:22 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2012-09-10 07:44:22 +0000 |
commit | 2f9fc761d22fb62d63d5f74a826890d2ec7c72f2 (patch) | |
tree | 8a446c831ae1573de8257a62010948f1ec7a5b5b | |
parent | 35aec959e9caa97147231f61f952ab166d993b1b (diff) | |
download | external_llvm-2f9fc761d22fb62d63d5f74a826890d2ec7c72f2.zip external_llvm-2f9fc761d22fb62d63d5f74a826890d2ec7c72f2.tar.gz external_llvm-2f9fc761d22fb62d63d5f74a826890d2ec7c72f2.tar.bz2 |
Fix style issues from r163302 pointed out by Evan.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163491 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/Utils/SimplifyCFG.cpp | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp index db8edea..32d7fa1 100644 --- a/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/lib/Transforms/Utils/SimplifyCFG.cpp @@ -3045,13 +3045,12 @@ static bool GetCaseResults(SwitchInst *SI, /// DefaultResult to fill the holes in the table. If the table ends up /// containing the same result in each element, set *SingleResult to that value /// and return NULL. -static GlobalVariable *BuildLookupTable( - Module &M, - uint64_t TableSize, - ConstantInt *Offset, - const std::vector<std::pair<ConstantInt*,Constant*> >& Results, - Constant *DefaultResult, - Constant **SingleResult) { +static GlobalVariable *BuildLookupTable(Module &M, + uint64_t TableSize, + ConstantInt *Offset, + const SmallVector<std::pair<ConstantInt*, Constant*>, 4>& Results, + Constant *DefaultResult, + Constant **SingleResult) { assert(Results.size() && "Need values to build lookup table"); assert(TableSize >= Results.size() && "Table needs to hold all values"); @@ -3133,7 +3132,7 @@ static bool SwitchToLookupTable(SwitchInst *SI, ConstantInt *MaxCaseVal = CI.getCaseValue(); BasicBlock *CommonDest = NULL; - typedef std::vector<std::pair<ConstantInt*, Constant*> > ResultListTy; + typedef SmallVector<std::pair<ConstantInt*, Constant*>, 4> ResultListTy; SmallDenseMap<PHINode*, ResultListTy> ResultLists; SmallDenseMap<PHINode*, Constant*> DefaultResults; SmallDenseMap<PHINode*, Type*> ResultTypes; @@ -3161,16 +3160,14 @@ static bool SwitchToLookupTable(SwitchInst *SI, } // Get the resulting values for the default case. - { - SmallVector<std::pair<PHINode*, Constant*>, 4> DefaultResultsList; - if (!GetCaseResults(SI, SI->getDefaultDest(), &CommonDest, DefaultResultsList)) - return false; - for (size_t I = 0, E = DefaultResultsList.size(); I != E; ++I) { - PHINode *PHI = DefaultResultsList[I].first; - Constant *Result = DefaultResultsList[I].second; - DefaultResults[PHI] = Result; - ResultTypes[PHI] = Result->getType(); - } + SmallVector<std::pair<PHINode*, Constant*>, 4> DefaultResultsList; + if (!GetCaseResults(SI, SI->getDefaultDest(), &CommonDest, DefaultResultsList)) + return false; + for (size_t I = 0, E = DefaultResultsList.size(); I != E; ++I) { + PHINode *PHI = DefaultResultsList[I].first; + Constant *Result = DefaultResultsList[I].second; + DefaultResults[PHI] = Result; + ResultTypes[PHI] = Result->getType(); } APInt RangeSpread = MaxCaseVal->getValue() - MinCaseVal->getValue(); |