gcc/gcc10-pr92765-workaround.patch

52 lines
2.3 KiB
Diff

2020-01-26 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/92765
* tree-ssa-strlen.c (handle_builtin_string_cmp): Temporarily disable
broken optimization.
* gcc.dg/strlenopt-65.c: Add xfail.
* gcc.dg/strlenopt-69.c: Likewise.
* gcc.dg/strcmpopt_3.c: Likewise.
--- gcc/tree-ssa-strlen.c.jj 2020-01-16 15:13:55.789044796 +0100
+++ gcc/tree-ssa-strlen.c 2020-01-26 18:58:17.787571444 +0100
@@ -4461,8 +4461,11 @@ handle_builtin_string_cmp (gimple_stmt_i
known to be unequal set the range of the result to non-zero.
This allows the call to be eliminated if its result is only
used in tests for equality to zero. */
+#if 0
+ /* Temporarily disabled due to PR92765. */
wide_int zero = wi::zero (TYPE_PRECISION (TREE_TYPE (lhs)));
set_range_info (lhs, VR_ANTI_RANGE, zero, zero);
+#endif
return false;
}
/* When the two strings are definitely equal (such as when they
--- gcc/testsuite/gcc.dg/strlenopt-65.c.jj 2020-01-12 11:54:37.518396737 +0100
+++ gcc/testsuite/gcc.dg/strlenopt-65.c 2020-01-26 19:03:42.310607725 +0100
@@ -173,7 +173,7 @@ void test_strncmp_keep (const char *s, c
}
}
-/* { dg-final { scan-tree-dump-times "call_in_true_branch_not_eliminated_" 0 "optimized" } }
+/* { dg-final { scan-tree-dump-times "call_in_true_branch_not_eliminated_" 0 "optimized" { xfail *-*-* } } }
{ dg-final { scan-tree-dump-times "call_made_in_true_branch_on_line_1\[0-9\]\[0-9\]\[0-9\]" 11 "optimized" } }
{ dg-final { scan-tree-dump-times "call_made_in_false_branch_on_line_1\[0-9\]\[0-9\]\[0-9\]" 11 "optimized" } } */
--- gcc/testsuite/gcc.dg/strlenopt-69.c.jj 2020-01-12 11:54:37.518396737 +0100
+++ gcc/testsuite/gcc.dg/strlenopt-69.c 2020-01-26 19:04:04.913262008 +0100
@@ -126,4 +126,4 @@ void test_array_copy_bounded (void)
A (strncmp (s, a4, 5)); clobber (a4);
}
-/* { dg-final { scan-tree-dump-not "abort|strcmp|strncmp" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "abort|strcmp|strncmp" "optimized" { xfail *-*-* } } } */
--- gcc/testsuite/gcc.dg/strcmpopt_3.c.jj 2020-01-12 11:54:37.515396783 +0100
+++ gcc/testsuite/gcc.dg/strcmpopt_3.c 2020-01-26 19:03:08.123130636 +0100
@@ -28,4 +28,4 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "strcmp" 0 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "strcmp" 0 "optimized" { xfail *-*-* } } } */