[llvm] InstCombine: Handle canonicalize in SimplifyDemandedFPClass (PR #173189)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 23 11:17:03 PST 2025


================
@@ -323,9 +313,7 @@ define nofpclass(nan) float @ret_nofpclass_nan__canonicalize_select_unknown_or_s
 ; CHECK-LABEL: define nofpclass(nan) float @ret_nofpclass_nan__canonicalize_select_unknown_or_snan(
 ; CHECK-SAME: float [[X:%.*]], i1 [[COND:%.*]]) {
 ; CHECK-NEXT:    [[SNAN:%.*]] = call float @returns_snan()
-; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[COND]], float [[X]], float [[SNAN]]
-; CHECK-NEXT:    [[CANON:%.*]] = call float @llvm.canonicalize.f32(float [[SELECT]])
-; CHECK-NEXT:    ret float [[CANON]]
+; CHECK-NEXT:    ret float [[X]]
----------------
arsenm wrote:

No, the snan case is not returned since that would be poison. It returns the only possible non-poison result 

https://github.com/llvm/llvm-project/pull/173189


More information about the llvm-commits mailing list