aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2023-08-10 09:22:03 +0200
committerJakub Jelinek <jakub@redhat.com>2023-08-10 09:22:03 +0200
commitb129d6b5f5f13995d57d677afcb3e94d0d9c327f (patch)
treef76640eb69153f17fbcbc3a67c884ca0124171ff /gcc
parent0c563a935c47e507ad97e15860ac017c14877b31 (diff)
downloadgcc-b129d6b5f5f13995d57d677afcb3e94d0d9c327f.zip
gcc-b129d6b5f5f13995d57d677afcb3e94d0d9c327f.tar.gz
gcc-b129d6b5f5f13995d57d677afcb3e94d0d9c327f.tar.bz2
expr: Small optimization [PR102989]
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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/expr.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/gcc/expr.cc b/gcc/expr.cc
index 174f8ac..9a37bff 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;
}