Message ID | 20141001144642.GU14611@virgil.suse |
---|---|
State | New |
Headers | show |
On October 1, 2014 4:46:42 PM CEST, Martin Jambor <mjambor@suse.cz> wrote: >Hi, > >at the moment, the only check in SRA for volatility is of the DECLs >themselves. As PR 63375 shows, there can be volatile references to a >non-volatile declaration which must not be ignored, otherwise SRA can >loose the volatility of the reference. Since the point of SRA is to >produce unaddressable scalars, I decided to simply ignore aggregates >accessed through volatile references, which is done by the patch >below. > >Note that the patch alone does not fix the PR as we happen to make >some sort of similar mistake later on in the pipeline (see comment 4 >in bugzilla). > >Bootstrapped and tested on x86_64-linux. OK for trunk and for the >maintained release branches after re-testing there? OK. Thanks, Richard. >Thanks, > >Martin > > >2014-09-26 Martin Jambor <mjambor@suse.cz> > > PR tree-optimization/63375 > * tree-sra.c (build_access_from_expr_1): Disqualify volatile > references. > >diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c >index 8259dba..fb24114 100644 >--- a/gcc/tree-sra.c >+++ b/gcc/tree-sra.c >@@ -1064,6 +1064,11 @@ build_access_from_expr_1 (tree expr, gimple >stmt, bool write) > "component."); > return NULL; > } >+ if (TREE_THIS_VOLATILE (expr)) >+ { >+ disqualify_base_of_expr (expr, "part of a volatile reference."); >+ return NULL; >+ } > > switch (TREE_CODE (expr)) > {
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 8259dba..fb24114 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -1064,6 +1064,11 @@ build_access_from_expr_1 (tree expr, gimple stmt, bool write) "component."); return NULL; } + if (TREE_THIS_VOLATILE (expr)) + { + disqualify_base_of_expr (expr, "part of a volatile reference."); + return NULL; + } switch (TREE_CODE (expr)) {