This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, MPX, 2/X] Pointers Checker [7/25] Suppress BUILT_IN_CHKP_ARG_BND optimizations.
- From: Ilya Enkovich <enkovich dot gnu at gmail dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 5 Nov 2013 18:24:15 +0400
- Subject: Re: [PATCH, MPX, 2/X] Pointers Checker [7/25] Suppress BUILT_IN_CHKP_ARG_BND optimizations.
- Authentication-results: sourceware.org; auth=none
- References: <20131031090213 dot GC54327 at msticlxl57 dot ims dot intel dot com> <CAFiYyc3gBc=CHDranqXo49NG6yFMSc3d-N8buFtjSS5G5Nga5w at mail dot gmail dot com> <4115420e-30be-445c-a68a-46168b939c01 at email dot android dot com> <CAMbmDYaQ+2YKDsUXVfUxw3VJ=njiZm6uOTduwi8tS9rNoEoJ2g at mail dot gmail dot com> <CAFiYyc26Rks2N3G8MaeUKeq-sCmih1nNW_rrCfbiLN+CCTCv5A at mail dot gmail dot com> <CAMbmDYZiCKCqV2k4ch4JnTsMy4bTnAwEWJw79Z=213PLyGmfew at mail dot gmail dot com> <CAFiYyc2Vc-PSv40TQ9Wwrkjw=QWpvd-Xta6hbJ6K_8_jo4mtPA at mail dot gmail dot com>
2013/11/5 Richard Biener <richard.guenther@gmail.com>:
> On Tue, Nov 5, 2013 at 1:52 PM, Ilya Enkovich <enkovich.gnu@gmail.com> wrote:
>>
>> For input parameter P I need to have
>> BOUNDS = __builtin_arg_bnd (P)
>> to somehow refer to bounds of P in GIMPLE. Optimizations may modify
>> __builtin_arg_bnd (P) replacing P with its copy or some value. It
>> makes call useless because removes information about parameter whose
>> bounds we refer to. I want such optimization to ignore
>> __builtin_arg_bnd calls and always leave default SSA_NAME of PARM_DECL
>> there as arg.
>
> How does a compilable testcase look like that shows how the default def
> is used? And what transforms break that use? I really cannot see
> how this would happen (and you didn't add a testcase).
Here is a test source:
extern int bar1 (int *p);
extern int bar2 (int);
int foo (int *p)
{
if (!p)
return bar1 (p);
return bar2 (10);
}
After instrumentation GIMPLE looks like:
foo (int * p)
{
<unnamed type> __bound_tmp.0;
int _1;
int _6;
int _8;
<bb 6>:
__bound_tmp.0_9 = __builtin_ia32_arg_bnd (p_3(D));
<bb 2>:
if (p_3(D) == 0B)
goto <bb 3>;
else
goto <bb 4>;
<bb 3>:
_6 = bar1 (p_3(D), __bound_tmp.0_9);
goto <bb 5>;
<bb 4>:
_8 = bar2 (10);
<bb 5>:
# _1 = PHI <_6(3), _8(4)>
return _1;
}
Here is optimized GIMPLE (if I do not apply my changes in tree-ssa-dom.c):
foo (int * p)
{
<unnamed type> __bound_tmp.0;
int _1;
int _6;
int _8;
<bb 2>:
if (p_3(D) == 0B)
goto <bb 3>;
else
goto <bb 4>;
<bb 3>:
__bound_tmp.0_9 = __builtin_ia32_arg_bnd (0B); [return slot optimization]
_6 = bar1 (0B, __bound_tmp.0_9); [tail call]
goto <bb 5>;
<bb 4>:
_8 = bar2 (10); [tail call]
<bb 5>:
# _1 = PHI <_6(3), _8(4)>
return _1;
}
Now during expand or inline of foo I cannot determine the value for
__bound_tmp.0_9.
Ilya
>
> Richard.
>
- References:
- Re: [PATCH, MPX, 2/X] Pointers Checker [7/25] Suppress BUILT_IN_CHKP_ARG_BND optimizations.
- Re: [PATCH, MPX, 2/X] Pointers Checker [7/25] Suppress BUILT_IN_CHKP_ARG_BND optimizations.
- Re: [PATCH, MPX, 2/X] Pointers Checker [7/25] Suppress BUILT_IN_CHKP_ARG_BND optimizations.
- Re: [PATCH, MPX, 2/X] Pointers Checker [7/25] Suppress BUILT_IN_CHKP_ARG_BND optimizations.
- Re: [PATCH, MPX, 2/X] Pointers Checker [7/25] Suppress BUILT_IN_CHKP_ARG_BND optimizations.
- Re: [PATCH, MPX, 2/X] Pointers Checker [7/25] Suppress BUILT_IN_CHKP_ARG_BND optimizations.