[all-commits] [llvm/llvm-project] 183768: [Driver] Don't default to -mrelax-all for non-RISC...
Fangrui Song via All-commits
all-commits at lists.llvm.org
Thu Apr 25 09:28:16 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 18376810f359dbd39d2a0aa0ddfc0f7f50eac199
https://github.com/llvm/llvm-project/commit/18376810f359dbd39d2a0aa0ddfc0f7f50eac199
Author: Fangrui Song <i at maskray.me>
Date: 2024-04-25 (Thu, 25 Apr 2024)
Changed paths:
M clang/lib/Driver/ToolChains/Clang.cpp
M clang/test/Driver/integrated-as.c
Log Message:
-----------
[Driver] Don't default to -mrelax-all for non-RISCV -O0
Some assembly mnemonics may assemble to instructions of different
lengths. The longer form is to support instructions like a long branch.
On X86, -mrelax-all enables `MCRelaxAll`, which expands instructions to
the long form regardless of whether a short form suffices, while
-mno-relax-all only expands instructions when needed.
```
// x86 example
void foo(int a) {
// -mno-relax-all or gas: short jump (2 bytes)
// -mrelax-all: near jump (6 bytes)
if (a) bar();
}
```
The -mrelax-all default for non-RISCV -O0 appears to only affect x86 and
increases code size without any compile time difference for a stage-2
x86-64 build of lld.
```
-mrelax-all: file size: 60.9MiB VM size: 52.4MiB
-mno-relax-all: file size: 58.2MiB VM size: 49.7MiB
```
There is no compile time difference (other than noise) GNU assembler
doesn't expand instructions by default. Let's remove the -mrelax-all default.
Pull Request: https://github.com/llvm/llvm-project/pull/90013
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