aboutsummaryrefslogtreecommitdiff
path: root/gcc/loop-iv.c
diff options
context:
space:
mode:
authorZdenek Dvorak <ook@ucw.cz>2008-11-20 09:05:12 +0100
committerZdenek Dvorak <rakdver@gcc.gnu.org>2008-11-20 08:05:12 +0000
commitdc5b3407f2997631c15eebccd8c9260e186f3e0a (patch)
tree049852a66bb3c2b176b99851ac916058e794f7d0 /gcc/loop-iv.c
parentf9487002a446cc5f4c777a77afe7c6eaecfec4d0 (diff)
downloadgcc-dc5b3407f2997631c15eebccd8c9260e186f3e0a.zip
gcc-dc5b3407f2997631c15eebccd8c9260e186f3e0a.tar.gz
gcc-dc5b3407f2997631c15eebccd8c9260e186f3e0a.tar.bz2
re PR rtl-optimization/32283 (Missed induction variable optimization)
PR rtl-optimization/32283 * tree-ssa-loop-niter.c (scev_probably_wraps_p): Use type of the base of the induction variable to decide whether it may wrap. * tree-ssa-loop-ivopts.c (rewrite_use_compare): Emit the initialization of the bound before the loop. * simplify-rtx.c (simplify_binary_operation_1): Add two simplifications regarding AND. (simplify_plus_minus): Only fail if no simplification is possible. * loop-iv.c (simple_rhs_p): Consider reg + reg and reg << cst simple. From-SVN: r142035
Diffstat (limited to 'gcc/loop-iv.c')
-rw-r--r--gcc/loop-iv.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/gcc/loop-iv.c b/gcc/loop-iv.c
index 2523963..3723dbd 100644
--- a/gcc/loop-iv.c
+++ b/gcc/loop-iv.c
@@ -1337,13 +1337,26 @@ simple_rhs_p (rtx rhs)
case MINUS:
op0 = XEXP (rhs, 0);
op1 = XEXP (rhs, 1);
- /* Allow reg + const sets only. */
- if (REG_P (op0) && !HARD_REGISTER_P (op0) && CONSTANT_P (op1))
- return true;
- if (REG_P (op1) && !HARD_REGISTER_P (op1) && CONSTANT_P (op0))
- return true;
+ /* Allow reg + const and reg + reg. */
+ if (!(REG_P (op0) && !HARD_REGISTER_P (op0))
+ && !CONSTANT_P (op0))
+ return false;
+ if (!(REG_P (op1) && !HARD_REGISTER_P (op1))
+ && !CONSTANT_P (op1))
+ return false;
- return false;
+ return true;
+
+ case ASHIFT:
+ op0 = XEXP (rhs, 0);
+ op1 = XEXP (rhs, 1);
+ /* Allow reg << const. */
+ if (!(REG_P (op0) && !HARD_REGISTER_P (op0)))
+ return false;
+ if (!CONSTANT_P (op1))
+ return false;
+
+ return true;
default:
return false;