re PR rtl-optimization/87761 ([MIPS] New FAIL: gcc.target/mips/fix-r4000-10.c ...
authorJeff Law <law@redhat.com>
Tue, 26 Feb 2019 17:08:06 +0000 (10:08 -0700)
committerJeff Law <law@gcc.gnu.org>
Tue, 26 Feb 2019 17:08:06 +0000 (10:08 -0700)
PR rtl-optimization/87761
* regcprop.c (copyprop_hardreg_forward_1): Use REG_UNUSED notes to
detect obviously dead insns and delete them.

From-SVN: r269218

gcc/ChangeLog
gcc/regcprop.c

index c4260affdf7fc2961a04564510e8659160c65443..92a90bcfa69e08d4780232d28355d50054106e48 100644 (file)
@@ -1,3 +1,9 @@
+2019-02-26  Jeff Law  <law@redhat.com>
+
+       PR rtl-optimization/87761
+       * regcprop.c (copyprop_hardreg_forward_1): Use REG_UNUSED notes to
+       detect obviously dead insns and delete them.
+
 2019-02-26  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/89505
index e6bdeb07d8fc1960038318ee66aecca68b3120d1..926df40f954fb840b3b0c004b91a022dc606d383 100644 (file)
@@ -798,6 +798,22 @@ copyprop_hardreg_forward_1 (basic_block bb, struct value_data *vd)
            }
        }
 
+      /* Detect obviously dead sets (via REG_UNUSED notes) and remove them.  */
+      if (set
+         && INSN_P (insn)
+         && !may_trap_p (insn)
+         && find_reg_note (insn, REG_UNUSED, SET_DEST (set))
+         && !side_effects_p (SET_SRC (set))
+         && !side_effects_p (SET_DEST (set)))
+       {
+         bool last = insn == BB_END (bb);
+         delete_insn (insn);
+         if (last)
+           break;
+         continue;
+       }
+        
+
       extract_constrain_insn (insn);
       preprocess_constraints (insn);
       const operand_alternative *op_alt = which_op_alt ();