re PR tree-optimization/88792 (wrong-code in RPO VN since r263875)
authorRichard Biener <rguenther@suse.de>
Thu, 10 Jan 2019 18:58:08 +0000 (18:58 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 10 Jan 2019 18:58:08 +0000 (18:58 +0000)
2019-01-10  Richard Biener  <rguenther@suse.de>

PR tree-optimization/88792
* tree-ssa-pre.c (get_representative_for): Do not return a
value-number here.

* gcc.dg/torture/pr88792.c: New testcase.

From-SVN: r267821

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr88792.c [new file with mode: 0644]
gcc/tree-ssa-pre.c

index bf6d6824ef0db2f4b93396243e211c5df9385ee5..a0276f28834af0cfb7fe243ac133fb29d86f510c 100644 (file)
@@ -1,3 +1,9 @@
+2019-01-10  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/88792
+       * tree-ssa-pre.c (get_representative_for): Do not return a
+       value-number here.
+
 2019-01-10  Jakub Jelinek  <jakub@redhat.com>
 
        PR middle-end/84877
index 157c37db2ec202b491f302f8eebe8a77e669b6f5..ef231a2ac203bedfe9a6619f0c5f419f1e1760df 100644 (file)
@@ -1,3 +1,8 @@
+2019-01-10  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/88792
+       * gcc.dg/torture/pr88792.c: New testcase.
+
 2019-01-10  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/86322
diff --git a/gcc/testsuite/gcc.dg/torture/pr88792.c b/gcc/testsuite/gcc.dg/torture/pr88792.c
new file mode 100644 (file)
index 0000000..e7f8fc0
--- /dev/null
@@ -0,0 +1,32 @@
+/* { dg-do run } */
+
+int one = 1;
+
+char
+__attribute__((noipa))
+foo(char v)
+{
+  int modec;
+
+  if (one)
+    {
+      modec = ((v < 'A' || v > 'Z') ? v : v + ('a' - 'A'));
+      if (modec != 't' && modec != 'c' && modec != 'g')
+       modec = 0;
+    }
+  else
+    modec = 'g';
+
+  return modec;
+}
+
+int main(int argc, char **argv)
+{
+  char c = 't';
+  int r = foo (c);
+
+  if (r != c)
+    __builtin_abort ();
+
+  return 0;
+}
index a37eff6c7e3500de2b9f8698b09ee554d15e36ee..3f38371cb21a205ad745972ec69f518f2e8e4ad1 100644 (file)
@@ -1262,7 +1262,7 @@ get_representative_for (const pre_expr e, basic_block b = NULL)
   switch (e->kind)
     {
     case NAME:
-      return VN_INFO (PRE_EXPR_NAME (e))->valnum;
+      return PRE_EXPR_NAME (e);
     case CONSTANT:
       return PRE_EXPR_CONSTANT (e);
     case NARY: