https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102150
--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Andrew Pinski <pins...@gcc.gnu.org>: https://gcc.gnu.org/g:8598a84bf5ca91ddd26f3bf6f944b0235cfa06b4 commit r15-7496-g8598a84bf5ca91ddd26f3bf6f944b0235cfa06b4 Author: Andrew Pinski <quic_apin...@quicinc.com> Date: Tue Feb 11 21:00:06 2025 -0800 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_apin...@quicinc.com>