https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92497
Bug ID: 92497
Summary: Aggregate IPA-CP and inlining do not play well
together, transformation is lost
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ipa
Assignee: unassigned at gcc dot gnu.org
Reporter: jamborm at gcc dot gnu.org
CC: hubicka at gcc dot gnu.org, marxin at gcc dot gnu.org
Target Milestone: ---
The following breaks when compiled with -O2 -fno-early-inlining:
/* { dg-do run } */
/* { dg-options "-O2 -fno-early-inlining" } */
struct a {int a;};
static int //__attribute__ ((noinline))
foo (struct a a)
{
if (!__builtin_constant_p (a.a))
__builtin_abort ();
return a.a;
}
static int __attribute__ ((noinline))
bar (struct a a)
{
return foo(a);
}
int main()
{
struct a a={1};
return bar (a);
}
This happens because we do not apply IPA-CP transformation on foo
before we inline it to bar.
See also the thread beginning with:
https://gcc.gnu.org/ml/gcc-patches/2019-11/msg00891.html