3 ms·
> Shouldn't basically all the code that made these terrible decisions be shared between all backends? What makes you think this? The "middle-end" (in GCC-lingo
by qayxc 4y ago
> Shouldn't basically all the code that made these terrible decisions be shared between all backends?
What makes you think this? The "middle-end" (in GCC-lingo) is where architecture-specific optimisations happen and that needs to be modified on a per-architecture basis. As an obvious example, not all CPUs have vector instructions, yet auto-vectorisation is part of the optimisation passes for architectures that support it.
There's several ways of doing this, but the assembly-emitter (i.e. the "backend") is not the part concerned with that at all.
- 3836293648 4y agoBecause the issues aren't codegen, they're weird, broken optimisations. Loading values several times, subtracting zero. Why would gcc have several register allocators instead of one slightly more configurable one? Why aren't useless actions (subtract by zero) removed in generic optimisation? Of course there are architecture specific optimisations, but the examples provided here are not of that kind
- qayxc 4y agogcc is a complex beast and optimisation is hard. There's no such such thing as "generic optimisations" that remove useless actions, because depending on the hardware, certain seemingly useless actions are actually required to make correctness guarantees. Without access to the offending source code, one can only speculate what actually led to this result. Another problem is simply that there's probably only a handful of people, likely employed by a single company or two, who maintain the parts for this specific architecture. It's very likely that there are too few users who actually report this kind of issues and too few resources available to test and address them. It's not an issue with gcc or its optimiser in general.
- 3836293648 4y agoAh. I thought GCC was more similar to LLVM in that aspect, which definitely has a generic optimiser, though different users of the library enable different ones