gcc/0179-rtl-ifcvt-refuse-to-rename-def-in-the-last-instructi.patch
2023-12-23 19:08:59 +08:00

30 lines
927 B
Diff

From 3d1b0da292e383ce2a139c1612ec7e07336bbcd8 Mon Sep 17 00:00:00 2001
From: vchernon <chernonog.vyacheslav@huawei.com>
Date: Fri, 22 Dec 2023 22:05:27 +0800
Subject: [PATCH 3/4] [rtl-ifcvt] refuse to rename def in the last instruction
in BB
---
gcc/ifcvt.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index 3df0f6fdd..025eb6cd1 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -2176,7 +2176,10 @@ noce_rename_regs_in_bb (basic_block test_bb, bitmap rename_regs)
rtx x = SET_DEST (sset);
if (!REG_P (x) || !bitmap_bit_p (rename_regs, REGNO (x)))
continue;
-
+ /* Do not need to rename dest in the last instruction
+ it will be renamed anyway. */
+ if (insn == last_insn)
+ continue;
machine_mode mode = GET_MODE (x);
rtx tmp = gen_reg_rtx (mode);
if (!validate_replace_rtx_part (x, tmp, &SET_DEST (sset), insn))
--
2.33.0