From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2053) id D9139396EC67; Thu, 3 Dec 2020 09:51:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D9139396EC67 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Ilya Leoshkevich To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-5702] tree-ssa-threadedge.c (record_temporary_equivalences_from_stmts_at_dest): Do not allow __builtin_con X-Act-Checkin: gcc X-Git-Author: Ilya Leoshkevich X-Git-Refname: refs/heads/master X-Git-Oldrev: 73564433f519ba0db6f1222e829518f16028c0e2 X-Git-Newrev: 614aff0adf8fba5d843ec894603160151c20f0aa Message-Id: <20201203095104.D9139396EC67@sourceware.org> Date: Thu, 3 Dec 2020 09:51:04 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 09:51:05 -0000 https://gcc.gnu.org/g:614aff0adf8fba5d843ec894603160151c20f0aa commit r11-5702-g614aff0adf8fba5d843ec894603160151c20f0aa Author: Ilya Leoshkevich Date: Thu Dec 3 01:38:47 2020 +0100 tree-ssa-threadedge.c (record_temporary_equivalences_from_stmts_at_dest): Do not allow __builtin_constant_p. 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 * tree-ssa-threadedge.c (record_temporary_equivalences_from_stmts_at_dest): Do not allow __builtin_constant_p on a threading path. Diff: --- gcc/tree-ssa-threadedge.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c index f43d5812270..32d63a95af4 100644 --- a/gcc/tree-ssa-threadedge.c +++ b/gcc/tree-ssa-threadedge.c @@ -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++;