This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/43402] [4.5 Regression] dom1 miscompiles binary search
- From: "matz at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Mar 2010 15:31:08 -0000
- Subject: [Bug tree-optimization/43402] [4.5 Regression] dom1 miscompiles binary search
- References: <bug-43402-12182@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from matz at gcc dot gnu dot org 2010-03-17 15:31 -------
It seems the jump threading somehow confuses cfgcleanup. Right after the
jumps are threaded (in tree_ssa_dominator_optimize after the call to
thread_through_all_blocks) the function looks like so:
<bb 2>:
goto <bb 9>;
<bb 3>:
# start_16 = PHI <mid_10(6), start_1(10)>
# limit_19 = PHI <limit_2(6), mid_10(10)>
# lastMid_15 = PHI <mid_10(6), mid_10(10)>
<bb 4>:
# start_1 = PHI <start_16(3)>
# limit_2 = PHI <limit_19(3)>
# lastMid_3 = PHI <mid_10(3)>
D.2744_9 = start_1 + limit_2;
mid_10 = D.2744_9 / 2;
if (lastMid_3 == mid_10)
goto <bb 8>;
else
goto <bb 5>;
<bb 6>:
if (result_14 > 0)
goto <bb 3>;
else
goto <bb 7>;
<bb 7>:
D.2754_17 = cnvNameType[mid_10].type;
D.2753_18 = converterData[D.2754_17];
<bb 8>:
# D.2753_4 = PHI <D.2753_18(7), 0B(4)>
return D.2753_4;
<bb 9>:
# start_21 = PHI <0(2)>
# limit_22 = PHI <3(2)>
# lastMid_23 = PHI <4294967295(2)>
D.2744_24 = start_1 + limit_2;
mid_25 = D.2744_9 / 2;
goto <bb 10>;
<bb 5>:
<bb 10>:
D.2746_12 = cnvNameType[mid_10].name;
result_14 = __builtin_strcmp (realName_13(D), D.2746_12);
if (result_14 < 0)
goto <bb 3>;
else
goto <bb 6>;
At that point the PHI nodes for BB 10 are still missing, and we have
registered these ssaname updates:
start_21 -> { start_1 }
limit_22 -> { limit_2 }
lastMid_23 -> { lastMid_3 }
D.2744_24 -> { D.2744_9 }
mid_25 -> { mid_10 }
With the right PHI nodes at bb 10 the code still looks good. But somehow
cfgcleanup scrambles the whole thing.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43402