[SamplePGO][NFC] Minor improvement to replace a temporary vector with a
authorWei Mi <wmi@google.com>
Tue, 5 Feb 2019 00:57:50 +0000 (00:57 +0000)
committerWei Mi <wmi@google.com>
Tue, 5 Feb 2019 00:57:50 +0000 (00:57 +0000)
brace-enclosed init list.

Differential Revision: https://reviews.llvm.org/D57726

llvm-svn: 353129

llvm/lib/Transforms/IPO/SampleProfile.cpp

index bc2ceec..7483184 100644 (file)
@@ -1327,9 +1327,8 @@ void SampleProfileLoader::propagateWeights(Function &F) {
                             SortedCallTargets, Sum, IPVK_IndirectCallTarget,
                             SortedCallTargets.size());
         } else if (!dyn_cast<IntrinsicInst>(&I)) {
-          SmallVector<uint32_t, 1> Weights;
-          Weights.push_back(BlockWeights[BB]);
-          I.setMetadata(LLVMContext::MD_prof, MDB.createBranchWeights(Weights));
+          I.setMetadata(LLVMContext::MD_prof,
+                        MDB.createBranchWeights({BlockWeights[BB]}));
         }
       }
     }