aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2013-01-28 15:05:40 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2013-01-28 15:05:40 +0100
commitaa710d25957e36a089a03929d6f82fa88371e32d (patch)
tree1de27d3eb202e56e456408ca2b0032563b0e331d
parent25350308a5373048daf6718da30eac968f59213a (diff)
downloadgcc-aa710d25957e36a089a03929d6f82fa88371e32d.zip
gcc-aa710d25957e36a089a03929d6f82fa88371e32d.tar.gz
gcc-aa710d25957e36a089a03929d6f82fa88371e32d.tar.bz2
re PR tree-optimization/56094 (Invalid line number info generated with tree-level ivopts)
PR tree-optimization/56094 * gimplify.c (force_gimple_operand_1): Temporarily set input_location to UNKNOWN_LOCATION while gimplifying expr. * gcc.dg/pr56094.c: New test. From-SVN: r195504
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/gimplify.c4
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/pr56094.c81
4 files changed, 96 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 07db36e..c96ccd2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2013-01-28 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/56094
+ * gimplify.c (force_gimple_operand_1): Temporarily set input_location
+ to UNKNOWN_LOCATION while gimplifying expr.
+
2013-01-27 Uros Bizjak <ubizjak@gmail.com>
PR target/56114
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index e1906e2..e7119283 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -8600,6 +8600,7 @@ force_gimple_operand_1 (tree expr, gimple_seq *stmts,
{
enum gimplify_status ret;
struct gimplify_ctx gctx;
+ location_t saved_location;
*stmts = NULL;
@@ -8613,6 +8614,8 @@ force_gimple_operand_1 (tree expr, gimple_seq *stmts,
push_gimplify_context (&gctx);
gimplify_ctxp->into_ssa = gimple_in_ssa_p (cfun);
gimplify_ctxp->allow_rhs_cond_expr = true;
+ saved_location = input_location;
+ input_location = UNKNOWN_LOCATION;
if (var)
{
@@ -8634,6 +8637,7 @@ force_gimple_operand_1 (tree expr, gimple_seq *stmts,
gcc_assert (ret != GS_ERROR);
}
+ input_location = saved_location;
pop_gimplify_context (NULL);
return expr;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 3b3df08..a40759c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2013-01-28 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/56094
+ * gcc.dg/pr56094.c: New test.
+
2013-01-27 Amol Pise <amolpise15@gmail.com>
* gcc.target/arm/neon-vfnms-1.c: New test.
diff --git a/gcc/testsuite/gcc.dg/pr56094.c b/gcc/testsuite/gcc.dg/pr56094.c
new file mode 100644
index 0000000..d223311
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr56094.c
@@ -0,0 +1,81 @@
+/* PR tree-optimization/56094 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -g -fdump-tree-optimized-lineno" } */
+
+_Bool cond;
+
+int
+fn0 (unsigned char, unsigned long long, unsigned char,
+ unsigned char, signed short, unsigned int,
+ unsigned char *);
+
+extern void fn3 (unsigned char, unsigned char, unsigned char, unsigned char,
+ unsigned char, unsigned char, unsigned char, unsigned short);
+extern void fn7 (int);
+extern void fn8 (int);
+
+static __inline__ __attribute__ ((always_inline)) void
+fn1 (unsigned char arg0, unsigned char arg1, unsigned char arg2,
+ unsigned char arg3, unsigned char arg4, unsigned char arg5,
+ unsigned short arg6)
+{
+ asm volatile ("" :: "g" ((unsigned long long) arg0), "g" (arg1),
+ "g" (arg2), "g" (arg3), "g" (arg4), "g" (arg5),
+ "g" (arg6));
+ if (cond)
+ {
+ unsigned char loc0 = 0;
+ fn3 (loc0, arg0, arg1, arg2, arg3, arg4, arg5, arg6);
+ }
+}
+
+static __inline__ __attribute__ ((always_inline)) void
+fn4 (unsigned int arg0, unsigned long long arg1)
+{
+ asm volatile ("" :: "g" (arg0), "g" (arg1));
+}
+
+static __inline__ __attribute__ ((always_inline)) void
+fn5 (unsigned int arg0, unsigned char arg1, unsigned int arg2,
+ unsigned char arg3)
+{
+ asm volatile ("" :: "g" (arg0), "g" (arg1),
+ "g" ((unsigned long long) arg2), "g" (arg3));
+}
+
+static __inline__ __attribute__ ((always_inline)) void
+fn6 (unsigned long long arg0, unsigned char arg1,
+ unsigned char arg2, signed short arg3,
+ unsigned int arg4, unsigned char * arg5)
+{
+ asm volatile ("" :: "g" (arg0), "g" ((unsigned long long) arg1),
+ "g" ((unsigned long long) arg2), "g" (arg3),
+ "g" (arg4), "g" (arg5));
+ if (cond)
+ {
+ unsigned char loc0 = 0;
+ fn0 (loc0, arg0, arg1, arg2, arg3, arg4, arg5);
+ }
+}
+
+unsigned char b[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa };
+unsigned int q = sizeof (b) / sizeof (b[0]);
+
+void
+foo ()
+{
+ int i;
+ for (i = 1; i <= 50; i++)
+ {
+ fn6 (i + 0x1234, i + 1, i + 0xa, i + 0x1234, q, b);
+ fn5 (i + 0xabcd, i << 1, i + 0x1234, i << 2);
+ fn7 (i + 0xdead);
+ fn8 (i + 0xdead);
+ fn1 (i, i + 1, i + 2, i + 3, i + 4, i + 5, i << 10);
+ fn4 (i + 0xfeed, i);
+ }
+}
+
+/* Verify no statements get the location of the foo () decl. */
+/* { dg-final { scan-tree-dump-not " : 65:1\\\]" "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */