From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7FBEC3870872; Sat, 20 Jun 2020 14:33:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7FBEC3870872 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1592663603; bh=v4augI2m2vLT4SPOgriZbJaZ/lbNI0ghCT5rlhFAFaw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=YJtGjKOmeC5zdPpTjENx7V7fPV2FJXq96NyRn6dFd7nWooH4EH/SiwnNWMIPzC1AT rsC5prUVLSDBwMWDlVdfdRpNaNJX9WpYGeNeZKSB+BKzUijOEnPrVMA0MRPaSII8qA yd6WM4SED4NEgiB+MkfsqzCu2Q8q1/LRbjiOXT0M= From: "gabravier at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/95784] Failure to optimize usage of __builtin_add_overflow with return statement properly Date: Sat, 20 Jun 2020 14:33:23 +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: 11.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: gabravier at gmail dot com 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: attachments.created 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: Sat, 20 Jun 2020 14:33:23 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95784 --- Comment #6 from Gabriel Ravier --- Created attachment 48761 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D48761&action=3Dedit File for benchmarking this function but everything is aligned properly. I've changed the source file slightly, it looks like the LLVM version was faster than the "do nothing" version because the loop was misaligned. This = is the test results I get with the version with aligned loops (I've also adjus= ted the amount of iterations) : $ gcc test.S -O3 -ggdb3 -DGCC_VERSION && time ./a.out && gcc test.S -O3 -gg= db3 -DLLVM_VERSION && time ./a.out && gcc test.S -O3 -ggdb3 && time ./a.out real 0m3.130s # GCC version user 0m3.122s sys 0m0.001s real 0m2.599s # LLVM version user 0m2.593s sys 0m0.001s real 0m2.597s # version that does nothing user 0m2.591s sys 0m0.000s I can now note that the LLVM version is now almost as fast as literally doi= ng nothing, so now it looks really much better than the GCC version, at least = to me.=