From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 75483384B104; Mon, 20 Apr 2020 12:03:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 75483384B104 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1587384223; bh=aMAPeonpagAjKWogw0+GukU1WLi3enNsI1h4vm/dBcw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ZjWb/4EHzkPBVH02JR3GdpjvcIvxG0SikGkqoeN4sVqHr97lgZ6EPXNI/ZVb0XeSY q4QF3yoDfBQm96cB4nuhGQNt/pXK84U9uwClu3eSb/6+3g9alONvyMCQabjdFQgIra 9sgkMZ8cFilx26DJvGJQJNtwzs2rNvmAzFZTsP9Q= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/57359] store motion causes wrong code for union access at -O3 Date: Mon, 20 Apr 2020 12:03:43 +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: 4.9.0 X-Bugzilla-Keywords: alias, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth 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: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Apr 2020 12:03:43 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D57359 --- Comment #24 from Richard Biener --- (In reply to Richard Biener from comment #22) > Created attachment 48311 [details] > patch >=20 > Note that apart from the possible bad impact on optimization when fixing = this > bug an actual fix is complicated by the custom "optimized" dependence > analysis > code in the loop invariant motion pass. >=20 > A conservative "simple" patch would be the attached but that doesn't pres= erve > store-motion for the following (because the LIM data dependence code does= n't > care about stmt order): >=20 > typedef int A; > typedef float B; >=20 > void __attribute__((noinline,noclone)) > foo(A *p, B *q, long unk) > { > for (long i =3D 0; i < unk; ++i) { > q[i] =3D 42; > *p =3D 1; > } > } >=20 > usually this bug doesn't manifest itself but of course the fix will be > experienced everywhere. Benchmarking the simple patch might reveal > it's not an issue (but I doubt that...). One case like this is gcc.dg/tree-ssa/pr81744.c which fails after the patch because we do not SM the global induction variable update which is already last before exit. Similarly gcc.dg/graphite/pr80906.c and gcc.target/i386/pr64110.c - that's all of the GCC testsuite fallout on x86_= 64.=20 I do not think those regressions are acceptable on its own but I'll throw the patch on SPEC CPU 2006 to get more data (I fear even a solution preserving the cited regressions will regress actual code too much).=