ifcvt: Don't speculation move inline-asm [PR102150]
Checks
| Context |
Check |
Description |
| linaro-tcwg-bot/tcwg_gcc_build--master-arm |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_simplebootstrap_build--master-arm-bootstrap |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_gcc_check--master-arm |
success
|
Test passed
|
| linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_simplebootstrap_build--master-aarch64-bootstrap |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 |
fail
|
Patch failed to apply
|
Commit Message
So unlike loop invariant motion, moving an inline-asm out of an
if is not always profitable and the cost estimate for the instruction
inside inline-asm is unknown.
This is a regression from GCC 4.6 which didn't speculatively move inline-asm
as far as I can tell.
Bootstrapped and tested on x86_64-linux-gnu.
PR rtl-optimization/102150
gcc/ChangeLog:
* ifcvt.cc (cheap_bb_rtx_cost_p): Return false if the insn
has an inline-asm in it.
Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
---
gcc/ifcvt.cc | 6 ++++++
1 file changed, 6 insertions(+)
Comments
On Wed, Feb 12, 2025 at 5:39 AM Andrew Pinski <quic_apinski@quicinc.com> wrote:
>
> So unlike loop invariant motion, moving an inline-asm out of an
> if is not always profitable and the cost estimate for the instruction
> inside inline-asm is unknown.
>
> This is a regression from GCC 4.6 which didn't speculatively move inline-asm
> as far as I can tell.
> Bootstrapped and tested on x86_64-linux-gnu.
OK.
Thanks,
Richard.
> PR rtl-optimization/102150
> gcc/ChangeLog:
>
> * ifcvt.cc (cheap_bb_rtx_cost_p): Return false if the insn
> has an inline-asm in it.
>
> Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
> ---
> gcc/ifcvt.cc | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/gcc/ifcvt.cc b/gcc/ifcvt.cc
> index cb5597bc171..707937ba2f0 100644
> --- a/gcc/ifcvt.cc
> +++ b/gcc/ifcvt.cc
> @@ -166,6 +166,12 @@ cheap_bb_rtx_cost_p (const_basic_block bb,
> {
> if (NONJUMP_INSN_P (insn))
> {
> + /* Inline-asm's cost is not very estimatable.
> + It could be a costly instruction but the
> + estimate would be the same as a non costly
> + instruction. */
> + if (asm_noperands (PATTERN (insn)) >= 0)
> + return false;
> int cost = insn_cost (insn, speed) * REG_BR_PROB_BASE;
> if (cost == 0)
> return false;
> --
> 2.43.0
>
@@ -166,6 +166,12 @@ cheap_bb_rtx_cost_p (const_basic_block bb,
{
if (NONJUMP_INSN_P (insn))
{
+ /* Inline-asm's cost is not very estimatable.
+ It could be a costly instruction but the
+ estimate would be the same as a non costly
+ instruction. */
+ if (asm_noperands (PATTERN (insn)) >= 0)
+ return false;
int cost = insn_cost (insn, speed) * REG_BR_PROB_BASE;
if (cost == 0)
return false;