diff options
author | Yashwant Singh <yashwants@nvidia.com> | 2024-07-02 11:59:39 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-02 11:59:39 +0530 |
commit | cd1e6a587be6352f63f180b1ff5e0a348a8da444 (patch) | |
tree | f768b70080a51a3f0009cac93479e2df5443494f /clang/lib/Frontend/InitPreprocessor.cpp | |
parent | 7ee421d29612ae919edfe7250b87e3c738d66a26 (diff) | |
download | llvm-cd1e6a587be6352f63f180b1ff5e0a348a8da444.zip llvm-cd1e6a587be6352f63f180b1ff5e0a348a8da444.tar.gz llvm-cd1e6a587be6352f63f180b1ff5e0a348a8da444.tar.bz2 |
[SROA] Propagate no-signed-zeros(nsz) fast-math flag on the phi node using function attribute (#83381)
Its expected that the sequence `return X > 0.0 ? X : -X`, compiled with
-Ofast, produces fabs intrinsic. However, at this point, LLVM is unable
to do so.
The above sequence goes through the following transformation during the
pass pipeline:
1) SROA pass generates the phi node. Here, it does not infer the
fast-math flags on the phi node unlike clang frontend typically does.
2) Phi node eventually gets translated into select instruction.
Because of missing no-signed-zeros(nsz) fast-math flag on the select
instruction, InstCombine pass fails to fold the sequence into fabs
intrinsic.
This patch, as a part of SROA, tries to propagate nsz fast-math flag on
the phi node using function attribute enabling this folding.
Closes #51601
Co-authored-by: Sushant Gokhale <sgokhale@nvidia.com>
Diffstat (limited to 'clang/lib/Frontend/InitPreprocessor.cpp')
0 files changed, 0 insertions, 0 deletions