projects
/
libfirm
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
63ad747
)
fix backend Cond/Cmp flag optimization failing for unoptimized code
author
Matthias Braun
<matthias.braun@kit.edu>
Thu, 1 Mar 2012 15:01:09 +0000
(16:01 +0100)
committer
Matthias Braun
<matthias.braun@kit.edu>
Thu, 1 Mar 2012 15:02:00 +0000
(16:02 +0100)
ir/be/ia32/ia32_transform.c
patch
|
blob
|
history
diff --git
a/ir/be/ia32/ia32_transform.c
b/ir/be/ia32/ia32_transform.c
index
0b15ad7
..
e3d86b5
100644
(file)
--- a/
ir/be/ia32/ia32_transform.c
+++ b/
ir/be/ia32/ia32_transform.c
@@
-2110,13
+2110,16
@@
static ir_node *get_flags_node(ir_node *cmp, ia32_condition_code_t *cc_out)
}
}
}
}
- /* the middle-end tries to eliminate impossible relations, so a ptr
!=
0
+ /* the middle-end tries to eliminate impossible relations, so a ptr
<>
0
* test becomes ptr > 0. But for x86 an equal comparison is preferable to
* a >0 (we can sometimes eliminate the cmp in favor of flags produced by
* test becomes ptr > 0. But for x86 an equal comparison is preferable to
* a >0 (we can sometimes eliminate the cmp in favor of flags produced by
- * a predecessor node). So add the < bit */
+ * a predecessor node). So add the < bit.
+ * (Note that we do not want to produce <=> (which can happen for
+ * unoptimized code), because no x86 flag can represent that */
possible = ir_get_possible_cmp_relations(l, r);
possible = ir_get_possible_cmp_relations(l, r);
- if (((relation & ir_relation_less) && !(possible & ir_relation_greater))
- || ((relation & ir_relation_greater) && !(possible & ir_relation_less)))
+ if (!(relation & ir_relation_equal) &&
+ ( ((relation & ir_relation_less) && !(possible & ir_relation_greater))
+ || ((relation & ir_relation_greater) && !(possible & ir_relation_less))))
relation |= ir_relation_less_greater;
overflow_possible = true;
relation |= ir_relation_less_greater;
overflow_possible = true;