mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 21:08:36 +00:00
stage1: Ask LLVM to produce compact code in ReleaseSize mode
Let's follow what Clang does for -Oz and apply the `minsize` and `optsize` attributes by default. Closes #7048 Supersedes #7077
This commit is contained in:
parent
eaa1db2002
commit
10b1001a12
@ -484,6 +484,12 @@ static LLVMValueRef make_fn_llvm_value(CodeGen *g, ZigFn *fn) {
|
||||
addLLVMFnAttrInt(llvm_fn, "alignstack", fn->alignstack_value);
|
||||
}
|
||||
|
||||
if (g->build_mode == BuildModeSmallRelease) {
|
||||
// Optimize for small code size.
|
||||
addLLVMFnAttr(llvm_fn, "minsize");
|
||||
addLLVMFnAttr(llvm_fn, "optsize");
|
||||
}
|
||||
|
||||
addLLVMFnAttr(llvm_fn, "nounwind");
|
||||
add_uwtable_attr(g, llvm_fn);
|
||||
addLLVMFnAttr(llvm_fn, "nobuiltin");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user