public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/112414] New: Does gcc need __builtin_assume_separate_storage?
@ 2023-11-06 20:14 unlvsur at live dot com
2023-11-06 20:19 ` [Bug c++/112414] " pinskia at gcc dot gnu.org
2023-11-07 8:42 ` rguenth at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: unlvsur at live dot com @ 2023-11-06 20:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112414
Bug ID: 112414
Summary: Does gcc need __builtin_assume_separate_storage?
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: unlvsur at live dot com
Target Milestone: ---
clang provides a new builtin since clang 17 for
__builtin_assume_separate_storage. Does GCC need it?
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/112414] Does gcc need __builtin_assume_separate_storage?
2023-11-06 20:14 [Bug c++/112414] New: Does gcc need __builtin_assume_separate_storage? unlvsur at live dot com
@ 2023-11-06 20:19 ` pinskia at gcc dot gnu.org
2023-11-07 8:42 ` rguenth at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-06 20:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112414
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/112414] Does gcc need __builtin_assume_separate_storage?
2023-11-06 20:14 [Bug c++/112414] New: Does gcc need __builtin_assume_separate_storage? unlvsur at live dot com
2023-11-06 20:19 ` [Bug c++/112414] " pinskia at gcc dot gnu.org
@ 2023-11-07 8:42 ` rguenth at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-11-07 8:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112414
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rguenth at gcc dot gnu.org
Resolution|--- |WONTFIX
Status|UNCONFIRMED |RESOLVED
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
__builtin_assume_separate_storage
__builtin_assume_separate_storage is used to provide the optimizer with the
knowledge that its two arguments point to separately allocated objects.
Syntax:
__builtin_assume_separate_storage(const volatile void *, const volatile void *)
Example of Use:
int foo(int *x, int *y) {
__builtin_assume_separate_storage(x, y);
*x = 0;
*y = 1;
// The optimizer may optimize this to return 0 without reloading from *x.
return *x;
}
Description:
The arguments to this function are assumed to point into separately allocated
storage (either different variable definitions or different dynamic storage
allocations). The optimizer may use this fact to aid in alias analysis. If the
arguments point into the same storage, the behavior is undefined. Note that the
definition of “storage” here refers to the outermost enclosing allocation of
any particular object (so for example, it’s never correct to call this function
passing the addresses of fields in the same struct, elements of the same array,
etc.).
Query for this feature with __has_builtin(__builtin_assume_separate_storage).
---
The given syntax makes it very unuseful given there's no data dependence
involved. I assume it is supposed to work like
typeof (x) __restrict xr = x;
typeof (y) __restrict yr = y;
*xr = 0;
*yr = 1;
not sure why clang folks thought a new builtin is a great idea. Even this
restrict form is more useful (but there's reasons we don't support that
either).
So no, RESOLVED BADFEATURE.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-11-07 8:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-06 20:14 [Bug c++/112414] New: Does gcc need __builtin_assume_separate_storage? unlvsur at live dot com
2023-11-06 20:19 ` [Bug c++/112414] " pinskia at gcc dot gnu.org
2023-11-07 8:42 ` rguenth at gcc dot gnu.org
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).