PR rtl-optimization/19348
* recog.c (peephole2_optimize): Do global life update if some peephole
decides it doesn't need at least one of its inputs and that change
influences liveness at the start of the basic block.
* basic-block.h (EXECUTE_IF_AND_COMPL_IN_REG_SET): Needs 2 REGSET
arguments instead of 1.
* gcc.dg/
20050111-1.c: New test.
* gcc.c-torture/execute/
20050111-1.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@93639
138bc75d-0d04-0410-961f-
82ee72b054a4
+2005-01-14 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/19084
+ PR rtl-optimization/19348
+ * recog.c (peephole2_optimize): Do global life update if some peephole
+ decides it doesn't need at least one of its inputs and that change
+ influences liveness at the start of the basic block.
+
+ * basic-block.h (EXECUTE_IF_AND_COMPL_IN_REG_SET): Needs 2 REGSET
+ arguments instead of 1.
+
2005-01-14 Eric Botcazou <ebotcazou@libertysurf.fr>
PR middle-end/18820
/* Loop over all registers in REGSET1 and REGSET2, starting with MIN, setting
REGNUM to the register number and executing CODE for all registers that are
set in the first regset and not set in the second. */
-#define EXECUTE_IF_AND_COMPL_IN_REG_SET(REGSET, MIN, REGNUM, RSI) \
- EXECUTE_IF_AND_COMPL_IN_BITMAP (REGSET, MIN, REGNUM, RSI)
+#define EXECUTE_IF_AND_COMPL_IN_REG_SET(REGSET1, REGSET2, MIN, REGNUM, RSI) \
+ EXECUTE_IF_AND_COMPL_IN_BITMAP (REGSET1, REGSET2, MIN, REGNUM, RSI)
/* Loop over all registers in REGSET1 and REGSET2, starting with MIN, setting
REGNUM to the register number and executing CODE for all registers that are
bool changed;
#endif
bool do_cleanup_cfg = false;
+ bool do_global_life_update = false;
bool do_rebuild_jump_labels = false;
/* Initialize the regsets we're going to use. */
FOR_EACH_BB_REVERSE (bb)
{
struct propagate_block_info *pbi;
+ reg_set_iterator rsi;
+ unsigned int j;
/* Indicate that all slots except the last holds invalid data. */
for (i = 0; i < MAX_INSNS_PER_PEEP2; ++i)
break;
}
+ /* Some peepholes can decide the don't need one or more of their
+ inputs. If this happens, local life update is not enough. */
+ EXECUTE_IF_AND_COMPL_IN_BITMAP (bb->global_live_at_start, live,
+ 0, j, rsi)
+ {
+ do_global_life_update = true;
+ break;
+ }
+
free_propagate_block_info (pbi);
}
if (do_cleanup_cfg)
{
cleanup_cfg (0);
- update_life_info (0, UPDATE_LIFE_GLOBAL_RM_NOTES, PROP_DEATH_NOTES);
+ do_global_life_update = true;
}
+ if (do_global_life_update)
+ update_life_info (0, UPDATE_LIFE_GLOBAL_RM_NOTES, PROP_DEATH_NOTES);
#ifdef HAVE_conditional_execution
else
{
2005-01-14 Jakub Jelinek <jakub@redhat.com>
+ PR middle-end/19084
+ PR rtl-optimization/19348
+ * gcc.dg/20050111-1.c: New test.
+ * gcc.c-torture/execute/20050111-1.c: New test.
+
* gcc.dg/i386-asm-4.c: New test.
2005-01-14 Eric Botcazou <ebotcazou@libertysurf.fr>
--- /dev/null
+/* PR middle-end/19084, rtl-optimization/19348 */
+
+unsigned int
+foo (unsigned long long x)
+{
+ unsigned int u;
+
+ if (x == 0)
+ return 0;
+ u = (unsigned int) (x >> 32);
+ return u;
+}
+
+unsigned long long
+bar (unsigned short x)
+{
+ return (unsigned long long) x << 32;
+}
+
+extern void abort (void);
+
+int
+main (void)
+{
+ if (sizeof (long long) != 8)
+ return 0;
+
+ if (foo (0) != 0)
+ abort ();
+ if (foo (0xffffffffULL) != 0)
+ abort ();
+ if (foo (0x25ff00ff00ULL) != 0x25)
+ abort ();
+ if (bar (0) != 0)
+ abort ();
+ if (bar (0x25) != 0x2500000000ULL)
+ abort ();
+ return 0;
+}
--- /dev/null
+/* PR middle-end/19084, rtl-optimization/19348 */
+/* { dg-do compile } */
+/* The following ensures that this test is compiled with -O2, unless
+ on i?86 or x86_64 with -m32 option. */
+/* { dg-options "-O2" } */
+/* { dg-options "-O2 -march=i686" { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-O2" { target lp64 } } */
+
+unsigned int
+foo (unsigned long long x)
+{
+ unsigned int u;
+
+ if (x == 0)
+ return 0;
+ u = (unsigned int) (x >> 32);
+ return u;
+}
+
+unsigned long long
+bar (unsigned short x)
+{
+ return (unsigned long long) x << 32;
+}