diff options
author | Martin Jambor <mjambor@suse.cz> | 2020-06-16 19:26:32 +0200 |
---|---|---|
committer | Martin Jambor <mjambor@suse.cz> | 2020-11-23 23:52:29 +0100 |
commit | f38a33a2745cf9f5ce1d71162185fe39fa5f3701 (patch) | |
tree | 84e69f026994401e2129fd826576f87a980b585d /gcc/ipa-prop.h | |
parent | f80565da33598c4dbc70ea9c83272ed6bfff7a0d (diff) | |
download | gcc-f38a33a2745cf9f5ce1d71162185fe39fa5f3701.zip gcc-f38a33a2745cf9f5ce1d71162185fe39fa5f3701.tar.gz gcc-f38a33a2745cf9f5ce1d71162185fe39fa5f3701.tar.bz2 |
ipa: special pass-through op for Fortran strides
when Fortran functions pass array descriptors they receive as a
parameter to another function, they actually rebuild it. Thanks to
work done mainly by Feng, IPA-CP can already handle the cases when
they pass directly the values loaded from the original descriptor.
Unfortunately, perhaps the most important one, stride, is first
checked against zero and is replaced with one in that case:
_12 = *a_11(D).dim[0].stride;
if (_12 != 0)
goto <bb 4>; [50.00%]
else
goto <bb 3>; [50.00%]
<bb 3>
// empty BB
<bb 4>
# iftmp.22_9 = PHI <_12(2), 1(3)>
...
parm.6.dim[0].stride = iftmp.22_9;
...
__x_MOD_foo (&parm.6, b_31(D));
in the most important and hopefully common cases, the incoming value
is already 1 and we fail to propagate it.
I would therefore like to propose the following way of encoding this
situation in pass-through jump functions using using ASSERTT_EXPR
operation code meaning that if the incoming value is the same as the
"operand" in the jump function, it is passed on, otherwise the result
is unknown. This of course captures only the single (but most
important) case but is an improvement and does not need enlarging the
jump function structure and is simple to pattern match. Encoding that
zero needs to be changed to one would need another field and matching
it would be slightly more complicated too.
gcc/
2020-06-12 Martin Jambor <mjambor@suse.cz>
* ipa-prop.h (ipa_pass_through_data): Expand comment describing
operation.
* ipa-prop.c (analyze_agg_content_value): Detect new special case and
encode it as ASSERT_EXPR.
* ipa-cp.c (values_equal_for_ipcp_p): Move before
ipa_get_jf_arith_result.
(ipa_get_jf_arith_result): Special case ASSERT_EXPR.
gcc/testsuite/
2020-06-12 Martin Jambor <mjambor@suse.cz>
* gfortran.dg/ipcp-array-2.f90: New test.
Diffstat (limited to 'gcc/ipa-prop.h')
-rw-r--r-- | gcc/ipa-prop.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h index 56e8055..112a1ba 100644 --- a/gcc/ipa-prop.h +++ b/gcc/ipa-prop.h @@ -94,9 +94,14 @@ struct GTY(()) ipa_pass_through_data /* Number of the caller's formal parameter being passed. */ int formal_id; /* Operation that is performed on the argument before it is passed on. - NOP_EXPR means no operation. Otherwise oper must be a simple binary - arithmetic operation where the caller's parameter is the first operand and - operand field from this structure is the second one. */ + Special values which have other meaning than in normal contexts: + - NOP_EXPR means no operation, not even type conversion. + - ASSERT_EXPR means that only the value in operand is allowed to pass + through (without any change), for all other values the result is + unknown. + Otherwise operation must be a simple binary or unary arithmetic operation + where the caller's parameter is the first operand and (for binary + operations) the operand field from this structure is the second one. */ enum tree_code operation; /* When the passed value is a pointer, it is set to true only when we are certain that no write to the object it points to has occurred since the |