[all-commits] [llvm/llvm-project] 6b1b4c: [RISCV][clang] Don't enable -mrelax-all for -O0 on...
Craig Topper via All-commits
all-commits at lists.llvm.org
Mon Apr 22 12:04:37 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 6b1b4c1c54d4276409c336eaf6d47b3bc04035c3
https://github.com/llvm/llvm-project/commit/6b1b4c1c54d4276409c336eaf6d47b3bc04035c3
Author: Craig Topper <craig.topper at sifive.com>
Date: 2024-04-22 (Mon, 22 Apr 2024)
Changed paths:
M clang/lib/Driver/ToolChains/Clang.cpp
M clang/test/Driver/integrated-as.c
Log Message:
-----------
[RISCV][clang] Don't enable -mrelax-all for -O0 on RISC-V (#88538)
-O0 implies -mrelax-all as an assembler compile time optimization.
-mrelax-all allows the assembler to complete layout in 2 passes instead
of doing iterative branch relaxation.
Jump offsets larger than +/-1MiB require an indirect jump on RISC-V.
This can't be done by the assembler, so we use a branch relaxation MIR
pass and use register scavenging to find a free register.
The conditional branch offsets for RISC-V are also somewhat small so we
support MC layer branch relaxation to make life easier for assembly
programmers. This may also cover up bugs in our function size estimation
in MachineIR.
Enabling -mrelax-all causes the MC layer relaxation to agressively relax
branches. This increases code size and can create cases where we need an
indirect jump, but we can't create one. This leads to linker failures.
The easiest way to avoid this is to not default to -mrelax-all for -O0
and sacrifice the compile time optimization. That's what this patch
does.
Fixes #87127
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list