This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Strip NOP_EXPR before building MEM
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 28 Aug 2016 19:59:12 +0200
- Subject: Strip NOP_EXPR before building MEM
- Authentication-results: sourceware.org; auth=none
Hi,
I have noticed that ivopts build MEM_REF (NOP_EXPR (address))
where NOP_EXPR converts one pointer type to another. Later it tries
to expand it that on strict alignment targets punt on determining
the alignment and winds expensive memory reference.
It seems to make no sense to have NOP_EXPR here, but in addition
I think we want to somehow preserve alignment from original MEM_REF?
Honza
* tree-ssa-lop-ivopts.c (get_computation_cost_at):
strip nops before building mem ref
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index 62ba71b..bd92031 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -5058,7 +5058,10 @@ fallback:
return infinite_cost;
if (address_p)
- comp = build_simple_mem_ref (comp);
+ {
+ STRIP_NOPS (comp);
+ comp = build_simple_mem_ref (comp);
+ }
cost = comp_cost (computation_cost (comp, speed), 0);