diff options
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r-- | gcc/simplify-rtx.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index a878048ac97..f59150ee2c1 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -869,6 +869,14 @@ simplify_unary_operation_1 (enum rtx_code code, enum machine_mode mode, rtx op) && COMPARISON_P (op) && (STORE_FLAG_VALUE & ~GET_MODE_MASK (mode)) == 0) return rtl_hooks.gen_lowpart_no_emit (mode, op); + + /* A truncate of a memory is just loading the low part of the memory + if we are not changing the meaning of the address. */ + if (GET_CODE (op) == MEM + && !MEM_VOLATILE_P (op) + && !mode_dependent_address_p (XEXP (op, 0))) + return rtl_hooks.gen_lowpart_no_emit (mode, op); + break; case FLOAT_TRUNCATE: |