[llvm] [DAGCombiner] Honor rewrite semantics of fast-math flags in fdiv combine (PR #167595)
Mikołaj Piróg via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 2 08:33:52 PDT 2026
================
@@ -19223,26 +19224,32 @@ SDValue DAGCombiner::visitFDIV(SDNode *N) {
DAG.getConstantFP(Recip, DL, VT));
}
- if (Flags.hasAllowReciprocal()) {
+ // Rewriting 1 / sqrt(Y) to rsqrt(Y) requires contract
+ if (sd_match(N, m_Flags<SDNodeFlags::AllowReciprocal |
+ SDNodeFlags::AllowContract>())) {
----------------
mikolaj-pirog wrote:
So you're suggesting to bring back the m_AllowRecpirocal and others for freestanding usage and removing m_Flags or to require m_Value instead of no argument?
My thinking with m_Flags was to have it similar to other matchers like fsqrt one, accepting flags in template, instead of previous approach
https://github.com/llvm/llvm-project/pull/167595
More information about the llvm-commits
mailing list