Fix folding logic for conditions.
authorDale Weiler <killfieldengine@gmail.com>
Thu, 29 Aug 2013 04:18:48 +0000 (00:18 -0400)
committerDale Weiler <killfieldengine@gmail.com>
Thu, 29 Aug 2013 04:18:48 +0000 (00:18 -0400)
fold.c

diff --git a/fold.c b/fold.c
index 360b4f0..f8a143c 100644 (file)
--- a/fold.c
+++ b/fold.c
@@ -765,7 +765,7 @@ int fold_cond(ir_value *condval, ast_function *func, ast_ifthen *branch) {
         ast_expression_codegen *cgen;
         ir_block               *elide;
         ir_value               *dummy;
-        bool                    istrue  = (fold_immvalue_float(condval) == 1.0f && branch->on_true);
+        bool                    istrue  = (fold_immvalue_float(condval) != 0.0f && branch->on_true);
         bool                    isfalse = (fold_immvalue_float(condval) == 0.0f && branch->on_false);
         ast_expression         *path    = (istrue)  ? branch->on_true  :
                                           (isfalse) ? branch->on_false : NULL;