From: Jakub Jelinek Date: Thu, 10 Aug 2023 07:22:03 +0000 (+0200) Subject: expr: Small optimization [PR102989] X-Git-Tag: basepoints/gcc-15~7020 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b129d6b5f5f13995d57d677afcb3e94d0d9c327f;p=thirdparty%2Fgcc.git expr: Small optimization [PR102989] Small optimization to avoid testing modifier multiple times. 2023-08-10 Jakub Jelinek PR c/102989 * expr.cc (expand_expr_real_1) : Add an early return for EXPAND_WRITE or EXPAND_MEMORY modifiers to avoid testing it multiple times. --- diff --git a/gcc/expr.cc b/gcc/expr.cc index 174f8acb269a..9a37bff1fdd3 100644 --- a/gcc/expr.cc +++ b/gcc/expr.cc @@ -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; }