From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id F10F03858D32; Fri, 17 Nov 2023 13:39:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F10F03858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1700228389; bh=F7bxZgsMe1Zs0BY35WsnbVZEjEv7H6nMCHEgjhpnGBk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=LnSVk1iw4BbsBXOWn+31yk6079REgXgL+jUsF8nP+53lLfF2hdMVyTbtvqZMYV2uq bzizywmtVoWYYz10xpc2pxvXz3gSiYg69IfF+jhoLDStdiWmqR8SF2fcQC3RV8GCAy 3k5ZhpqAXbxPU3goY0tKOASfqCve1JN3soM7y1hc= From: "ubizjak at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/111657] Memory copy with structure assignment from named address space should be improved Date: Fri, 17 Nov 2023 13:39:49 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 12.3.1 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: ubizjak at gmail dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: ubizjak at gmail dot com X-Bugzilla-Target-Milestone: 14.0 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111657 --- Comment #9 from Uro=C5=A1 Bizjak --- (In reply to Jakub Jelinek from comment #8) > I'd say it is a user error to invoke memcpy/memset etc. with pointers to > non-default address spaces, and for aggregate copies the middle-end should > ensure that the copying is not done using library calls; is that the case > and the problem was just that optab expansion was allowed for the structu= re > copies and the backend decided to use libcall in that case? Yes, the stringop selection mechanism chose libcall strategy. However, the = call to memcpy is unavailable for non-default address space, so the middle-end expanded the call into most trivial byte-copy loop. The patch just teaches stringop selection to use optimized copy loop as a last resort with non-def= ault address spaces instead.=