]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR tree-optimization/92930 (GCC incorrectly optimizes away __builtin_app...
authorJakub Jelinek <jakub@redhat.com>
Fri, 20 Dec 2019 17:44:16 +0000 (18:44 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 20 Dec 2019 17:44:16 +0000 (18:44 +0100)
Backported from mainline
2019-12-14  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/92930
* ipa-pure-const.c (special_builtin_state): Don't handle
BUILT_IN_APPLY.

* gcc.dg/tree-ssa/pr92930.c: New test.

From-SVN: r279674

gcc/ChangeLog
gcc/ipa-pure-const.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/pr92930.c [new file with mode: 0644]

index b611ddded12ed0f05ff0bd69f98dcd045b61388c..744169615cc27d5c6c68ea04cf6a916e6e4d6353 100644 (file)
@@ -5,6 +5,12 @@
        diagnose teams not closely nested inside of target.
 
        Backported from mainline
+       2019-12-14  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/92930
+       * ipa-pure-const.c (special_builtin_state): Don't handle
+       BUILT_IN_APPLY.
+
        2019-12-12  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/92904
index bb561d00853f5d148d37b5cecd30a5f2e8db38ef..0c6f84ff72dea6363003e678f0eed9d38c7f9161 100644 (file)
@@ -527,7 +527,6 @@ special_builtin_state (enum pure_const_state_e *state, bool *looping,
        case BUILT_IN_CXA_END_CLEANUP:
        case BUILT_IN_EH_COPY_VALUES:
        case BUILT_IN_FRAME_ADDRESS:
-       case BUILT_IN_APPLY:
        case BUILT_IN_APPLY_ARGS:
        case BUILT_IN_ASAN_BEFORE_DYNAMIC_INIT:
        case BUILT_IN_ASAN_AFTER_DYNAMIC_INIT:
index 90f65318a9e6c0b9534b7ecaaab25f4745e8dcfa..cfff70b986aefa717bbcc4bfaa70638cbccf5835 100644 (file)
@@ -1,6 +1,11 @@
 2019-12-20  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2019-12-14  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/92930
+       * gcc.dg/tree-ssa/pr92930.c: New test.
+
        2019-12-12  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/92904
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr92930.c b/gcc/testsuite/gcc.dg/tree-ssa/pr92930.c
new file mode 100644 (file)
index 0000000..67e604b
--- /dev/null
@@ -0,0 +1,19 @@
+/* PR tree-optimization/92930 */
+/* { dg-do compile { target untyped_assembly } } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump "__builtin_apply " "optimized" } } */
+/* { dg-final { scan-tree-dump "__builtin_apply_args" "optimized" } } */
+
+void foo (int a, int b, int c, int d, int e, int f, int g);
+
+static void bar (int a, ...)
+{
+  __builtin_apply (foo, __builtin_apply_args (), 20);
+}
+
+int
+main ()
+{
+  bar (1024, 1025, 1026, 1027, 1028, 1029, 1030);
+  return 0;
+}