tree-ssa-threadedge.c (record_temporary_equivalences_from_stmts_at_dest): Do not...
authorIlya Leoshkevich <iii@linux.ibm.com>
Thu, 3 Dec 2020 00:38:47 +0000 (01:38 +0100)
committerIlya Leoshkevich <iii@linux.ibm.com>
Thu, 3 Dec 2020 09:50:32 +0000 (10:50 +0100)
This is the same as commit 70a62009181f ("tree-ssa-threadbackward.c
(profitable_jump_thread_path): Do not allow __builtin_constant_p."), but
for the old forward threader.

gcc/ChangeLog:

2020-12-03  Ilya Leoshkevich  <iii@linux.ibm.com>

* tree-ssa-threadedge.c (record_temporary_equivalences_from_stmts_at_dest):
Do not allow __builtin_constant_p on a threading path.

gcc/tree-ssa-threadedge.c

index f43d58122707ab82efd6d0c11248100193e5c0da..32d63a95af4217aa9917772d0f62cadbf946f06c 100644 (file)
@@ -265,6 +265,12 @@ record_temporary_equivalences_from_stmts_at_dest (edge e,
          && gimple_call_internal_unique_p (stmt))
        return NULL;
 
+      /* We cannot thread through __builtin_constant_p, because an
+        expression that is constant on two threading paths may become
+        non-constant (i.e.: phi) when they merge.  */
+      if (gimple_call_builtin_p (stmt, BUILT_IN_CONSTANT_P))
+       return NULL;
+
       /* If duplicating this block is going to cause too much code
         expansion, then do not thread through this block.  */
       stmt_count++;