aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2020-06-16 19:26:32 +0200
committerMartin Jambor <mjambor@suse.cz>2020-11-23 23:52:29 +0100
commitf38a33a2745cf9f5ce1d71162185fe39fa5f3701 (patch)
tree84e69f026994401e2129fd826576f87a980b585d /gcc/fold-const.c
parentf80565da33598c4dbc70ea9c83272ed6bfff7a0d (diff)
downloadgcc-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/fold-const.c')
0 files changed, 0 insertions, 0 deletions