2013/11/18 Jeff Law <l...@redhat.com>: > On 11/18/13 03:37, Ilya Enkovich wrote: >> >> Hi, >> >> Here is a patch to disable tail recursion transformation when bounds are >> passed by call. The reason is BUILT_IN_CHKP_ARG_BND which should always get >> default SSA_NAME of PARM_DECL as an argument. >> >> Thanks, >> Ilya >> -- >> 2013-11-15 Ilya Enkovich <ilya.enkov...@intel.com> >> >> * tree-tailcall.c: Include tree-chkp.h. >> (suitable_for_tail_opt_p): Disable tail >> recursion for instrumented functions with bounded args. > > This sounds wrong. If the builtins are called with a PARAM_DECL rather than > an SSA_NAME, can't they make worst case assumptions about the bounds? > > In general if we find ourselves disabling an optimizer to make the bounds > checker happy, we've got some explaining to do.
In SSA we are not allowed to have PARAM_DECL as call arg. The problem in this optimization is that when we replace a tail call with jump, we replace default SSA name of input parameter with PHI node holding taking original param and call's arg. This PHI node then is used in BUILT_IN_CHKP_ARG_BND, but is should not. Optimizer has to be taught to analizy bind_bounds of replaced call and generate PHI nodes for bounds. In general for not important optimizations I resolve the stability issue with instrumented code and will enable optimizations later. For obviously important optimizations, like inline, support is initially added. Ilya > > jeff >