[llvm] InstCombine: Fix defining undef constant vector elts in SimplifyDemandedFPClass (PR #174074)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 1 07:48:31 PST 2026


================
@@ -2048,8 +2048,18 @@ Value *InstCombinerImpl::SimplifyDemandedUseFPClass(Value *V,
   if (!I) {
     // Handle constants and arguments
     Known = computeKnownFPClass(V, fcAllFlags, CxtI, Depth + 1);
-    Value *FoldedToConst =
-        getFPClassConstant(VTy, DemandedMask & Known.KnownFPClasses);
+
+    FPClassTest ValidResults = DemandedMask & Known.KnownFPClasses;
+    if (ValidResults == fcNone)
+      return isa<UndefValue>(V) ? nullptr : PoisonValue::get(VTy);
----------------
arsenm wrote:

This was to prevent infinite looping. This pattern is copied from the other return, so I don't remember the exact details.

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


More information about the llvm-commits mailing list