[committed] Fix -fcompare-debug issue in simd clone creation (PR debug/63328)

Jakub Jelinek jakub@redhat.com
Mon Sep 22 10:36:00 GMT 2014


Hi!

Obviously, it is a bad idea to emit gimple assign stmts for temporaries
needed by debug stmts, we have to emit debug temporaries instead, otherwise
we generate different code between -g0 and -g.
Tested on x86_64-linux, committed to trunk/4.9.

2014-09-22  Jakub Jelinek  <jakub@redhat.com>

	PR debug/63328
	* omp-low.c (ipa_simd_modify_stmt_ops): For debug stmts
	insert a debug source bind stmt setting DEBUG_EXPR_DECL
	instead of a normal gimple assignment stmt.

	* c-c++-common/gomp/pr63328.c: New test.

--- gcc/omp-low.c.jj	2014-09-08 22:12:46.000000000 +0200
+++ gcc/omp-low.c	2014-09-22 11:44:47.751338842 +0200
@@ -11717,9 +11717,22 @@ ipa_simd_modify_stmt_ops (tree *tp, int
   if (tp != orig_tp)
     {
       repl = build_fold_addr_expr (repl);
-      gimple stmt
-	= gimple_build_assign (make_ssa_name (TREE_TYPE (repl), NULL), repl);
-      repl = gimple_assign_lhs (stmt);
+      gimple stmt;
+      if (is_gimple_debug (info->stmt))
+	{
+	  tree vexpr = make_node (DEBUG_EXPR_DECL);
+	  stmt = gimple_build_debug_source_bind (vexpr, repl, NULL);
+	  DECL_ARTIFICIAL (vexpr) = 1;
+	  TREE_TYPE (vexpr) = TREE_TYPE (repl);
+	  DECL_MODE (vexpr) = TYPE_MODE (TREE_TYPE (repl));
+	  repl = vexpr;
+	}
+      else
+	{
+	  stmt = gimple_build_assign (make_ssa_name (TREE_TYPE (repl),
+						     NULL), repl);
+	  repl = gimple_assign_lhs (stmt);
+	}
       gimple_stmt_iterator gsi = gsi_for_stmt (info->stmt);
       gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
       *orig_tp = repl;
--- gcc/testsuite/c-c++-common/gomp/pr63328.c.jj	2014-09-22 12:09:50.140724501 +0200
+++ gcc/testsuite/c-c++-common/gomp/pr63328.c	2014-09-22 12:09:45.371745608 +0200
@@ -0,0 +1,5 @@
+/* PR debug/63328 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp-simd -fno-strict-aliasing -fcompare-debug" } */
+
+#include "pr60823-3.c"

	Jakub



More information about the Gcc-patches mailing list