[llvm] r248354 - Fixed an issue on updating profile data when lowering switch statement.
Cong Hou via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 22 17:38:10 PDT 2015
Submitted as r248356.
thanks,
Cong
On Tue, Sep 22, 2015 at 5:34 PM, Cong Hou <congh at google.com> wrote:
> I composed a test case but I thought it may be just a duplication of the
> one I checked in previously. However, after thinking about it again, I
> found it is still different and can reflect the previous bug. I will check
> in it soon.
>
> Thank you for pointing it out!
>
>
> thanks,
> Cong
>
> On Tue, Sep 22, 2015 at 5:24 PM, David Blaikie <dblaikie at gmail.com> wrote:
>
>> Test case?
>>
>> On Tue, Sep 22, 2015 at 5:20 PM, Cong Hou via llvm-commits <
>> llvm-commits at lists.llvm.org> wrote:
>>
>>> Author: conghou
>>> Date: Tue Sep 22 19:20:27 2015
>>> New Revision: 248354
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=248354&view=rev
>>> Log:
>>> Fixed an issue on updating profile data when lowering switch statement.
>>>
>>> Fixed the issue that when there is an edge from the jump table to the
>>> default statement, we should check it directly instead of checking if the
>>> sibling of the jump table header is a successor of the jump table header,
>>> which may not be the default statment but a successor of it.
>>>
>>>
>>> Modified:
>>> llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
>>>
>>> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=248354&r1=248353&r2=248354&view=diff
>>>
>>> ==============================================================================
>>> --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
>>> (original)
>>> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Tue Sep
>>> 22 19:20:27 2015
>>> @@ -8146,13 +8146,13 @@ void SelectionDAGBuilder::lowerWorkItem(
>>> uint32_t JumpWeight = I->Weight;
>>> uint32_t FallthroughWeight = UnhandledWeights;
>>>
>>> - // If Fallthrough is a target of the jump table, we evenly
>>> distribute
>>> - // the weight on the edge to Fallthrough to successors of
>>> CurMBB.
>>> - // Also update the weight on the edge from JumpMBB to
>>> Fallthrough.
>>> + // If the default statement is a target of the jump table, we
>>> evenly
>>> + // distribute the default weight to successors of CurMBB. Also
>>> update
>>> + // the weight on the edge from JumpMBB to Fallthrough.
>>> for (MachineBasicBlock::succ_iterator SI =
>>> JumpMBB->succ_begin(),
>>> SE = JumpMBB->succ_end();
>>> SI != SE; ++SI) {
>>> - if (*SI == Fallthrough) {
>>> + if (*SI == DefaultMBB) {
>>> JumpWeight += DefaultWeight / 2;
>>> FallthroughWeight -= DefaultWeight / 2;
>>> JumpMBB->setSuccWeight(SI, DefaultWeight / 2);
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150922/b71ebb49/attachment.html>
More information about the llvm-commits
mailing list