public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug d/94496] New: [D] Use aggressive optimizations in release mode
@ 2020-04-06  8:59 ibuclaw at gdcproject dot org
  2020-05-14  0:03 ` [Bug d/94496] " witold.baryluk+gcc at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: ibuclaw at gdcproject dot org @ 2020-04-06  8:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94496

            Bug ID: 94496
           Summary: [D] Use aggressive optimizations in release mode
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: d
          Assignee: ibuclaw at gdcproject dot org
          Reporter: ibuclaw at gdcproject dot org
  Target Milestone: ---

There are a number of attributes in D that on the surface may seem like a good
fit for producing better optimisations, but there's always an escape latch, or
a latent issue that means none of these actually work in practice, for example:

- 'nothrow' code allows throwing Errors.
- 'pure' code allows modifying context state, what's called weakly pure.
- 'in' parameters are documented as const and no escape, but only the const
part was ever enforced.

So to avoid breaking code in ways that are not always immediately obvious,
nothing is really enforced.

When compiling release code however (-frelease), all considerations done to not
break runtime could be thrown out the window.  To take the first example, in
the event of throwing in a 'nothrow' function in release mode, crashing the
run-time at the point of throw is a perfectly valid thing to do, as Errors are
not meant to be caught.

Some of these optimizations could include (repeating some in the list above):

- 'nothrow' attribute sets TREE_NOTHROW
- 'pure' (strongly pure) attribute sets DECL_PURE_P or...
- ...function calls determined to be free of side effects set ECF_PURE if
DECL_PURE_P turns out to be problematic.
- 'const scope' parameters sets (EAF_NOCLOBBER | EAF_NOESCAPE)
- 'asm pure' unsets ASM_VOLATILE_P
- Enable strict aliasing for dynamic arrays.
- 'return' parameters set ERF_RETURNS_ARG.

More may come to mind later.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-05-15 12:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-06  8:59 [Bug d/94496] New: [D] Use aggressive optimizations in release mode ibuclaw at gdcproject dot org
2020-05-14  0:03 ` [Bug d/94496] " witold.baryluk+gcc at gmail dot com
2020-05-14  5:51 ` ibuclaw at gdcproject dot org
2020-05-15 12:22 ` witold.baryluk+gcc at gmail dot com

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).