summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorElias Aebi <elias.aebi@student.kit.edu>2018-05-16 10:36:57 +0200
committerJohannes Bucher <johannes.bucher2@student.kit.edu>2019-01-31 10:18:43 +0100
commitd73b1ec83c6ae78480bf3ef3a8fa968d1321c292 (patch)
treeb4d205b387395d17713db2a5d515858d1f3e64dc
parent5fda609f50bd2dc888242b9261b96faef3e742d8 (diff)
only optimize confirm nodes in case of no overflow
-rw-r--r--ir/opt/iropt.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/ir/opt/iropt.c b/ir/opt/iropt.c
index a5f1930..3b28860 100644
--- a/ir/opt/iropt.c
+++ b/ir/opt/iropt.c
@@ -3062,14 +3062,17 @@ static ir_node *transform_node_Add(ir_node *n)
if (is_Const(b)) {
if (is_Confirm(a)) {
- const ir_node *bound = get_Confirm_bound(a);
+ const ir_node *bound = get_Confirm_bound(a);
ir_tarval *tbound = value_of(bound);
+ ir_relation rel = get_Confirm_relation(a);
+ ir_tarval *tb = get_Const_tarval(b);
+ ir_tarval *max = get_mode_max(mode);
- if (get_Confirm_relation(a) == ir_relation_less_equal && tarval_is_constant(tbound)) {
- ir_tarval *tb = get_Const_tarval(b);
+ if (rel == ir_relation_less_equal && tarval_is_constant(tbound)
+ && tarval_cmp(tbound, tarval_sub(max, tb)) == ir_relation_less) {
ir_tarval *tv = tarval_add(tbound, tb);
if (tarval_is_constant(tv)) {
- ir_node *value = get_Confirm_value(a);
+ ir_node *value = get_Confirm_value(a);
dbg_info *dbgi = get_irn_dbg_info(n);
ir_graph *irg = get_irn_irg(n);
ir_node *block = get_nodes_block(n);