summaryrefslogtreecommitdiff
path: root/gcc/tree-scalar-evolution.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2009-02-17 23:21:23 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2009-02-17 23:21:23 +0000
commitb6eab06c8e37527ee7083204e2f4e6747a80c8de (patch)
tree99d57e94e1f1d6770502eaeebe10cc9b46a906ae /gcc/tree-scalar-evolution.c
parent4f0507c2d96ea6b5e445ea402f5aa21ebd89804f (diff)
downloadgcc-b6eab06c8e37527ee7083204e2f4e6747a80c8de.tar.gz
PR tree-optimization/36922
* tree-data-ref.c (initialize_matrix_A): Handle BIT_NOT_EXPR. * tree-scalar-evolution.c (interpret_rhs_expr, instantiate_scev_1): Likewise. * gfortran.dg/pr36922.f: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@144250 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-scalar-evolution.c')
-rw-r--r--gcc/tree-scalar-evolution.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c
index f306ab8277c..ba15d52c68d 100644
--- a/gcc/tree-scalar-evolution.c
+++ b/gcc/tree-scalar-evolution.c
@@ -1712,6 +1712,15 @@ interpret_rhs_expr (struct loop *loop, gimple at_stmt,
fold_convert (type, integer_minus_one_node));
break;
+ case BIT_NOT_EXPR:
+ /* Handle ~X as -1 - X. */
+ chrec1 = analyze_scalar_evolution (loop, rhs1);
+ chrec1 = chrec_convert (type, chrec1, at_stmt);
+ res = chrec_fold_minus (type,
+ fold_convert (type, integer_minus_one_node),
+ chrec1);
+ break;
+
case MULT_EXPR:
chrec1 = analyze_scalar_evolution (loop, rhs1);
chrec2 = analyze_scalar_evolution (loop, rhs2);
@@ -2215,6 +2224,24 @@ instantiate_scev_1 (basic_block instantiate_below,
return chrec_convert (TREE_TYPE (chrec), op0, NULL);
+ case BIT_NOT_EXPR:
+ /* Handle ~X as -1 - X. */
+ op0 = instantiate_scev_1 (instantiate_below, evolution_loop,
+ TREE_OPERAND (chrec, 0),
+ fold_conversions, cache, size_expr);
+ if (op0 == chrec_dont_know)
+ return chrec_dont_know;
+
+ if (TREE_OPERAND (chrec, 0) != op0)
+ {
+ op0 = chrec_convert (type, op0, NULL);
+ chrec = chrec_fold_minus (type,
+ fold_convert (type,
+ integer_minus_one_node),
+ op0);
+ }
+ return chrec;
+
case SCEV_NOT_KNOWN:
return chrec_dont_know;