This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, Pointer Bounds Checker 26/x] CCP
- 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: Fri, 6 Jun 2014 11:02:35 +0400
- Subject: Re: [PATCH, Pointer Bounds Checker 26/x] CCP
- Authentication-results: sourceware.org; auth=none
- References: <20140603073814 dot GD20877 at msticlxl57 dot ims dot intel dot com> <CAFiYyc3EvNq615M1ix2gjYQ4FSLswKWp876a8XBB_2KeGUHnLg at mail dot gmail dot com>
On 03 Jun 11:54, Richard Biener wrote:
> On Tue, Jun 3, 2014 at 9:38 AM, Ilya Enkovich <enkovich.gnu@gmail.com> wrote:
> > Hi,
> >
> > This patch allows BUILT_IN_CHKP_BNDRET as a consumer of a result of BUILT_IN_STACK_SAVE call.
> >
> > Bootstrapped and tested on linux-x86_64.
> >
> > Thanks,
> > Ilya
> > --
> > gcc/
> >
> > 2014-06-03 Ilya Enkovich <ilya.enkovich@intel.com>
> >
> > * tree-ssa-ccp.c (insert_clobber_before_stack_restore): Handle
> > BUILT_IN_CHKP_BNDRET calls.
> >
> >
> > diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
> > index eeefeaf..c138337 100644
> > --- a/gcc/tree-ssa-ccp.c
> > +++ b/gcc/tree-ssa-ccp.c
> > @@ -1848,7 +1848,7 @@ insert_clobber_before_stack_restore (tree saved_val, tree var,
> > gimple_htab *visited)
> > {
> > gimple stmt, clobber_stmt;
> > - tree clobber;
> > + tree clobber, fndecl;
> > imm_use_iterator iter;
> > gimple_stmt_iterator i;
> > gimple *slot;
> > @@ -1880,6 +1880,10 @@ insert_clobber_before_stack_restore (tree saved_val, tree var,
> > else if (gimple_assign_ssa_name_copy_p (stmt))
> > insert_clobber_before_stack_restore (gimple_assign_lhs (stmt), var,
> > visited);
> > + else if (gimple_code (stmt) == GIMPLE_CALL
> > + && (fndecl = targetm.builtin_chkp_function (BUILT_IN_CHKP_BNDRET))
> > + && gimple_call_fndecl (stmt) == fndecl)
> > + continue;
>
> Please change this to use the proper abstraction once implemented. It should
> be sth like
>
> else if (is_gimple_call (stmt)
> && gimple_call_builtin_p (stmt, BUILT_IN_CHKP_BNDRET))
> continue;
>
> I assume now that the builtins are not target builtins but added to
> builtins.def.
>
> Richard.
>
> > else
> > gcc_assert (is_gimple_debug (stmt));
> > }
Here is a fixed version with proper predicate.
Bootstrapped and tested on linux_x86-64.
Thanks,
Ilya
--
gcc/
2014-06-05 Ilya Enkovich <ilya.enkovich@intel.com>
* tree-ssa-ccp.c: Include tree-chkp.h.
(insert_clobber_before_stack_restore): Handle
BUILT_IN_CHKP_BNDRET calls.
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index eeefeaf..e99bcf5 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -144,6 +144,7 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic-core.h"
#include "dbgcnt.h"
#include "params.h"
+#include "tree-chkp.h"
/* Possible lattice values. */
@@ -1880,6 +1881,9 @@ insert_clobber_before_stack_restore (tree saved_val, tree var,
else if (gimple_assign_ssa_name_copy_p (stmt))
insert_clobber_before_stack_restore (gimple_assign_lhs (stmt), var,
visited);
+ else if (gimple_code (stmt) == GIMPLE_CALL
+ && chkp_gimple_call_builtin_p (stmt, BUILT_IN_CHKP_BNDRET))
+ continue;
else
gcc_assert (is_gimple_debug (stmt));
}