@@ -226,7 +226,7 @@ bool llvm::addStringMetadataToLoop(Loop *TheLoop, const char *StringMD,
226
226
if (NumOps == 1 || NumOps == 2 ) {
227
227
MDString *S = dyn_cast<MDString>(Node->getOperand (0 ));
228
228
if (S && S->getString () == StringMD) {
229
- // If it is already in place , do nothing.
229
+ // If the metadata and any value are already as specified , do nothing.
230
230
if (NumOps == 2 && V) {
231
231
ConstantInt *IntMD =
232
232
mdconst::extract_or_null<ConstantInt>(Node->getOperand (1 ));
@@ -879,7 +879,7 @@ std::optional<unsigned> llvm::getLoopEstimatedTripCount(
879
879
// EstimatedLoopInvocationWeight parameter.
880
880
if (EstimatedLoopInvocationWeight) {
881
881
if (BranchInst *ExitingBranch = getExpectedExitLoopLatchBranch (L)) {
882
- uint64_t LoopWeight, ExitWeight;
882
+ uint64_t LoopWeight = 0 , ExitWeight = 0 ; // Inits expected to be unused.
883
883
if (!extractBranchWeights (*ExitingBranch, LoopWeight, ExitWeight))
884
884
return std::nullopt ;
885
885
if (L->contains (ExitingBranch->getSuccessor (1 )))
@@ -951,7 +951,7 @@ bool llvm::setLoopEstimatedTripCount(
951
951
unsigned LatchExitWeight = 0 ;
952
952
unsigned BackedgeTakenWeight = 0 ;
953
953
954
- if (*EstimatedTripCount > 0 ) {
954
+ if (*EstimatedTripCount != 0 ) {
955
955
LatchExitWeight = *EstimatedloopInvocationWeight;
956
956
BackedgeTakenWeight = (*EstimatedTripCount - 1 ) * LatchExitWeight;
957
957
}
0 commit comments