]> git.ipfire.org Git - thirdparty/gcc.git/commit
loop-invariant: Treat inline-asm conditional trapping [PR102150]
authorAndrew Pinski <quic_apinski@quicinc.com>
Wed, 12 Feb 2025 05:00:06 +0000 (21:00 -0800)
committerAndrew Pinski <quic_apinski@quicinc.com>
Wed, 12 Feb 2025 22:34:58 +0000 (14:34 -0800)
commit8598a84bf5ca91ddd26f3bf6f944b0235cfa06b4
tree3c7334c5e6b43aa73fdf27e63379ba611451f970
parentaa972d027437784686dfc66180dc1b640e7dbb39
loop-invariant: Treat inline-asm conditional trapping [PR102150]

So inline-asm is known not to trap BUT it can have undefined behavior
if made executed speculatively. This fixes the loop invariant pass to
treat it similarly as trapping cases. If the inline-asm could be executed
always, then it will be pulled out of the loop; otherwise it will be kept
inside the loop.

Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

PR rtl-optimization/102150
* loop-invariant.cc (find_invariant_insn): Treat inline-asm similar to
trapping instruction and only move them if always executed.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
gcc/loop-invariant.cc