public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "kargl at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/30409] [fortran] missed optimization with pure function arguments Date: Sun, 22 Oct 2023 16:43:52 +0000 [thread overview] Message-ID: <bug-30409-4-xWrlH42q2A@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-30409-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30409 --- Comment #7 from kargl at gcc dot gnu.org --- The attached testcase use xmin and xmax uninitialized. After setting xmin = 0 and xmax = 1 and adding z(1) to the print statements to prevent the inner loop from being optimized away, I see the following: % gfcx -o z -O0 a.f90 && ./z time 1: 1.78299993E-02 7249751.00 time 2: 6.37416887 7249751.00 % gfcx -o z -O1 a.f90 && ./z time 1: 1.37590002E-02 7249751.00 time 2: 6.36764479 7249751.00 % gfcx -o z -O2 a.f90 && ./z time 1: 1.23690004E-02 7249751.00 time 2: 1.85729897 7249751.00 % gfcx -o z -O3 a.f90 && ./z time 1: 2.43199989E-03 7249751.00 time 2: 1.85660207 7249751.00 % gfcx -o z -Ofast a.f90 && ./z time 1: 3.63499997E-03 7249751.50 time 2: 0.621210992 7249751.50 so the timing improves with optimization. -fdump-tree-original still shows the generation of a temporary variable for the actual argument 1/y in the second set of nested loops. -fdump-tree-optimized is fairly difficult for me to decipher, but it appears that the 1/y is not hoisted out of the inner loop.
next prev parent reply other threads:[~2023-10-22 16:43 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-30409-4@http.gcc.gnu.org/bugzilla/> 2010-10-02 8:10 ` tkoenig at gcc dot gnu.org 2023-10-22 16:43 ` kargl at gcc dot gnu.org [this message] 2023-10-22 19:18 ` anlauf at gcc dot gnu.org 2023-10-23 5:50 ` tkoenig at gcc dot gnu.org 2023-10-23 19:23 ` kargl at gcc dot gnu.org 2023-10-23 19:28 ` anlauf at gcc dot gnu.org 2023-10-23 21:45 ` kargl at gcc dot gnu.org 2007-01-08 21:31 [Bug fortran/30409] New: " kargl at gcc dot gnu dot org 2007-01-08 21:32 ` [Bug fortran/30409] " kargl at gcc dot gnu dot org 2007-01-08 21:36 ` kargl at gcc dot gnu dot org 2007-01-09 11:11 ` rguenth at gcc dot gnu dot org 2007-01-09 16:08 ` kargl at gcc dot gnu dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-30409-4-xWrlH42q2A@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).