From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29110 invoked by alias); 29 Apr 2008 09:56:43 -0000 Received: (qmail 27748 invoked by uid 48); 29 Apr 2008 09:55:59 -0000 Date: Tue, 29 Apr 2008 09:56:00 -0000 Message-ID: <20080429095559.27747.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug tree-optimization/32120] missed PRE/FRE of a*2+4 and (a+2)*2 In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "rguenth at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-04/txt/msg02045.txt.bz2 ------- Comment #5 from rguenth at gcc dot gnu dot org 2008-04-29 09:55 ------- For the testcase in comment #4 after FRE we have c_2 = a_1(D) + 4; d_3 = c_2 * 2; e_4 = a_1(D) * 2; f_5 = e_4 + 4; D.1557_6 = f_5 + d_3; return D.1557_6; And a patched reassoc pass then produces c_2 = a_1(D) + a_1(D); D.1565_8 = c_2 + 4; D.1565_9 = D.1565_8 * 2; D.1557_6 = 4 + D.1565_9; return D.1557_6; which is ((a + a) + 4) * 2 + 4. The original testcase gets optimized to return (a + 2) * 2 == a * 2 + 4; which makes this bug related to PR15255 which is about missing foldings. tree-ssa-reassoc should also transform (a + C1) * C2 to a * 2 + C3. -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- BugsThisDependsOn| |15255 AssignedTo|unassigned at gcc dot gnu |rguenth at gcc dot gnu dot |dot org |org Status|NEW |ASSIGNED Last reconfirmed|2007-05-28 10:27:18 |2008-04-29 09:55:58 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32120