[llvm] [InstCombine] Avoid crash on aggregate types in SimplifyDemandedUseFPClass (PR #111128)
Benjamin Maxwell via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 4 05:42:04 PDT 2024
================
@@ -1919,17 +1919,26 @@ 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) {
- switch (Mask) {
- case fcPosZero:
+ if (Mask == fcNone)
+ return PoisonValue::get(Ty);
+
+ if (Mask == fcPosZero) {
+ if (Ty->isAggregateType())
+ return ConstantAggregateZero::get(Ty);
return ConstantFP::getZero(Ty);
+ }
----------------
MacDue wrote:
Nice, thanks :+1:
https://github.com/llvm/llvm-project/pull/111128
More information about the llvm-commits
mailing list