2018-01-26 Jakub Jelinek <jakub@redhat.com>
+ PR rtl-optimization/83985
+ * dce.c (deletable_insn_p): Return false for separate shrink wrapping
+ REG_CFA_RESTORE insns.
+ (delete_unmarked_insns): Don't ignore separate shrink wrapping
+ REG_CFA_RESTORE insns here.
+
PR c/83989
* gimple-ssa-warn-restrict.c (builtin_memref::builtin_memref): Don't
use SSA_NAME_VAR as base for SSA_NAMEs with non-NULL SSA_NAME_VAR.
&& REGNO (pic_offset_table_rtx) >= FIRST_PSEUDO_REGISTER)
return false;
+ /* Callee-save restores are needed. */
+ if (RTX_FRAME_RELATED_P (insn)
+ && crtl->shrink_wrapped_separate
+ && find_reg_note (insn, REG_CFA_RESTORE, NULL))
+ return false;
+
body = PATTERN (insn);
switch (GET_CODE (body))
{
if (!dbg_cnt (dce))
continue;
- if (crtl->shrink_wrapped_separate
- && find_reg_note (insn, REG_CFA_RESTORE, NULL))
- {
- if (dump_file)
- fprintf (dump_file, "DCE: NOT deleting insn %d, it's a "
- "callee-save restore\n", INSN_UID (insn));
- continue;
- }
-
if (dump_file)
fprintf (dump_file, "DCE: Deleting insn %d\n", INSN_UID (insn));
2018-01-26 Jakub Jelinek <jakub@redhat.com>
+ PR rtl-optimization/83985
+ * gcc.dg/pr83985.c: New test.
+
PR c/83989
* c-c++-common/Wrestrict-3.c: New test.
--- /dev/null
+/* PR rtl-optimization/83985 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-additional-options "-mcpu=e300c3 -mtune=e300c3" { target { powerpc*-*-* && ilp32 } } } */
+
+long long int v;
+
+void
+foo (int x)
+{
+ if (x == 0)
+ return;
+
+ while (v < 2)
+ {
+ signed char *a;
+ v /= x;
+ a = v == 0 ? (signed char *) &x : (signed char *) &v;
+ ++*a;
+ ++v;
+ }
+
+ while (1)
+ ;
+}