https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103882
Jose Silva <krystalgamer at protonmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|INVALID |WORKSFORME --- Comment #15 from Jose Silva <krystalgamer at protonmail dot com> --- > IPA RA is a very useful optimization, not something terrible. > that would penalize millions of correctly written inline asm statements in > real-world code It's a useful optimization but GCC offers a terrible implementation of it. As I elaborated before, if I have to always tell the compiler what my inline asm is doing then it's just garbage. If no clobber information is provided the compiler should just bail out of the IPA RA for that given function and follow the ABI strictly. It could also emit a warning telling the programmer that by not providing clobber information the optimization is not as good. With clobber information it should just trust the programmer. If by "correctly written inline asm statements" you mean statements with clobber information, then they wouldn't be penalized because they are providing the necessary information. ~Sensible defaults~ is what I'm talking about. Have you considered that users don't want to RE the kernel just to see what registers are being clobbered? The ABI exists for that reason, if everyone follows that there is no problem. > (except that __attribute__((naked)) > Or just use the syscall function, see syscall(2) man page. > And I've only spent last 23+ years working on GCC, so yes, I can't know the > codebase enough. naked is not supported as an attribute for MIPS targets. It was the first thing I tried when trying to stop the compiler from optimizing the code. The `syscall` function is useless for me because the platform I'm targeting passes the number in $v1 and not $a0. And as I said in the original post, I'm using `-nostdlib' so there's no access to the `syscall` function. Stop making bad suggestions to try and justify a bad compiler optimization implementation. > A hack that you want to propose (forcing noipa on functions that use inline > asm) certainly won't be accepted I have no interest in upstreaming my changes. It was clear from the thread you had no interest in it. I just requested some guidance on the toxic wasteland that is the GCC codebase. If you don't want to help, don't bother responding.