diff mbox

Fix PR bootstrap/63995

Message ID 20141126134311.GD40854@msticlxl57.ims.intel.com
State New
Headers show

Commit Message

Ilya Enkovich Nov. 26, 2014, 1:48 p.m. UTC
On 26 Nov 13:46, Jakub Jelinek wrote:
> On Wed, Nov 26, 2014 at 03:41:46PM +0300, Ilya Enkovich wrote:
> > Hi,
> > 
> > This patch makes optimization for bounds lifetime reduction to ignore
> > debug stetments.  This fixes stage2 and stage3 comparision for
> > instrumented boostrap.  OK for trunk?
> 
> Please add a small testcase (with -fcompare-debug -fcheck-pointer-bounds (or what
> other options you need to reproduce it) that fails without the patch and
> succeeds with it.
> 
> > 2014-11-26  Ilya Enkovich  <ilya.enkovich@intel.com>
> > 
> > 	PR bootstrap/63995
> > 	* tree-chkp-opt.c (chkp_reduce_bounds_lifetime): Ignore
> > 	debug statement when searching for a new position for
> > 	bounds load/creation statement.
> > 
> > 
> > diff --git a/gcc/tree-chkp-opt.c b/gcc/tree-chkp-opt.c
> > index ff390d7..92e0694 100644
> > --- a/gcc/tree-chkp-opt.c
> > +++ b/gcc/tree-chkp-opt.c
> > @@ -1175,6 +1175,9 @@ chkp_reduce_bounds_lifetime (void)
> >  
> >        FOR_EACH_IMM_USE_STMT (use_stmt, use_iter, op)
> >  	{
> > +	  if (is_gimple_debug (use_stmt))
> > +	    continue;
> > +
> >  	  if (dom_bb &&
> >  	      dominated_by_p (CDI_DOMINATORS,
> >  			      dom_bb, gimple_bb (use_stmt)))
> 
> 	Jakub

Here is a version with a test added.

Thanks,
Ilya
--
gcc/

2014-11-26  Ilya Enkovich  <ilya.enkovich@intel.com>

	PR bootstrap/63995
	* tree-chkp-opt.c (chkp_reduce_bounds_lifetime): Ignore
	debug statement when searching for a new position for
	bounds load/creation statement.

gcc/testsuite/

2014-11-26  Ilya Enkovich  <ilya.enkovich@intel.com>

	PR bootstrap/63995
	* gcc.target/i386/pr63995-2.c: New.

Comments

Jakub Jelinek Nov. 26, 2014, 1:51 p.m. UTC | #1
On Wed, Nov 26, 2014 at 04:48:13PM +0300, Ilya Enkovich wrote:
> 2014-11-26  Ilya Enkovich  <ilya.enkovich@intel.com>
> 
> 	PR bootstrap/63995
> 	* tree-chkp-opt.c (chkp_reduce_bounds_lifetime): Ignore
> 	debug statement when searching for a new position for
> 	bounds load/creation statement.
> 
> gcc/testsuite/
> 
> 2014-11-26  Ilya Enkovich  <ilya.enkovich@intel.com>
> 
> 	PR bootstrap/63995
> 	* gcc.target/i386/pr63995-2.c: New.

Ok, thanks.

	Jakub
diff mbox

Patch

diff --git a/gcc/testsuite/gcc.target/i386/pr63995-2.c b/gcc/testsuite/gcc.target/i386/pr63995-2.c
new file mode 100644
index 0000000..7c22e62
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr63995-2.c
@@ -0,0 +1,28 @@ 
+/* { dg-do compile } */
+/* { dg-require-effective-target mpx } */
+/* { dg-options "-O2 -g -fcheck-pointer-bounds -mmpx -fcompare-debug" } */
+
+struct ts
+{
+  int field;
+};
+
+extern void test1 ();
+extern void test2 (struct ts *);
+
+static void
+init (struct ts *c)
+{
+  c->field = -1;
+}
+
+struct ts
+test3 (const struct ts *other)
+{
+  struct ts r;
+  if (other->field != 0)
+    test1 ();
+  init (&r);
+  test2 (&r);
+  return r;
+}
diff --git a/gcc/tree-chkp-opt.c b/gcc/tree-chkp-opt.c
index ff390d7..92e0694 100644
--- a/gcc/tree-chkp-opt.c
+++ b/gcc/tree-chkp-opt.c
@@ -1175,6 +1175,9 @@  chkp_reduce_bounds_lifetime (void)
 
       FOR_EACH_IMM_USE_STMT (use_stmt, use_iter, op)
 	{
+	  if (is_gimple_debug (use_stmt))
+	    continue;
+
 	  if (dom_bb &&
 	      dominated_by_p (CDI_DOMINATORS,
 			      dom_bb, gimple_bb (use_stmt)))