[PATCH] Allow 0-weight branches in BranchProbabilityInfo.

Hans Wennborg hans at chromium.org
Wed May 6 10:00:01 PDT 2015


On Wed, May 6, 2015 at 9:42 AM, Diego Novillo <dnovillo at google.com> wrote:
> On Wed, May 6, 2015 at 12:41 PM, Hans Wennborg <hans at chromium.org> wrote:
>> ================
>> Comment at: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:8024
>> @@ -8013,1 +8023,3 @@
>> +      Weight = std::max(
>> +          1u, BPI->getEdgeWeight(SI.getParent(), I.getSuccessorIndex()));
>>        assert(Weight <= UINT32_MAX / SI.getNumSuccessors());
>> ----------------
>> This looks good. I can address this TODO later.
>>
>> I figured this would be the only change necessary for the switch lowering code. Are the changes to getEdgeWeight() and lowerWorkItem() also necessary?
>
> I don't know. I took the machine gun approach and changed all the
> places that called into BPI. I can remove the ones that don't cause
> the assertion in the tests, if you want.

Yes, please.



More information about the llvm-commits mailing list