Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Significant Increase in binary size and stack usage with clang 18.x #84178

@MarcoSpeziali

Description

@MarcoSpeziali

Greetings,

I've encountered a significant change in the behavior of clang's LLVM-IR emission between versions, specifically when comparing the output of clang 17.0.1 with the trunk version for the RISC-V rv32gc target. The IR and the resultant ELF file sizes show a marked increase in the .text section size, with a difference of approximately 1200 bytes (from 0005e8 to 000a88).

This issue is not confined to the RISC-V target alone. I have observed a similar pattern with a fork of the llvm-project (updated to the release/18.x branch two days ago) for our custom backend.

Furthermore, it appears that the clang version 18.x and later are utilizing significantly more stack space, which has led to stack overflow errors in our testing environment (having just 2K of RAM).

For reference and further examination, I have provided an example here: https://godbolt.org/z/qeTae411h.

Could there have been changes in clang's optimization strategies or IR emission patterns from version 17.0.1 to the trunk that might explain these observations? Any insights or suggestions on mitigating these issues (perhaps some new compilation flags)?

Metadata

Metadata

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions