[llvm] [RISCV][MC] Pass MCSubtargetInfo down to shouldForceRelocation and evaluateTargetFixup. (PR #73721)

Andreu Carminati via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 29 02:39:35 PST 2023


andcarminati wrote:

I think this PR can fix the problem by dealing with Subtarget features on a per-function basis, which is really nice. But, I have some comments:

1 - Relaxation is "on" by default for RISC-V code generation and we have a really huge mechanism to control the turn-off of this feature (I really don't know how common this case is).
2 - What about controlling relaxation directly on the linker through the --relax/--no-relax options? For this case, we just need to generate relaxation always. I'm aware of branch relocation, but I'm considering the uncommon case.
3 - No other targets need subtarget features inspection to force relocation, so the only real client of this change is RISCV.
4 - Your solution is correct because it does not need some sort of forwarding of the relax front-end option to the back-end. Such a solution should require the same manual -Wl, -mllvm, etc. linker option passing for LTO to work (or even LLC), which is not interesting and error-prone.

Regards!


https://github.com/llvm/llvm-project/pull/73721


More information about the llvm-commits mailing list