[PATCH] D10979: Update the branch weight metadata in JumpThreading pass.

Xinliang David Li davidxl at google.com
Fri Jul 17 13:00:39 PDT 2015


ok. Actually the caller already guards the call like:

if (PredBBs.size() == 1)
    PredBB = PredBBs[0];
  else {
    DEBUG(dbgs() << "  Factoring out " << PredBBs.size()
          << " common predecessors.\n");
    PredBB = SplitBlockPredecessors(BB, PredBBs, ".thr_comm");
  }

On Fri, Jul 17, 2015 at 11:32 AM, Cong Hou <congh at google.com> wrote:
> On Fri, Jul 17, 2015 at 11:23 AM, David <davidxl at google.com> wrote:
>> davidxl added inline comments.
>>
>> ================
>> Comment at: lib/Transforms/Scalar/JumpThreading.cpp:1543
>> @@ +1542,3 @@
>> +  BlockFrequency PredBBFreq(0);
>> +  if (HasProfileData)
>> +    for (auto Pred : Preds)
>> ----------------
>> Can be skipped when Preds' s size == 1
>>
>> ================
>> Comment at: lib/Transforms/Scalar/JumpThreading.cpp:1551
>> @@ +1550,3 @@
>> +  // frequencies of Preds.
>> +  if (HasProfileData)
>> +    BFI->setBlockFreq(PredBB, PredBBFreq.getFrequency());
>> ----------------
>> Can be skipped if Preds's size is 1
>
> SplitBlockPredecessors() will create a new block so I think here we
> still need to set the block freq for this new block.
>
>>
>>
>> http://reviews.llvm.org/D10979
>>
>>
>>



More information about the llvm-commits mailing list