https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82677

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #15 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The fix for LIM is now included in GCC 15. Marking the rest of this as a dup of
PR 102150 .

This part:
```
AIUI, asm() without volatile, says to GCC: "this code will *never* cause side
effects under *any circumstance*, it depends only on its declared
inputs/outputs/clobbers". Under this assumption, it is correct to optimise

|   if(d) { asm(d); ... } ...

into

|   asm(d); if(d) { ... }

as long as the outputs to asm(d) don't clobber the inputs to if(d) or any
else-branches - I assume other parts of the optimiser will already check that.
```

is fixed by r15-7495 (recorded in PR 102150). The trapping part is not even
relevant here, inline-asm cost is not able to be modeled so moving it before
the if is not even cost friendly either.

I will also be changing the documentation in the next few days/weeks to read
easier to understand for folks and understand that what it means to move
outside of the loop (meaning it might only be executed once instead of multiply
times during the loop). And that it might be deleted still (unlike with
volatile). 

We don't want to mark inline-asm as trapping because that has issues with both
setjmp and non-call exceptions (which I won't get into here, there is another
bug about adding EH with non-call exceptions for volatile inline-asm).

But basically the idea now is we are treating inline-asm as trapping if it
becomes unconditional and with an unknown cost for ifcvt; both together solves
the issue folks normally run into even.

*** This bug has been marked as a duplicate of bug 102150 ***

Reply via email to