From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23922 invoked by alias); 19 Nov 2014 09:35:57 -0000 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 Received: (qmail 23869 invoked by uid 48); 19 Nov 2014 09:35:53 -0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/63677] Failure to constant fold with vectorization. Date: Wed, 19 Nov 2014 09:35:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-11/txt/msg01812.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63677 --- Comment #5 from Richard Biener --- With the patch from PR63864 we still don't optimize: : vect_cst_.12_23 = { 0, 1, 2, 3 }; vect_cst_.11_32 = { 4, 5, 6, 7 }; vectp.14_2 = &a[0]; MEM[(int *)&a] = { 0, 1, 2, 3 }; vectp.14_21 = &a[0] + 16; MEM[(int *)vectp.14_21] = { 4, 5, 6, 7 }; vectp_a.5_22 = &a; vect__13.6_20 = MEM[(int *)&a]; this is because while seeing the candidate MEM[(int *)&a] = { 0, 1, 2, 3 }; for the load vect__13.6_20 = MEM[(int *)&a]; we fail to disambiguate against the store to MEM[(int *)vectp.14_21] which is not simplified to MEM[&a, 16] = { 4, 5, 6, 7 }; because DOM does not have the "trick" of representing invariant-ptr + CST as &MEM[&..., CST'] for propagation. If I fix that (huh, not sure why we don't simply fold the pointer-plus that way, now four places do that trick for propagation...) then it works: LKUP STMT vect__13.6_20 = MEM[(int *)&a] vect__13.6_20 = MEM[(int *)&a]; FIND: { 0, 1, 2, 3 } Replaced redundant expr 'MEM[(int *)&a]' with '{ 0, 1, 2, 3 }' t.c.183t.optimized: foo () { : return 28; }