This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR50955
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 6 Feb 2012 14:39:19 +0100 (CET)
- Subject: [PATCH] Fix PR50955
This fixes PR50955 - IVOPTs can end up expressing a pointer value
using unrelated pointer bases. This confuses alias analysis.
The fix is to extend the existing stop-gap we have in place
to cover the case in question.
Bootstrapped and tested on x86_64-unknonw-linux-gnu.
I have also benchmarked the patch on SPEC 2k6 and SPEC 2k (both
64bit and 32bit codegen) with only a single visible regression
at 64bit 191.fma32 at -O2 -ffast-math (-O3 -ffast-math is fine).
The patch shows small consistent wins on 32bit SPEC 2k when using
SSE math.
Committed to trunk.
Richard.
2012-02-06 Richard Guenther <rguenther@suse.de>
PR tree-optimization/50955
* tree-ssa-loop-ivopts.c (get_computation_cost_at): Artificially
raise cost of expressions that replace an address with an
expression based on a different pointer.
Index: gcc/tree-ssa-loop-ivopts.c
===================================================================
--- gcc/tree-ssa-loop-ivopts.c (revision 183757)
+++ gcc/tree-ssa-loop-ivopts.c (working copy)
@@ -4048,7 +4048,11 @@ get_computation_cost_at (struct ivopts_d
return infinite_cost;
}
- if (address_p)
+ if (address_p
+ || (use->iv->base_object
+ && cand->iv->base_object
+ && POINTER_TYPE_P (TREE_TYPE (use->iv->base_object))
+ && POINTER_TYPE_P (TREE_TYPE (cand->iv->base_object))))
{
/* Do not try to express address of an object with computation based
on address of a different object. This may cause problems in rtl