1/* Verify that IPA-CP can clone mark_cell without miscompiling it despite its 2 type_attributes. */ 3/* { dg-do run } */ 4/* { dg-options "-O3 -fdump-ipa-cp" } */ 5 6 7struct PMC { 8 unsigned flags; 9}; 10 11typedef struct Pcc_cell 12{ 13 struct PMC *p; 14 long bla; 15 long type; 16} Pcc_cell; 17 18int gi; 19 20extern void abort (); 21extern void never_ever(int * interp, struct PMC *pmc) 22 __attribute__((noinline)); 23 24void never_ever (int * interp, struct PMC *pmc) 25{ 26 abort (); 27} 28 29static void mark_cell(int * interp, Pcc_cell *c) 30 __attribute__((__nonnull__(1))) 31 __attribute__((noinline)); 32 33static void 34mark_cell(int * interp, Pcc_cell *c) 35{ 36 if (c && c->type == 4 && c->p 37 && !(c->p->flags & (1<<14))) 38 never_ever(interp, c->p); 39} 40 41static void foo(int * interp, Pcc_cell *c) 42 __attribute__((noinline)); 43 44static void 45foo(int * interp, Pcc_cell *c) 46{ 47 mark_cell(interp, c); 48} 49 50static struct Pcc_cell * 51__attribute__((noinline,noclone)) 52getnull(void) 53{ 54 return (struct Pcc_cell *) 0; 55} 56 57 58int main() 59{ 60 int i; 61 62 for (i = 0; i < 100; i++) 63 foo (&gi, getnull ()); 64 return 0; 65} 66 67 68/* { dg-final { scan-ipa-dump "Creating a specialized node of mark_cell" "cp" } } */ 69/* { dg-final { cleanup-ipa-dump "cp" } } */ 70 71