<div dir="ltr">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.<div><br></div><div>Thank you for pointing it out!</div><div><br></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature">thanks,<br>Cong</div></div>
<br><div class="gmail_quote">On Tue, Sep 22, 2015 at 5:24 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Test case?</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 22, 2015 at 5:20 PM, Cong Hou via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: conghou<br>
Date: Tue Sep 22 19:20:27 2015<br>
New Revision: 248354<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=248354&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=248354&view=rev</a><br>
Log:<br>
Fixed an issue on updating profile data when lowering switch statement.<br>
<br>
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.<br>
<br>
<br>
Modified:<br>
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp<br>
<br>
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=248354&r1=248353&r2=248354&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=248354&r1=248353&r2=248354&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Tue Sep 22 19:20:27 2015<br>
@@ -8146,13 +8146,13 @@ void SelectionDAGBuilder::lowerWorkItem(<br>
         uint32_t JumpWeight = I->Weight;<br>
         uint32_t FallthroughWeight = UnhandledWeights;<br>
<br>
-        // If Fallthrough is a target of the jump table, we evenly distribute<br>
-        // the weight on the edge to Fallthrough to successors of CurMBB.<br>
-        // Also update the weight on the edge from JumpMBB to Fallthrough.<br>
+        // If the default statement is a target of the jump table, we evenly<br>
+        // distribute the default weight to successors of CurMBB. Also update<br>
+        // the weight on the edge from JumpMBB to Fallthrough.<br>
         for (MachineBasicBlock::succ_iterator SI = JumpMBB->succ_begin(),<br>
                                               SE = JumpMBB->succ_end();<br>
              SI != SE; ++SI) {<br>
-          if (*SI == Fallthrough) {<br>
+          if (*SI == DefaultMBB) {<br>
             JumpWeight += DefaultWeight / 2;<br>
             FallthroughWeight -= DefaultWeight / 2;<br>
             JumpMBB->setSuccWeight(SI, DefaultWeight / 2);<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>
</blockquote></div><br></div>