Message ID | 3e892c8c892b5c25be867658e16fc59b485bf07a.1508322746.git.segher@kernel.crashing.org |
---|---|
State | New |
Headers | show |
Series | ira: volatile asm's are not moveable (PR82602) | expand |
On 10/18/2017 06:48 AM, Segher Boessenkool wrote: > A volatile asm statement can not be moved (relative to other volatile > asm, etc.), but IRA could do it nevertheless. This patch fixes it. > > Testing on powerpc64-linux {-m32,-m64}; okay if it succeeds? Also > for backports? > Although I am not an author of this code, the patch looks ok for me. ASM_OPERANDS with volatile memory creates a barrier. I guess still a few such cases are missed for rtx_moveable_p. The reference for such cases should be function sched_deps.c::sched_analyze. You can commit it to the trunk and backport. It should be safe. Segher, thank you for working on the PR. > > > 2017-10-18 Segher Boessenkool <segher@kernel.crashing.org> > > PR rtl-optimization/82602 > * ira.c (rtx_moveable_p): Return false for volatile asm. > > --- > gcc/ira.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/gcc/ira.c b/gcc/ira.c > index 046ce3b..8c93d3d 100644 > --- a/gcc/ira.c > +++ b/gcc/ira.c > @@ -4400,6 +4400,12 @@ rtx_moveable_p (rtx *loc, enum op_type type) > for a reason. */ > return false; > > + case ASM_OPERANDS: > + /* The same is true for volatile asm: it has unknown side effects, it > + cannot be moved at will. */ > + if (MEM_VOLATILE_P (x)) > + return false; > + > default: > break; > }
diff --git a/gcc/ira.c b/gcc/ira.c index 046ce3b..8c93d3d 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -4400,6 +4400,12 @@ rtx_moveable_p (rtx *loc, enum op_type type) for a reason. */ return false; + case ASM_OPERANDS: + /* The same is true for volatile asm: it has unknown side effects, it + cannot be moved at will. */ + if (MEM_VOLATILE_P (x)) + return false; + default: break; }