Skip extension on fixed register since we can't turn
(insn 27 26 139 2 (parallel [
(set (reg/f:SI 7 sp)
(plus:SI (reg/f:SI 7 sp)
(const_int 16 [0x10])))
(clobber (reg:CC 17 flags))
]) "x.ii":14:17 discrim 1 283 {*addsi_1}
(expr_list:REG_ARGS_SIZE (const_int 0 [0])
(nil)))
...
(insn 43 125 74 2 (set (reg/f:DI 6 bp [145])
(zero_extend:DI (reg/f:SI 7 sp))) "x.ii":15:9 175 {*zero_extendsidi2}
(nil))
into
(insn 27 26 155 2 (parallel [
(set (reg:DI 6 bp)
(zero_extend:DI (plus:SI (reg/f:SI 7 sp)
(const_int 16 [0x10]))))
(clobber (reg:CC 17 flags))
]) "x.ii":14:17 discrim 1 296 {addsi_1_zext}
(expr_list:REG_ARGS_SIZE (const_int 0 [0])
(nil)))
(insn 155 27 139 2 (set (reg:DI 7 sp)
(reg:DI 6 bp)) "x.ii":14:17 discrim 1 -1
(nil))
without updating stack frame info.
gcc/
PR rtl-optimization/118266
* ree.cc (add_removable_extension): Skip extension on fixed
register.
gcc/testsuite/
PR rtl-optimization/118266
* gcc.target/i386/pr118266.c: New test.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
struct df_link *defs, *def;
ext_cand *cand;
+ if (fixed_regs[REGNO (reg)])
+ {
+ if (dump_file)
+ {
+ fprintf (dump_file, "Cannot eliminate extension:\n");
+ print_rtl_single (dump_file, insn);
+ fprintf (dump_file, " because extension on fixed register"
+ " isn't supported.\n");
+ }
+ return;
+ }
+
/* Zero-extension of an undefined value is partly defined (it's
completely undefined for sign-extension, though). So if there exists
a path from the entry to this zero-extension that leaves this register
--- /dev/null
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-require-effective-target maybe_x32 } */
+/* { dg-require-effective-target fopenacc } */
+/* { dg-options "-O2 -mx32 -fopenacc" } */
+
+typedef struct {
+ int a;
+ int b;
+ int c;
+} mystruct;
+int main_j;
+int
+main()
+{
+ mystruct *m = (mystruct *)__builtin_malloc (2*sizeof (mystruct)), *mref = m;
+#pragma acc enter data copyin(m[1])
+ for (int i; i < 9; i++) {
+#pragma acc parallel
+ for (; main_j;)
+ ;
+#pragma acc parallel loop copy(mref->b, m->c)
+ for (main_j = 0; main_j < 4; main_j++)
+ ;
+ }
+#pragma acc data copyout(m[ : 1])
+ __builtin_free(m);
+}