[Bug middle-end/101326] std::optional returns forced through stack
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101326 --- Comment #7 from Andrew Pinski --- *** This bug has been marked as a duplicate of bug 95384 ***
[Bug middle-end/101326] std::optional returns forced through stack
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101326 Andrew Pinski changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |DUPLICATE --- Comment #6 from Andrew Pinski --- Dup *** This bug has been marked as a duplicate of bug 95405 ***
[Bug middle-end/101326] std::optional returns forced through stack
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101326 Andrew Pinski changed: What|Removed |Added CC||david at westcontrol dot com --- Comment #5 from Andrew Pinski --- *** Bug 109631 has been marked as a duplicate of this bug. ***
[Bug middle-end/101326] std::optional returns forced through stack
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101326 --- Comment #4 from Andrew Pinski --- (In reply to Richard Biener from comment #3) > and yes, if it would have had TImode we could expand it to a register pair > but it has BLKmode because it's TYPE_NEEDS_CONSTRUCTING(?), the type > isn't TREE_ADDRESSABLE for me. Yes TYPE_NEEDS_CONSTRUCTING, I had thought they were the same bit but I am wrong.
[Bug middle-end/101326] std::optional returns forced through stack
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101326
--- Comment #3 from Richard Biener ---
I think the issue is simply that RTL expansion forces the object to memory
since that is what GIMPLE does:
struct optional foo ()
{
struct optional D.12374;
[local count: 1073741824]:
MEM [(struct optional *)&D.12374] = 0;
MEM [(struct optional *)&D.12374 + 8B] = 1;
return D.12374;
}
and yes, if it would have had TImode we could expand it to a register pair
but it has BLKmode because it's TYPE_NEEDS_CONSTRUCTING(?), the type
isn't TREE_ADDRESSABLE for me.
[Bug middle-end/101326] std::optional returns forced through stack
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101326
Andrew Pinski changed:
What|Removed |Added
Last reconfirmed||2021-07-05
Severity|normal |enhancement
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
--- Comment #2 from Andrew Pinski ---
Take:
struct g {
unsigned long b;
};
struct a
{
struct g g1;
unsigned char c;
};
static inline void h(struct g *a)
{
a->b = 0;
}
static inline void j(struct a *a)
{
h(&a->g1);
a->c = 1;
}
struct a f(void)
{
struct a a;
j(&a);
return a;
}
CUT
It works, I suspect in the case of std::optional, std::optional is marked as
BLKmode rather than TImode as the struct is marked as "ADDRESSABLE".
[Bug middle-end/101326] std::optional returns forced through stack
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101326 --- Comment #1 from Tamar Christina --- last example for x86 should have been foo():# @foo() xor eax, eax mov dl, 1 ret
