[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 05:32:16 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);
+ }
----------------
nikic wrote:
```suggestion
if (Mask == fcPosZero) {
return Constant::getNullValue(Ty);
```
https://github.com/llvm/llvm-project/pull/111128
More information about the llvm-commits
mailing list