[llvm] r254348 - Replace all weight-based interfaces in MBB with probability-based interfaces, and update all uses of old interfaces.

Cong Hou via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 30 17:00:23 PST 2015


The patch is submitted as r254356. As I didn't get this failure
locally, let's see if this can fix all issues caused by the original
patch. Otherwise I will revert the revision.


thanks,
Cong


On Mon, Nov 30, 2015 at 4:56 PM, Cong Hou <congh at google.com> wrote:
> I have also noticed several buildbot failures. I have found the cause
> and now testing the patch below:
>
>
> diff --git a/lib/CodeGen/MachineBlockPlacement.cpp
> b/lib/CodeGen/MachineBlockPlacement.cpp
> index ddddd48..fcddf34 100644
> --- a/lib/CodeGen/MachineBlockPlacement.cpp
> +++ b/lib/CodeGen/MachineBlockPlacement.cpp
> @@ -423,9 +423,13 @@
> MachineBlockPlacement::selectBestSuccessor(MachineBasicBlock *BB,
>
>    DEBUG(dbgs() << "Attempting merge from: " << getBlockName(BB) << "\n");
>    for (MachineBasicBlock *Succ : Successors) {
> -    BranchProbability SuccProb(
> -        MBPI->getEdgeProbability(BB, Succ).getNumerator(),
> -        AdjustedSumProb.getNumerator());
> +    BranchProbability SuccProb;
> +    uint32_t SuccProbN = MBPI->getEdgeProbability(BB, Succ).getNumerator();
> +    uint32_t SuccProbD = AdjustedSumProb.getNumerator();
> +    if (SuccProbN >= SuccProbD)
> +      SuccProb = BranchProbability::getOne();
> +    else
> +      SuccProb = BranchProbability(SuccProbN, SuccProbD);
>
>      // If we outline optional branches, look whether Succ is unavoidable, i.e.
>      // dominates all terminators of the MachineFunction. If it does, other
>
>
> Thank you for reporting this!
>
>
> thanks,
> Cong
>
>
> On Mon, Nov 30, 2015 at 4:51 PM, Hans Wennborg <hans at chromium.org> wrote:
>> On Mon, Nov 30, 2015 at 4:02 PM, Cong Hou via llvm-commits
>> <llvm-commits at lists.llvm.org> wrote:
>>> Author: conghou
>>> Date: Mon Nov 30 18:02:51 2015
>>> New Revision: 254348
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=254348&view=rev
>>> Log:
>>> Replace all weight-based interfaces in MBB with probability-based interfaces, and update all uses of old interfaces.
>>
>> [...]
>>
>>> @@ -43,6 +46,19 @@ BranchProbability::BranchProbability(uin
>>>    }
>>>  }
>>>
>>> +BranchProbability
>>> +BranchProbability::getBranchProbability(uint64_t Numerator,
>>> +                                        uint64_t Denominator) {
>>> +  assert(Numerator <= Denominator && "Probability cannot be bigger than 1!");
>>
>> We hit this assert pretty early in a Chromium build:
>>
>> http://build.chromium.org/p/chromium.fyi/builders/ClangToTWin/builds/5080/steps/compile/logs/stdio
>>
>> I'll see if I can extract a reproducer.


More information about the llvm-commits mailing list