cmov with unknowns are pointless
authorMatthias Braun <matze@braunis.de>
Wed, 4 Jul 2007 12:13:51 +0000 (12:13 +0000)
committerMatthias Braun <matze@braunis.de>
Wed, 4 Jul 2007 12:13:51 +0000 (12:13 +0000)
[r14925]

ir/be/ia32/ia32_transform.c

index b48bbbe..584417c 100644 (file)
@@ -1892,6 +1892,20 @@ static ir_node *create_cmov(long pnc, ir_node *cmp_left, ir_node *cmp_right,
        ir_node  *new_cmp_right;
        ir_node  *res;
 
+       /* cmovs with unknowns are pointless... */
+       if(is_Unknown(val_true)) {
+#ifdef DEBUG_libfirm
+               ir_fprintf(stderr, "Optimisation warning: psi with unknown operand\n");
+#endif
+               return new_val_false;
+       }
+       if(is_Unknown(val_false)) {
+#ifdef DEBUG_libfirm
+               ir_fprintf(stderr, "Optimisation warning: psi with unknown operand\n");
+#endif
+               return new_val_true;
+       }
+
        /* can we use a test instruction? */
        if(is_Const_0(cmp_right)) {
                long pure_pnc = pnc & ~ia32_pn_Cmp_Unsigned;