[llvm] [AMDGPU] Fix fmed3 InstCombine fold miscompiling NaN inputs (PR #216970)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 18 03:44:18 PDT 2026
================
@@ -1664,7 +1675,19 @@ GCNTTIImpl::instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II) const {
Swap = true;
}
- if (isa<Constant>(Src1) && !isa<Constant>(Src2)) {
+ // Under ieee=1, an snan in src0/src1 selects src2 but an snan in src2
+ // yields qnan, so src2 can't swap in freely; ieee=0 is symmetric.
+ auto CanMoveConstantToSrc2 = [&]() {
----------------
arsenm wrote:
Can you make this not-a-lambda and give it a better name?
I feel like this whole function is trying too hard to handle snan when correct snan handling essentially doesn't exist in non-strictfp llvm IR
https://github.com/llvm/llvm-project/pull/216970
More information about the llvm-commits
mailing list