do_binop:
op0 = mem_loc_descriptor (XEXP (rtl, 0), mode, mem_mode,
VAR_INIT_STATUS_INITIALIZED);
+ if (XEXP (rtl, 0) == XEXP (rtl, 1))
+ {
+ if (op0 == 0)
+ break;
+ mem_loc_result = op0;
+ add_loc_descr (&mem_loc_result, new_loc_descr (DW_OP_dup, 0, 0));
+ add_loc_descr (&mem_loc_result, new_loc_descr (op, 0, 0));
+ break;
+ }
op1 = mem_loc_descriptor (XEXP (rtl, 1), mode, mem_mode,
VAR_INIT_STATUS_INITIALIZED);
inside a MEM than outside. */
unsigned int mem_depth = 0;
+ /* Tracks number of simplify_associative_operation calls performed during
+ outermost simplify* call. */
+ unsigned int assoc_count = 0;
+
+ /* Limit for the above number, return NULL from
+ simplify_associative_operation after we reach that assoc_count. */
+ static const unsigned int max_assoc_count = 64;
+
private:
rtx simplify_truncation (machine_mode, rtx, machine_mode);
rtx simplify_byte_swapping_operation (rtx_code, machine_mode, rtx, rtx);
{
rtx tem;
+ /* Normally expressions simplified by simplify-rtx.c are combined
+ at most from a few machine instructions and therefore the
+ expressions should be fairly small. During var-tracking
+ we can see arbitrarily large expressions though and reassociating
+ those can be quadratic, so punt after encountering max_assoc_count
+ simplify_associative_operation calls during outermost simplify_*
+ call. */
+ if (++assoc_count >= max_assoc_count)
+ return NULL_RTX;
+
/* Linearize the operator to the left. */
if (GET_CODE (op1) == code)
{
--- /dev/null
+/* PR rtl-optimization/102356 */
+/* { dg-do compile { target int32plus } } */
+/* { dg-options "-O3 -g" } */
+
+signed char a = 0;
+unsigned char b = 9;
+unsigned long long c = 0xF1FBFC17225F7A57ULL;
+int d = 0x3A6667C6;
+
+unsigned char
+foo (unsigned int x)
+{
+ unsigned int *e = &x;
+ if ((c /= ((0 * (*e *= b)) <= 0)))
+ ;
+ for (d = 9; d > 2; d -= 2)
+ {
+ c = -2;
+ do
+ if ((*e *= *e))
+ {
+ a = 4;
+ do
+ {
+ a -= 3;
+ if ((*e *= *e))
+ b = 9;
+ }
+ while (a > 2);
+ }
+ while (c++);
+ }
+}