From 7a82f3154b88b79beab2e435bd6f6c7443383fb2 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Mon, 7 Nov 2011 12:38:05 +0100 Subject: [PATCH] fix arch_dep for mul(x,0) --- ir/ir/irarch.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ir/ir/irarch.c b/ir/ir/irarch.c index 7b30379d4..2adbc2ba0 100644 --- a/ir/ir/irarch.c +++ b/ir/ir/irarch.c @@ -572,13 +572,13 @@ ir_node *arch_dep_replace_mul_with_shifts(ir_node *irn) ir_tarval *tv; const ir_settings_arch_dep_t *params = be_get_backend_param()->dep_param; - /* If the architecture dependent optimizations were not initialized or this optimization was not enabled. */ if (params == NULL || (opts & arch_dep_mul_to_shift) == 0) - return irn; + return res; - if (!is_Mul(irn) || !mode_is_int(mode)) + assert(is_Mul(irn)); + if (!mode_is_int(mode)) return res; /* we should never do the reverse transformations again @@ -600,6 +600,11 @@ ir_node *arch_dep_replace_mul_with_shifts(ir_node *irn) operand = left; } + /* multiplications with 0 are a special case which we leave for + * equivalent_node_Mul because the code here can't handle them */ + if (tv == get_mode_null(mode)) + return res; + if (tv != NULL) { res = do_decomposition(irn, operand, tv); -- 2.20.1