From c5b58c80868897d6e7fb7f83f31608c309ebcf74 Mon Sep 17 00:00:00 2001 From: Manuel Mohr Date: Wed, 24 Aug 2011 14:51:58 +0200 Subject: [PATCH] Added dw_lower special case to handle Calls whose result is never used. --- ir/lower/lower_dw.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ir/lower/lower_dw.c b/ir/lower/lower_dw.c index 76966b87e..6f657f47d 100644 --- a/ir/lower/lower_dw.c +++ b/ir/lower/lower_dw.c @@ -284,6 +284,27 @@ static void prepare_links(ir_node *node) env->flags |= MUST_BE_LOWERED; } return; + } else if (is_Call(node)) { + /* Special case: If the result of the Call is never used, we won't + * find a Proj with a mode that potentially triggers MUST_BE_LOWERED + * to be set. Thus, if we see a call, we check its result types and + * decide whether MUST_BE_LOWERED has to be set. + */ + ir_type *tp = get_Call_type(node); + size_t n_res, i; + + n_res = get_method_n_ress(tp); + for (i = 0; i < n_res; ++i) { + ir_type *rtp = get_method_res_type(tp, i); + + if (is_Primitive_type(rtp)) { + ir_mode *rmode = get_type_mode(rtp); + + if (rmode == env->high_signed || rmode == env->high_unsigned) { + env->flags |= MUST_BE_LOWERED; + } + } + } } } -- 2.20.1