[committed] Avoid right shifting signed value on ext-dce.cc

This is analogous to a prior patch to ext-dce which fixes propagation of sign
bits, but this time for the saturating variants.  I'd held off fixing those
because I wanted the time to look at that code (since we don't have a testcase
for it as far as I know).

Not surprisingly, putting an abort on that path and running an x86 bootstrap
and testsuite run, it never triggers.  Of course not a lot of code tries to do
saturating shifts.

Anyway, bootstrapped and regression tested on x86_64.  Pushing to the trunk.

Thanks for everyone's patience.

gcc/
	* ext-dce.cc (carry_backpropagate): Cast mask to HOST_WIDE_INT before
	shifting.
This commit is contained in:
Jeff Law 2024-08-17 15:10:38 -06:00
parent efcfd1d2ad
commit 61e179b1b3

View file

@ -556,7 +556,7 @@ carry_backpropagate (unsigned HOST_WIDE_INT mask, enum rtx_code code, rtx x)
>> (INTVAL (XEXP (x, 1))
+ (XEXP (x, 1) != const0_rtx
&& code == SS_ASHIFT))))
| (mask >> INTVAL (XEXP (x, 1))));
| ((HOST_WIDE_INT)mask >> INTVAL (XEXP (x, 1))));
}
return mmask;