From: Richard Biener Date: Thu, 10 Jan 2019 18:58:08 +0000 (+0000) Subject: re PR tree-optimization/88792 (wrong-code in RPO VN since r263875) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f25507d041de4df6fffabedbed57c07ecff0d9ab;p=gcc.git re PR tree-optimization/88792 (wrong-code in RPO VN since r263875) 2019-01-10 Richard Biener 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bf6d6824ef0..a0276f28834 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-01-10 Richard Biener + + PR tree-optimization/88792 + * tree-ssa-pre.c (get_representative_for): Do not return a + value-number here. + 2019-01-10 Jakub Jelinek PR middle-end/84877 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 157c37db2ec..ef231a2ac20 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-01-10 Richard Biener + + PR tree-optimization/88792 + * gcc.dg/torture/pr88792.c: New testcase. + 2019-01-10 Steven G. Kargl 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 index 00000000000..e7f8fc0a624 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr88792.c @@ -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; +} diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index a37eff6c7e3..3f38371cb21 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -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: