From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2119) id 708663858C2D; Tue, 11 Oct 2022 04:45:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 708663858C2D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665463551; bh=2wWQVwsDfMH3UpMj3CuJXQNMRPf+/jjz7Y0b2SoMjh0=; h=From:To:Subject:Date:From; b=d3e6AJis/MC3WkZczgipz6FaEKIqLl8xNwbnouCOS5iQYegC+s+Eak11XlxLPgFfg zYgwrfVCrqFSjcpHE/QDU1v5Tu0HQt1dW7aMLYVoPa3eMN2PlzN0pXt1LfV6KeRmAz mUQILSUCmfHZzCgilsCINFDdZXQR7UpQcx7IzymY= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jeff Law To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-3211] [PR rtl-optimization/107182] Clear EDGE_CROSSING for jump->ret optimization X-Act-Checkin: gcc X-Git-Author: Jeff Law X-Git-Refname: refs/heads/master X-Git-Oldrev: d2efb10a19b3948e48a2d9273b294db4e1d65296 X-Git-Newrev: db24bdc743cf23ea12d2dcf8254d86ab366bb46d Message-Id: <20221011044551.708663858C2D@sourceware.org> Date: Tue, 11 Oct 2022 04:45:51 +0000 (GMT) List-Id: https://gcc.gnu.org/g:db24bdc743cf23ea12d2dcf8254d86ab366bb46d commit r13-3211-gdb24bdc743cf23ea12d2dcf8254d86ab366bb46d Author: Jeff Law Date: Tue Oct 11 00:44:26 2022 -0400 [PR rtl-optimization/107182] Clear EDGE_CROSSING for jump->ret optimization When turning a jump to a return into a return, we need to clear EDGE_CROSSING of the fallthru edge to prevent a checking failure. I considered not applying the transformation when the edge has EDGE_CROSSING set, but it still seems like we ought to eliminate the unnecessary jump in that case. gcc/ PR rtl-optimization/107182 * cfgrtl.cc (fixup_reorder_chain): When optimizing a jump to a return, clear EDGE_CROSSING on the appropriate edge. Diff: --- gcc/cfgrtl.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/cfgrtl.cc b/gcc/cfgrtl.cc index 281a432f6a6..f31941a61f9 100644 --- a/gcc/cfgrtl.cc +++ b/gcc/cfgrtl.cc @@ -4055,6 +4055,7 @@ fixup_reorder_chain (void) ret_label = PATTERN (ret); dest = EXIT_BLOCK_PTR_FOR_FN (cfun); + e_fall->flags &= ~EDGE_CROSSING; /* E_FALL->dest might become unreachable as a result of replacing the jump with a return. So arrange to remove unreachable blocks. */