[llvm] [InstCombine] Avoid crash on aggregate types in SimplifyDemandedUseFPClass (PR #111128)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 4 03:29:24 PDT 2024


================
@@ -1919,6 +1919,19 @@ Value *InstCombinerImpl::SimplifyDemandedVectorElts(Value *V,
 /// For floating-point classes that resolve to a single bit pattern, return that
 /// value.
 static Constant *getFPClassConstant(Type *Ty, FPClassTest Mask) {
+  // TODO: Support aggregate types that are allowed by FPMathOperator.
+  switch (Mask) {
+    case fcPosZero:
+    case fcNegZero:
+    case fcPosInf:
+    case fcNegInf:
+      if (Ty->isAggregateType())
+        return nullptr;
----------------
nikic wrote:

It's okay to do this unconditionally, without repeating the switch.

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


More information about the llvm-commits mailing list