On 2/25/24 20:30, HAO CHEN GUI wrote:
Hi,
This patch tries to fix a potential problem which is raised by the patch
for PR111267. The volatile asm operand tries to be propagated to a single
set insn with the patch for PR111267. It has potential risk as the behavior
is wrong. Currently set_src_cost comparison can reject such propagation.
But the propagation might be taken after replacing set_src_cost with insn
cost. Actually I found the problem in testing my patch which replacing
et_src_cost with insn cost for fwprop.
Bootstrapped and tested on x86 and powerpc64-linux BE and LE with no
regressions. Is it OK for the trunk?
Thanks
Gui Haochen
ChangeLog
fwprop: Avoid volatile defines to be propagated
The patch for PR111267 (commit id 86de9b66480b710202a2898cf513db105d8c432f)
which introduces an exception for propagation on single set insn. The
propagation which might not be profitable (checked by profitable_p) is still
allowed to be propagated to single set insn. It has a potential problem
that a volatile asm operand will try to be propagated to a single set insn.
The volatile asm operand is originally banned in profitable_p. This patch
fixes the problem by skipping volatile set source in define set finding.
gcc/
* fwprop.cc (forward_propagate_into): Return false for volatile set
source.
gcc/testsuite/
* gcc.target/powerpc/fwprop-1.c: New.
Why specifically are you worried here? Propagation of a volatile
shouldn't in and of itself cause a problem. We're not changing the
number of volatile accesses or anything like that -- we're just moving
them around a bit.
Jeff