aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJeff Law <jlaw@ventanamicro.com>2024-07-15 18:15:33 -0600
committerJeff Law <jlaw@ventanamicro.com>2024-07-15 18:15:33 -0600
commitb31b8af807f5459674b0b310cb62a5bc81b676e7 (patch)
tree91df4d875c7984acdf8b89b55361592e331739ea /gcc
parent94b21f13763638f64e83e7f9959c7f1523b9eaed (diff)
downloadgcc-b31b8af807f5459674b0b310cb62a5bc81b676e7.zip
gcc-b31b8af807f5459674b0b310cb62a5bc81b676e7.tar.gz
gcc-b31b8af807f5459674b0b310cb62a5bc81b676e7.tar.bz2
Fix liveness computation for shift/rotate counts in ext-dce
So as I've noted before I believe the control flow in ext-dce.cc is horribly messy. While investigating a fix for 115877 I came across another problem related to control flow handling. Specifically, if we have an binary op which implies the 2nd operand is fully live, then we'd actually fail to mark that operand as live. We essentially broke out of the loop which was supposed to be safe. But Y was a REG and if Y is a REG or CONST_INT we skip sub-rtxs and thus failed to process that operand (the shift count) at all. Rather than muck around with control flow, we can just set all the bits as live in DST_MASK and let normal processing continue. With all the bits live IN DST_MASK all the bits implied by the mode of the argument will also be live. No testcase. Bootstrapped and regression tested on x86. Pushing to the trunk. gcc/ * ext-dce.cc (ext_dce_process_uses): Simplify control flow and fix liveness computation for shift/rotate counts.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ext-dce.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/ext-dce.cc b/gcc/ext-dce.cc
index 2869a38..6c961fe 100644
--- a/gcc/ext-dce.cc
+++ b/gcc/ext-dce.cc
@@ -632,10 +632,11 @@ ext_dce_process_uses (rtx_insn *insn, rtx obj, bitmap live_tmp)
else if (!CONSTANT_P (y))
break;
- /* We might have (ashift (const_int 1) (reg...)) */
- /* XXX share this logic with code below. */
+ /* We might have (ashift (const_int 1) (reg...))
+ By setting dst_mask we can continue iterating on the
+ the next operand and it will be considered fully live. */
if (binop_implies_op2_fully_live (GET_CODE (src)))
- break;
+ dst_mask = -1;
/* If this was anything but a binary operand, break the inner
loop. This is conservatively correct as it will cause the