OSDN Git Service

add c++/43145 tag to changelog and testcase
[pf3gnuchains/gcc-fork.git] / gcc / tree-ssa-loop-niter.c
index 7dbb8c3..d1c2e4c 100644 (file)
@@ -1,6 +1,6 @@
 /* Functions to determine/estimate number of iterations of a loop.
-   Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation,
-   Inc.
+   Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010
+   Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -23,12 +23,12 @@ along with GCC; see the file COPYING3.  If not see
 #include "coretypes.h"
 #include "tm.h"
 #include "tree.h"
-#include "rtl.h"
 #include "tm_p.h"
-#include "hard-reg-set.h"
 #include "basic-block.h"
 #include "output.h"
 #include "diagnostic.h"
+#include "tree-pretty-print.h"
+#include "gimple-pretty-print.h"
 #include "intl.h"
 #include "tree-flow.h"
 #include "tree-dump.h"
@@ -94,8 +94,10 @@ split_to_var_and_offset (tree expr, tree *var, mpz_t offset)
 
       *var = op0;
       /* Always sign extend the offset.  */
-      off = double_int_sext (tree_to_double_int (op1),
-                            TYPE_PRECISION (type));
+      off = tree_to_double_int (op1);
+      if (negate)
+       off = double_int_neg (off);
+      off = double_int_sext (off, TYPE_PRECISION (type));
       mpz_set_double_int (offset, off, false);
       break;