public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "dann at godzilla dot ics dot uci dot edu" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/26944] [4.1/4.2 Regression] -ftree-ch generates worse code Date: Wed, 03 May 2006 18:55:00 -0000 [thread overview] Message-ID: <20060503185448.7086.qmail@sourceware.org> (raw) In-Reply-To: <bug-26944-1008@http.gcc.gnu.org/bugzilla/> ------- Comment #5 from dann at godzilla dot ics dot uci dot edu 2006-05-03 18:54 ------- IMO Comment #4 does not look close enough at what is actually happening. IMO tree-ch is the root cause here. The code looks like this before .ch Before .ch goto <bb 2> (<L1>); <L0>:; D.1301_54 = Int_Loc.0_4 * 200; D.1302_55 = (int[50] *) D.1301_54; D.1303_56 = Arr_2_Par_Ref_30 + D.1302_55; (*D.1303_56)[Int_Index_1] = Int_Loc_3; Int_Index_58 = Int_Index_1 + 1; # Int_Index_1 = PHI <Int_Loc_3(0), Int_Index_58(1)>; <L1>:; D.1305_26 = Int_Loc_3 + 1; if (Int_Index_1 <= D.1305_26) goto <L0>; else goto <L2>; <L2>:; after .ch it looks like this: D.1305_41 = Int_Loc_3 + 1; if (Int_Loc_3 <= D.1305_41) goto <L0>; else goto <L2>; <-- this just complicates the CFG. Look below to see what are the effects of doing this in later passes. Plus just look at the comparison ... # Int_Index_37 = PHI <Int_Index_58(1), Int_Loc_3(0)>; <L0>:; D.1301_54 = Int_Loc.0_4 * 200; D.1302_55 = (int[50] *) D.1301_54; D.1303_56 = Arr_2_Par_Ref_30 + D.1302_55; (*D.1303_56)[Int_Index_37] = Int_Loc_3; Int_Index_58 = Int_Index_37 + 1; D.1305_26 = Int_Loc_3 + 1; if (D.1305_26 >= Int_Index_58) goto <L0>; else goto <L2>; <L2>:; Given the above CFG, critical edge splitting transforms this into: D.1305_41 = Int_Loc_3 + 1; if (Int_Loc_3 <= D.1305_41) goto <L6>; else goto <L7>; <L7>:; goto <bb 2> (<L2>); <L6>:; # Int_Index_37 = PHI <Int_Index_58(5), Int_Loc_3(3)>; <L0>:; D.1301_54 = Int_Loc.0_4 * 200; D.1302_55 = (int[50] *) D.1301_54; D.1303_56 = Arr_2_Par_Ref_30 + D.1302_55; (*D.1303_56)[Int_Index_37] = Int_Loc_3; Int_Index_58 = Int_Index_37 + 1; if (D.1305_41 >= Int_Index_58) goto <L8>; else goto <L9>; <L8>:; goto <bb 1> (<L0>); <L9>:; <L2>:; Given the above CFG PRE will dutifully fill with code a lot of the empty basic blocks: after pre D.1305_41 = Int_Loc_3 + 1; if (Int_Loc_3 <= D.1305_41) goto <L6>; else goto <L7>; <L7>:; pretmp.34_45 = Int_Loc.0_4 * 200; pretmp.36_57 = (int[50] *) pretmp.34_45; pretmp.38_25 = Arr_2_Par_Ref_30 + pretmp.36_57; goto <bb 2> (<L2>); <L6>:; pretmp.30_26 = Int_Loc.0_4 * 200; pretmp.31_19 = (int[50] *) pretmp.30_26; pretmp.32_1 = pretmp.31_19 + Arr_2_Par_Ref_30; # Int_Index_37 = PHI <Int_Index_58(5), Int_Loc_3(3)>; <L0>:; D.1301_54 = pretmp.30_26; D.1302_55 = pretmp.31_19; D.1303_56 = pretmp.32_1; (*D.1303_56)[Int_Index_37] = Int_Loc_3; Int_Index_58 = Int_Index_37 + 1; if (D.1305_41 >= Int_Index_58) goto <L8>; else goto <L9>; <L8>:; goto <bb 1> (<L0>); <L9>:; # prephitmp.39_23 = PHI <D.1303_56(6), pretmp.38_25(4)>; # prephitmp.37_53 = PHI <D.1302_55(6), pretmp.36_57(4)>; # prephitmp.35_49 = PHI <D.1301_54(6), pretmp.34_45(4)>; <L2>:; Now when using -fno-tree-ch before critical edge splitting the code looks like this: goto <bb 2> (<L1>); <L0>:; D.1301_54 = Int_Loc.0_4 * 200; D.1302_55 = (int[50] *) D.1301_54; D.1303_56 = Arr_2_Par_Ref_30 + D.1302_55; (*D.1303_56)[Int_Index_1] = Int_Loc_3; Int_Index_58 = Int_Index_1 + 1; # Int_Index_1 = PHI <Int_Loc_3(0), Int_Index_58(1)>; <L1>:; D.1305_26 = Int_Loc_3 + 1; if (Int_Index_1 <= D.1305_26) goto <L0>; else goto <L2>; <L2>:; after crited it looks like this: (i.e. no change) goto <bb 2> (<L1>); <L0>:; D.1301_54 = Int_Loc.0_4 * 200; D.1302_55 = (int[50] *) D.1301_54; D.1303_56 = Arr_2_Par_Ref_30 + D.1302_55; (*D.1303_56)[Int_Index_1] = Int_Loc_3; Int_Index_58 = Int_Index_1 + 1; # Int_Index_1 = PHI <Int_Loc_3(0), Int_Index_58(1)>; <L1>:; D.1305_26 = Int_Loc_3 + 1; if (Int_Index_1 <= D.1305_26) goto <L0>; else goto <L2>; <L2>:; and after PRE goto <bb 2> (<L1>); <L0>:; D.1301_54 = pretmp.31_49; D.1302_55 = pretmp.32_45; D.1303_56 = pretmp.33_41; (*D.1303_56)[Int_Index_1] = Int_Loc_3; Int_Index_58 = Int_Index_1 + 1; # Int_Index_1 = PHI <Int_Loc_3(0), Int_Index_58(1)>; <L1>:; D.1305_26 = pretmp.30_19; if (Int_Index_1 <= D.1305_26) goto <L0>; else goto <L2>; <L2>:; -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26944
next prev parent reply other threads:[~2006-05-03 18:55 UTC|newest] Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top 2006-03-30 16:15 [Bug tree-optimization/26944] New: " dann at godzilla dot ics dot uci dot edu 2006-03-30 16:25 ` [Bug tree-optimization/26944] [4.1/4.2 Regression] " rguenth at gcc dot gnu dot org 2006-03-30 16:43 ` dann at godzilla dot ics dot uci dot edu 2006-03-31 22:41 ` Daniel Berlin 2006-03-31 22:41 ` dberlin at dberlin dot org 2006-04-02 8:12 ` pinskia at gcc dot gnu dot org 2006-04-16 19:13 ` mmitchel at gcc dot gnu dot org 2006-05-02 17:38 ` steven at gcc dot gnu dot org 2006-05-03 18:55 ` dann at godzilla dot ics dot uci dot edu [this message] 2006-05-03 19:00 ` Andrew Pinski 2006-05-03 19:00 ` pinskia at physics dot uc dot edu 2006-05-03 21:33 ` steven at gcc dot gnu dot org 2006-05-03 21:53 ` dann at godzilla dot ics dot uci dot edu 2006-05-04 21:25 ` pinskia at gcc dot gnu dot org 2006-05-25 2:39 ` mmitchel at gcc dot gnu dot org 2007-02-14 9:10 ` [Bug tree-optimization/26944] [4.1/4.2/4.3 " mmitchel at gcc dot gnu dot org 2007-06-18 5:28 ` [Bug tree-optimization/26944] [4.1/4.2 " pinskia at gcc dot gnu dot org 2008-07-04 20:22 ` [Bug tree-optimization/26944] [4.2 " jsm28 at gcc dot gnu dot org 2009-03-30 15:51 ` jsm28 at gcc dot gnu dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20060503185448.7086.qmail@sourceware.org \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).