| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-skip-if "" { ! { i?86-*-* x86_64-*-* } } } */ |
| 3 |
/* { dg-options "-O2 -fdump-tree-optimized" } */ |
| 4 |
|
| 5 |
struct thread_info { int preempt_count; }; |
| 6 |
static inline struct thread_info *current_thread_info(void) |
| 7 |
{ |
| 8 |
register struct thread_info *sp asm("esp"); |
| 9 |
return sp; |
| 10 |
} |
| 11 |
void testcase(void) |
| 12 |
{ |
| 13 |
current_thread_info()->preempt_count += 1; |
| 14 |
} |
| 15 |
|
| 16 |
/* We have to make sure that alias analysis treats sp as pointing |
| 17 |
to globals and thus the store not optimized away. */ |
| 18 |
|
| 19 |
/* { dg-final { scan-tree-dump "->preempt_count =" "optimized" } } */ |