Hi,
Revision 236200 checks wrong pointer for invariant expression, which
accidentally clears all depends_on information. This causes wrong cost and bad
code generation, for example, gcc.target/arm/pr42505.c on thumb1 targets. This
patch fixes the issue.
Test result checked for gcc.target/arm/pr42505.c. Apply as obvious.
Thanks,
bin
2016-05-18 Bin Cheng <bin.ch...@arm.com>
* tree-ssa-loop-ivopts.c (get_computation_cost_at): Check invariant
expression pointer, not pointer to the pointer.
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index e8953a0..9ce6b64 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -4874,7 +4874,7 @@ get_computation_cost_at (struct ivopts_data *data,
*inv_expr = get_loop_invariant_expr (data, ubase, cbase, ratio,
address_p);
/* Clear depends on. */
- if (inv_expr != NULL)
+ if (*inv_expr != NULL)
bitmap_clear (*depends_on);
}