mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-28 09:31:03 +00:00
don't crash when trying to constant fold packed expressions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25072 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2054295796
commit
d15ed59734
@ -328,6 +328,29 @@ struct NullPointerRules : public TemplateRules<ConstantPointerNull,
|
||||
}
|
||||
};
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// ConstantPackedRules Class
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/// PackedTypeRules provides a concrete base class of ConstRules for
|
||||
/// ConstantPacked operands.
|
||||
///
|
||||
struct ConstantPackedRules
|
||||
: public TemplateRules<ConstantPacked, ConstantPackedRules> {
|
||||
};
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// GeneralPackedRules Class
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/// GeneralPackedRules provides a concrete base class of ConstRules for
|
||||
/// PackedType operands, where both operands are not ConstantPacked. The usual
|
||||
/// cause for this is that one operand is a ConstantAggregateZero.
|
||||
///
|
||||
struct GeneralPackedRules : public TemplateRules<Constant, GeneralPackedRules> {
|
||||
};
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// DirectRules Class
|
||||
@ -487,6 +510,8 @@ ConstRules &ConstRules::get(const Constant *V1, const Constant *V2) {
|
||||
static EmptyRules EmptyR;
|
||||
static BoolRules BoolR;
|
||||
static NullPointerRules NullPointerR;
|
||||
static ConstantPackedRules ConstantPackedR;
|
||||
static GeneralPackedRules GeneralPackedR;
|
||||
static DirectIntRules<ConstantSInt, signed char , &Type::SByteTy> SByteR;
|
||||
static DirectIntRules<ConstantUInt, unsigned char , &Type::UByteTy> UByteR;
|
||||
static DirectIntRules<ConstantSInt, signed short, &Type::ShortTy> ShortR;
|
||||
@ -517,6 +542,10 @@ ConstRules &ConstRules::get(const Constant *V1, const Constant *V2) {
|
||||
case Type::ULongTyID: return ULongR;
|
||||
case Type::FloatTyID: return FloatR;
|
||||
case Type::DoubleTyID: return DoubleR;
|
||||
case Type::PackedTyID:
|
||||
if (isa<ConstantPacked>(V1) && isa<ConstantPacked>(V2))
|
||||
return ConstantPackedR;
|
||||
return GeneralPackedR; // Constant folding rules for ConstantAggregateZero.
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user