[llvm] r261392 - [SCEV] Don't use std::make_pair; NFC

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 19 17:35:56 PST 2016


Author: sanjoy
Date: Fri Feb 19 19:35:56 2016
New Revision: 261392

URL: http://llvm.org/viewvc/llvm-project?rev=261392&view=rev
Log:
[SCEV] Don't use std::make_pair; NFC

`{A, B}` reads cleaner than `std::make_pair(A, B)`.

Modified:
    llvm/trunk/lib/Analysis/ScalarEvolution.cpp

Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=261392&r1=261391&r2=261392&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Fri Feb 19 19:35:56 2016
@@ -1903,7 +1903,7 @@ CollectAddOperandsWithScales(DenseMap<co
         // the map.
         SmallVector<const SCEV *, 4> MulOps(Mul->op_begin()+1, Mul->op_end());
         const SCEV *Key = SE.getMulExpr(MulOps);
-        auto Pair = M.insert(std::make_pair(Key, NewScale));
+        auto Pair = M.insert({Key, NewScale});
         if (Pair.second) {
           NewOps.push_back(Pair.first->first);
         } else {
@@ -1916,7 +1916,7 @@ CollectAddOperandsWithScales(DenseMap<co
     } else {
       // An ordinary operand. Update the map.
       std::pair<DenseMap<const SCEV *, APInt>::iterator, bool> Pair =
-        M.insert(std::make_pair(Ops[i], Scale));
+          M.insert({Ops[i], Scale});
       if (Pair.second) {
         NewOps.push_back(Pair.first->first);
       } else {
@@ -3346,7 +3346,7 @@ bool ScalarEvolution::containsAddRecurre
   FindAddRecurrence F;
   SCEVTraversal<FindAddRecurrence> ST(F);
   ST.visitAll(S);
-  HasRecMap.insert(std::make_pair(S, F.FoundOne));
+  HasRecMap.insert({S, F.FoundOne});
   return F.FoundOne;
 }
 
@@ -3393,7 +3393,7 @@ const SCEV *ScalarEvolution::getSCEV(Val
     // V, so it is needed to double check whether V->S is inserted into
     // ValueExprMap before insert S->V into ExprValueMap.
     std::pair<ValueExprMapType::iterator, bool> Pair =
-        ValueExprMap.insert(std::make_pair(SCEVCallbackVH(V, this), S));
+        ValueExprMap.insert({SCEVCallbackVH(V, this), S});
     if (Pair.second)
       ExprValueMap[S].insert(V);
   }
@@ -3788,7 +3788,7 @@ const SCEV *ScalarEvolution::createAddRe
     const SCEV *SymbolicName = getUnknown(PN);
     assert(ValueExprMap.find_as(PN) == ValueExprMap.end() &&
            "PHI node already processed?");
-    ValueExprMap.insert(std::make_pair(SCEVCallbackVH(PN, this), SymbolicName));
+    ValueExprMap.insert({SCEVCallbackVH(PN, this), SymbolicName});
 
     // Using this symbolic name for the PHI, analyze the value coming around
     // the back-edge.
@@ -5018,7 +5018,7 @@ ScalarEvolution::getBackedgeTakenInfo(co
   // code elsewhere that it shouldn't attempt to request a new
   // backedge-taken count, which could result in infinite recursion.
   std::pair<DenseMap<const Loop *, BackedgeTakenInfo>::iterator, bool> Pair =
-    BackedgeTakenCounts.insert(std::make_pair(L, BackedgeTakenInfo()));
+      BackedgeTakenCounts.insert({L, BackedgeTakenInfo()});
   if (!Pair.second)
     return Pair.first->second;
 
@@ -5285,7 +5285,7 @@ ScalarEvolution::computeBackedgeTakenCou
       // we won't be able to compute an exact value for the loop.
       CouldComputeBECount = false;
     else
-      ExitCounts.push_back(std::make_pair(ExitBB, EL.Exact));
+      ExitCounts.push_back({ExitBB, EL.Exact});
 
     // 2. Derive the loop's MaxBECount from each exit's max number of
     // non-exiting iterations. Partition the loop exits into two kinds:
@@ -6571,7 +6571,7 @@ SolveQuadraticEquation(const SCEVAddRecE
   // We currently can only solve this if the coefficients are constants.
   if (!LC || !MC || !NC) {
     const SCEV *CNC = SE.getCouldNotCompute();
-    return std::make_pair(CNC, CNC);
+    return {CNC, CNC};
   }
 
   uint32_t BitWidth = LC->getAPInt().getBitWidth();
@@ -6600,7 +6600,7 @@ SolveQuadraticEquation(const SCEVAddRecE
     if (SqrtTerm.isNegative()) {
       // The loop is provably infinite.
       const SCEV *CNC = SE.getCouldNotCompute();
-      return std::make_pair(CNC, CNC);
+      return {CNC, CNC};
     }
 
     // Compute sqrt(B^2-4ac). This is guaranteed to be the nearest
@@ -6613,7 +6613,7 @@ SolveQuadraticEquation(const SCEVAddRecE
     APInt TwoA(A << 1);
     if (TwoA.isMinValue()) {
       const SCEV *CNC = SE.getCouldNotCompute();
-      return std::make_pair(CNC, CNC);
+      return {CNC, CNC};
     }
 
     LLVMContext &Context = SE.getContext();
@@ -6623,8 +6623,7 @@ SolveQuadraticEquation(const SCEVAddRecE
     ConstantInt *Solution2 =
       ConstantInt::get(Context, (NegB - SqrtVal).sdiv(TwoA));
 
-    return std::make_pair(SE.getConstant(Solution1),
-                          SE.getConstant(Solution2));
+    return {SE.getConstant(Solution1), SE.getConstant(Solution2)};
   } // end APIntOps namespace
 }
 
@@ -6834,15 +6833,15 @@ ScalarEvolution::getPredecessorWithUniqu
   // predecessor to the block that does not go through the direct edge
   // from the predecessor to the block.
   if (BasicBlock *Pred = BB->getSinglePredecessor())
-    return std::make_pair(Pred, BB);
+    return {Pred, BB};
 
   // A loop's header is defined to be a block that dominates the loop.
   // If the header has a unique predecessor outside the loop, it must be
   // a block that has exactly one successor that can reach the loop.
   if (Loop *L = LI.getLoopFor(BB))
-    return std::make_pair(L->getLoopPredecessor(), L->getHeader());
+    return {L->getLoopPredecessor(), L->getHeader()};
 
-  return std::pair<BasicBlock *, BasicBlock *>();
+  return {nullptr, nullptr};
 }
 
 /// HasSameValue - SCEV structural equivalence is usually sufficient for




More information about the llvm-commits mailing list