BFI: Add constructor for Weight
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Sat, 12 Jul 2014 00:26:00 +0000 (00:26 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Sat, 12 Jul 2014 00:26:00 +0000 (00:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212868 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/BlockFrequencyInfoImpl.h
lib/Analysis/BlockFrequencyInfoImpl.cpp

index ba69c7ae3fe05a5956ba869d87da16bd58978c61..bb256c7bbcc8619801d9b1bae7626060560d7089 100644 (file)
@@ -322,6 +322,8 @@ public:
     BlockNode TargetNode;
     uint64_t Amount;
     Weight() : Type(Local), Amount(0) {}
+    Weight(DistType Type, BlockNode TargetNode, uint64_t Amount)
+        : Type(Type), TargetNode(TargetNode), Amount(Amount) {}
   };
 
   /// \brief Distribution of unscaled probability weight.
index 44b4192353a5b46d65d840d84eda8cae6924cd90..3203c371648d79822a56e192cc3572f85ef8469d 100644 (file)
@@ -112,11 +112,7 @@ void Distribution::add(const BlockNode &Node, uint64_t Amount,
   Total = NewTotal;
 
   // Save the weight.
-  Weight W;
-  W.TargetNode = Node;
-  W.Amount = Amount;
-  W.Type = Type;
-  Weights.push_back(W);
+  Weights.push_back(Weight(Type, Node, Amount));
 }
 
 static void combineWeight(Weight &W, const Weight &OtherW) {