This is the mail archive of the
mailing list for the GCC project.
r242289 - /branches/ARM/sve-branch/gcc/tree-ssa...
- From: rsandifo at gcc dot gnu dot org
- To: gcc-cvs at gcc dot gnu dot org
- Date: Fri, 11 Nov 2016 17:34:31 -0000
- Subject: r242289 - /branches/ARM/sve-branch/gcc/tree-ssa...
Date: Fri Nov 11 17:34:30 2016
New Revision: 242289
Improve canonicalisation of TARGET_MEM_REFs
A general TARGET_MEM_REF is:
BASE + SYMBOL + OFFSET + INDEX * STEP
which is supposed to be general enough for targets with complex
addresses like x86_64. After classifying the address in this way,
the code that builds TARGET_MEM_REFs tries to simplify the address
until it is valid for the current target and for the mode of memory
being addressed. It does this in a fixed order:
1. add INDEX * STEP to BASE, if STEP != 1
2. add SYMBOL to BASE
3. add INDEX to BASE
4. add OFFSET to BASE
This meant that if we had an invalid address:
BASE + OFFSET + INDEX * 8
and BASE + OFFSET is also invalid, we'd create:
tmp1 = INDEX * 8
tmp2 = tmp1 + BASE
tmp3 = tmp2 + OFFSET
without considering whether:
tmp = BASE + OFFSET
MEM[base:tmp + INDEX * 8, offset:0]
might be valid.
This meant that if ivopts tried to create an iv with base &a+8
or &a+32 and a multiplier of 8 on the step (to take advantage
of the INDEX * 8 mode that ivopts knows the target has),
we'd always treat the multiplication as a separate operation,
in a way that could never be folded into the address.
The patch avoids this by skipping (1) if BASE + INDEX * STEP
is a legitimate address.