]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
expr: Small optimization [PR102989]
authorJakub Jelinek <jakub@redhat.com>
Thu, 10 Aug 2023 07:22:03 +0000 (09:22 +0200)
committerJakub Jelinek <jakub@redhat.com>
Thu, 10 Aug 2023 07:22:03 +0000 (09:22 +0200)
Small optimization to avoid testing modifier multiple times.

2023-08-10  Jakub Jelinek  <jakub@redhat.com>

PR c/102989
* expr.cc (expand_expr_real_1) <case MEM_REF>: Add an early return for
EXPAND_WRITE or EXPAND_MEMORY modifiers to avoid testing it multiple
times.

gcc/expr.cc

index 174f8acb269ab5450fc799516471d5a2bd9b9efa..9a37bff1fdd3d8fd30d50f70327c9329a25f7933 100644 (file)
@@ -11248,17 +11248,15 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode,
        set_mem_addr_space (temp, as);
        if (TREE_THIS_VOLATILE (exp))
          MEM_VOLATILE_P (temp) = 1;
-       if (modifier != EXPAND_WRITE
-           && modifier != EXPAND_MEMORY
-           && !inner_reference_p
+       if (modifier == EXPAND_WRITE || modifier == EXPAND_MEMORY)
+         return temp;
+       if (!inner_reference_p
            && mode != BLKmode
            && align < GET_MODE_ALIGNMENT (mode))
          temp = expand_misaligned_mem_ref (temp, mode, unsignedp, align,
                                            modifier == EXPAND_STACK_PARM
                                            ? NULL_RTX : target, alt_rtl);
-       if (reverse
-           && modifier != EXPAND_MEMORY
-           && modifier != EXPAND_WRITE)
+       if (reverse)
          temp = flip_storage_order (mode, temp);
        return temp;
       }