diff options
author | Jan Voung <jvoung@gmail.com> | 2024-06-24 08:46:31 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-24 08:46:31 -0400 |
commit | 0cf1e662b13fb20d3897c5b9055c60b0de50beca (patch) | |
tree | 476fb5dc0a761d47ed21ed99e486ac2917ecd06b /llvm/lib/Target/DirectX/DirectXTargetMachine.cpp | |
parent | 6e3725d7f290d0180e8b5cfe073d0cc4c9bbafd0 (diff) | |
download | llvm-0cf1e662b13fb20d3897c5b9055c60b0de50beca.zip llvm-0cf1e662b13fb20d3897c5b9055c60b0de50beca.tar.gz llvm-0cf1e662b13fb20d3897c5b9055c60b0de50beca.tar.bz2 |
[clang] Skip auto-init on scalar vars that have a non-constant Init and no self-ref (#94642)
In that scalar case, the Init should initialize the auto var before use. The Init might use uninitialized memory from other sources (e.g., heap) but auto-init did not help us in that case because the auto-init would have been overwritten by the Init before use.
For non-scalars e.g., classes, the Init expr might be a ctor call that leaves uninitialized members, so we leave the auto-init there.
The motivation is to have less IR for the optimizer to later remove, which may not be until a fairly late pass (DSE) or may not get optimized in lower optimization levels like O1 (no DSE) or sometimes due to derefinement.
This is ~10% less left-over auto-init in O1 in a few examples checked.
Diffstat (limited to 'llvm/lib/Target/DirectX/DirectXTargetMachine.cpp')
0 files changed, 0 insertions, 0 deletions