From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9B8B4385840A; Mon, 24 Oct 2022 07:48:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9B8B4385840A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666597694; bh=/ZS+njNamh7AvPjaNgW7F5QQiRU8GTJkpQzch+7NH/g=; h=From:To:Subject:Date:From; b=WzvYTvO/eWKtmN1flI/h5DAP8qGW9BhIANBK8jIh8VUJs86CQ4LXt++oRp10XQfDB uBiZ8eKzAYzg2R2wH2Y6s/FRo/M2M0P5ZzwANAspGMKgrzmlsE89l3vg/IAHgOTr1Z rcDaxe4CnFVrnyD1W7HmmpWeFzKpRniy2/bMITM4= From: "krebbel at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107372] New: Loop distribution create memcpy between structs with different storage order Date: Mon, 24 Oct 2022 07:48:12 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: krebbel at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107372 Bug ID: 107372 Summary: Loop distribution create memcpy between structs with different storage order Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: krebbel at gcc dot gnu.org Target Milestone: --- For t.c with "gcc -O3 t.c": struct L { unsigned int val[256]; } __attribute__((scalar_storage_order ("little-endian"))); struct B { unsigned int val[256]; } __attribute__((scalar_storage_order ("big-endian"))); void foo (struct L *restrict l, struct B *restrict b) { int i; for (i =3D 0; i < 256; i++) l->val[i] =3D b->val[i]; } The loop distribution pass currently generates a memcpy although it recogni= zes correctly that both sides of the assignment have different storage order: Analyzing # of iterations of loop 1 exit condition [255, + , 4294967295] !=3D 0 bounds on difference of bases: -255 ... -255 result: # of iterations 255, bounded by 255 Creating dr for *b_5(D).val[i_11] analyze_innermost: t.c:16:23: missed: failed: reverse storage order. ... void foo (struct L * restrict l, struct B * restrict b) { int i; [local count: 10737416]: __builtin_memcpy (l_6(D), b_5(D), 1024); return; }=