This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[4.5] Doloop improvement patches, 5/7


simplify_using_assignment calls function simple_rhs_p to determine if it
should use the assignment or not.  The previous patch changed
determine_max_iter not to use simplified values, so none of the users of
simplify_using_initial_values care whether the expression they get back
is complicated, they only care whether it can eventually be simplified
to a constant.  To be able to do this for as many expressions as
possible, it is advantageous to keep scanning as long as we can.

This patch improves this by allowing a few more types of expressions in
simple_rhs_p.


Bernd
	* loop-iv.c (simple_rhs_p): Allow more kinds of expressions.

Index: loop-iv.c
===================================================================
--- loop-iv.c.orig
+++ loop-iv.c
@@ -1336,9 +1336,10 @@ simple_rhs_p (rtx rhs)
     {
     case PLUS:
     case MINUS:
+    case AND:
       op0 = XEXP (rhs, 0);
       op1 = XEXP (rhs, 1);
-      /* Allow reg + const and reg + reg.  */
+      /* Allow reg OP const and reg OP reg.  */
       if (!(REG_P (op0) && !HARD_REGISTER_P (op0))
 	  && !CONSTANT_P (op0))
 	return false;
@@ -1349,9 +1350,12 @@ simple_rhs_p (rtx rhs)
       return true;
 
     case ASHIFT:
+    case ASHIFTRT:
+    case LSHIFTRT:
+    case MULT:
       op0 = XEXP (rhs, 0);
       op1 = XEXP (rhs, 1);
-      /* Allow reg << const.  */
+      /* Allow reg OP const.  */
       if (!(REG_P (op0) && !HARD_REGISTER_P (op0)))
 	return false;
       if (!CONSTANT_P (op1))

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]