llvm-project
cd1e6a58 - [SROA] Propagate no-signed-zeros(nsz) fast-math flag on the phi node using function attribute (#83381)

Commit
1 year ago
[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>
Author
Parents
Loading