Bugfix: Added special case for x mod 1.
authorSebastian Buchwald <Sebastian.Buchwald@kit.edu>
Fri, 19 Aug 2011 12:07:11 +0000 (14:07 +0200)
committerSebastian Buchwald <Sebastian.Buchwald@kit.edu>
Fri, 19 Aug 2011 12:07:43 +0000 (14:07 +0200)
ir/ir/irarch.c

index ad1841c..7b30379 100644 (file)
@@ -1051,7 +1051,13 @@ ir_node *arch_dep_replace_mod_by_const(ir_node *irn)
                        k = tv_ld2(tv, n);
                }
 
-               if (k >= 0) {
+               /* k == 0  i.e. modulo by 1 */
+               if (k == 0) {
+                       ir_graph *irg = get_irn_irg(irn);
+
+                       res = new_r_Const(irg, get_mode_null(mode));
+               }
+               else if (k > 0) {
                        ir_graph *irg = get_irn_irg(irn);
                        /* division by 2^k or -2^k:
                         * we use "modulus" here, so x % y == x % -y that's why is no difference between the case 2^k and -2^k