[llvm] 264afb9 - [NFC][llvm] Make the contructors of `ElementCount` private.

Voss, Matthew via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 19 13:51:18 PDT 2020


Looks like the new patch builds on Windows. Do the comments needs be updated, or can this be committed?

> -----Original Message-----
> From: Francesco Petrogalli <Francesco.Petrogalli at arm.com>
> Sent: Wednesday, August 19, 2020 1:07 PM
> To: Voss, Matthew <Matthew.Voss at sony.com>; Francesco Petrogalli
> <llvmlistbot at llvm.org>
> Cc: LLVM Commits <llvm-commits at lists.llvm.org>
> Subject: Re: [llvm] 264afb9 - [NFC][llvm] Make the contructors of
> `ElementCount` private.
> 
> I reacted too quickly, sorry. Trying to find a new solution.
> 
> Francesco
> 
> On 8/19/20, 2:53 PM, "Voss, Matthew" <Matthew.Voss at sony.com> wrote:
> 
>     Will do. My phab username is ormris.
> 
>     Thanks,
>     Matthew
> 
>     > -----Original Message-----
>     > From: Francesco Petrogalli <Francesco.Petrogalli at arm.com>
>     > Sent: Wednesday, August 19, 2020 12:52 PM
>     > To: Voss, Matthew <Matthew.Voss at sony.com>; Francesco Petrogalli
>     > <llvmlistbot at llvm.org>
>     > Cc: LLVM Commits <llvm-commits at lists.llvm.org>
>     > Subject: Re: [llvm] 264afb9 - [NFC][llvm] Make the contructors of
>     > `ElementCount` private.
>     >
>     > Please try this for me on your CI. In the meantime, I'll create a
> phab
>     > review and add you as a reviewer. What is your phab username?
>     >
>     > Kind regards,
>     >
>     > Francesco
>     >
>     > commit fe3498cb9fb1277824b8d3403e0bb099b6d688dd
>     > Author: Francesco Petrogalli <francesco.petrogalli at arm.com>
>     > Date:   Wed Aug 19 19:50:24 2020 +0000
>     >
>     >     [llvm] Do not delete default constructor of
> `llvm::ElementCount`.
>     >
>     > diff --git a/llvm/include/llvm/Support/TypeSize.h
>     > b/llvm/include/llvm/Support/TypeSize.h
>     > index a95d388..2abc6a3 100644
>     > --- a/llvm/include/llvm/Support/TypeSize.h
>     > +++ b/llvm/include/llvm/Support/TypeSize.h
>     > @@ -35,10 +35,6 @@ private:
>     >    ElementCount(unsigned Min, bool Scalable) : Min(Min),
>     > Scalable(Scalable) {}
>     >
>     >  public:
>     > -  /// No default constructor. Users should use one of the `get*`
>     > -  /// static methods below, as they should always make a conscious
>     > -  /// choice on the type of `ElementCount` they are requesting.
>     > -  ElementCount() = delete;
>     >    unsigned Min;  // Minimum number of vector elements.
>     >    bool Scalable; // If true, NumElements is a multiple of 'Min'
>     > determined
>     >                   // at runtime rather than compile time.
>     >
>     >
>     >
>     >
>     > On 8/19/20, 2:49 PM, "Voss, Matthew" <Matthew.Voss at sony.com> wrote:
>     >
>     >     Sure. Sounds good.
>     >
>     >     Matthew
>     >
>     >     > -----Original Message-----
>     >     > From: Francesco Petrogalli <Francesco.Petrogalli at arm.com>
>     >     > Sent: Wednesday, August 19, 2020 12:48 PM
>     >     > To: Voss, Matthew <Matthew.Voss at sony.com>; Francesco
> Petrogalli
>     >     > <llvmlistbot at llvm.org>
>     >     > Cc: LLVM Commits <llvm-commits at lists.llvm.org>
>     >     > Subject: Re: [llvm] 264afb9 - [NFC][llvm] Make the contructors
> of
>     >     > `ElementCount` private.
>     >     >
>     >     > I think I have to reactivate the default constructor of the
> class
>     >     > ElementCount to fix the kind of error you see in this CI.
>     >     >
>     >     > Unfortunately I don't have a way to reproduce this workflow.
> Is it
>     > OK is I
>     >     > send you a patch that you could verify?
>     >     >
>     >     > I will type it while I wait for your reply.
>     >     >
>     >     > Francesco
>     >     >
>     >     > On 8/19/20, 2:45 PM, "Voss, Matthew" <Matthew.Voss at sony.com>
> wrote:
>     >     >
>     >     >     Hi Francesco,
>     >     >
>     >     >     This commit is causing build failures on the PS4 windows
> bot.
>     > Could
>     >     > you take a look?
>     >     >
>     >     >     If this failure persists for long enough, I'm going to
> need to
>     > revert
>     >     > it to unclog our CI and the buildbots.
>     >     >
>     >     >     http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-
> scei-
>     > ps4-
>     >     > windows10pro-fast/builds/34173
>     >     >
>     >     >     Thanks,
>     >     >     Matthew
>     >     >
>     >     >     > -----Original Message-----
>     >     >     > From: llvm-commits <llvm-commits-bounces at lists.llvm.org>
> On
>     > Behalf
>     >     > Of
>     >     >     > Francesco Petrogalli via llvm-commits
>     >     >     > Sent: Wednesday, August 19, 2020 9:27 AM
>     >     >     > To: llvm-commits at lists.llvm.org
>     >     >     > Subject: [llvm] 264afb9 - [NFC][llvm] Make the
> contructors of
>     >     >     > `ElementCount` private.
>     >     >     >
>     >     >     >
>     >     >     > Author: Francesco Petrogalli
>     >     >     > Date: 2020-08-19T16:26:44Z
>     >     >     > New Revision: 264afb9e6aebc98c353644dd0700bec808501cab
>     >     >     >
>     >     >     > URL: https://github.com/llvm/llvm-
>     >     >     > project/commit/264afb9e6aebc98c353644dd0700bec808501cab
>     >     >     > DIFF: https://github.com/llvm/llvm-
>     >     >     >
> project/commit/264afb9e6aebc98c353644dd0700bec808501cab.diff
>     >     >     >
>     >     >     > LOG: [NFC][llvm] Make the contructors of `ElementCount`
>     > private.
>     >     >     >
>     >     >     > Differential Revision: https://reviews.llvm.org/D86120
>     >     >     >
>     >     >     > Added:
>     >     >     >
>     >     >     >
>     >     >     > Modified:
>     >     >     >     llvm/include/llvm/Analysis/VectorUtils.h
>     >     >     >     llvm/include/llvm/IR/DerivedTypes.h
>     >     >     >     llvm/include/llvm/IR/Intrinsics.h
>     >     >     >     llvm/include/llvm/Support/MachineValueType.h
>     >     >     >     llvm/include/llvm/Support/TypeSize.h
>     >     >     >     llvm/lib/Analysis/VFABIDemangling.cpp
>     >     >     >     llvm/lib/AsmParser/LLParser.cpp
>     >     >     >
> llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
>     >     >     >     llvm/lib/CodeGen/TargetLoweringBase.cpp
>     >     >     >     llvm/lib/CodeGen/ValueTypes.cpp
>     >     >     >     llvm/lib/IR/ConstantFold.cpp
>     >     >     >     llvm/lib/IR/Constants.cpp
>     >     >     >     llvm/lib/IR/IRBuilder.cpp
>     >     >     >     llvm/lib/IR/Instructions.cpp
>     >     >     >     llvm/lib/IR/Type.cpp
>     >     >     >     llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
>     >     >     >     llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
>     >     >     >     llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
>     >     >     >     llvm/unittests/Analysis/VectorUtilsTest.cpp
>     >     >     >     llvm/unittests/CodeGen/ScalableVectorMVTsTest.cpp
>     >     >     >     llvm/unittests/FuzzMutate/OperationsTest.cpp
>     >     >     >     llvm/unittests/IR/ConstantsTest.cpp
>     >     >     >     llvm/unittests/IR/PatternMatch.cpp
>     >     >     >     llvm/unittests/IR/VectorTypesTest.cpp
>     >     >     >     llvm/unittests/IR/VerifierTest.cpp
>     >     >     >
>     >     >     > Removed:
>     >     >     >
>     >     >     >
>     >     >     >
>     >     >     >
>     >     >
>     >
> ##########################################################################
>     >     >     > ######
>     >     >     > diff  --git a/llvm/include/llvm/Analysis/VectorUtils.h
>     >     >     > b/llvm/include/llvm/Analysis/VectorUtils.h
>     >     >     > index a860652b2332..f77048d45d01 100644
>     >     >     > --- a/llvm/include/llvm/Analysis/VectorUtils.h
>     >     >     > +++ b/llvm/include/llvm/Analysis/VectorUtils.h
>     >     >     > @@ -99,7 +99,8 @@ struct VFShape {
>     >     >     >    // Retrieve the VFShape that can be used to map a
> (scalar)
>     >     > function to
>     >     >     > itself,
>     >     >     >    // with VF = 1.
>     >     >     >    static VFShape getScalarShape(const CallInst &CI) {
>     >     >     > -    return VFShape::get(CI, /*EC*/ {1, false},
>     >     > /*HasGlobalPredicate*/
>     >     >     > false);
>     >     >     > +    return VFShape::get(CI, ElementCount::getFixed(1),
>     >     >     > +                        /*HasGlobalPredicate*/ false);
>     >     >     >    }
>     >     >     >
>     >     >     >    // Retrieve the basic vectorization shape of the
> function,
>     > where
>     >     > all @@
>     >     >     > -305,7 +306,7 @@ typedef unsigned ID;  inline Type
>     > *ToVectorTy(Type
>     >     >     > *Scalar, unsigned VF, bool isScalable = false) {
>     >     >     >    if (Scalar->isVoidTy() || VF == 1)
>     >     >     >      return Scalar;
>     >     >     > -  return VectorType::get(Scalar, {VF, isScalable});
>     >     >     > +  return VectorType::get(Scalar, ElementCount::get(VF,
>     >     > isScalable));
>     >     >     >  }
>     >     >     >
>     >     >     >  /// Identify if the intrinsic is trivially
> vectorizable.
>     >     >     >
>     >     >     > diff  --git a/llvm/include/llvm/IR/DerivedTypes.h
>     >     >     > b/llvm/include/llvm/IR/DerivedTypes.h
>     >     >     > index 843809909d7c..1837f6808f24 100644
>     >     >     > --- a/llvm/include/llvm/IR/DerivedTypes.h
>     >     >     > +++ b/llvm/include/llvm/IR/DerivedTypes.h
>     >     >     > @@ -446,7 +446,8 @@ class VectorType : public Type {
>     >     >     >
>     >     >     >    static VectorType *get(Type *ElementType, unsigned
>     > NumElements,
>     >     >     >                           bool Scalable) {
>     >     >     > -    return VectorType::get(ElementType, {NumElements,
>     > Scalable});
>     >     >     > +    return VectorType::get(ElementType,
>     >     >     > +
> ElementCount::get(NumElements,
>     >     > Scalable));
>     >     >     >    }
>     >     >     >
>     >     >     >    static VectorType *get(Type *ElementType, const
> VectorType
>     >     > *Other) { @@
>     >     >     > -640,7 +641,7 @@ class ScalableVectorType : public
> VectorType
>     > {  };
>     >     >     >
>     >     >     >  inline ElementCount VectorType::getElementCount() const
> {
>     >     >     > -  return ElementCount(ElementQuantity,
>     >     > isa<ScalableVectorType>(this));
>     >     >     > +  return ElementCount::get(ElementQuantity,
>     >     >     > + isa<ScalableVectorType>(this));
>     >     >     >  }
>     >     >     >
>     >     >     >  /// Class to represent pointers.
>     >     >     >
>     >     >     > diff  --git a/llvm/include/llvm/IR/Intrinsics.h
>     >     >     > b/llvm/include/llvm/IR/Intrinsics.h
>     >     >     > index a9e6525e2f3d..3fc7c5a2ceb4 100644
>     >     >     > --- a/llvm/include/llvm/IR/Intrinsics.h
>     >     >     > +++ b/llvm/include/llvm/IR/Intrinsics.h
>     >     >     > @@ -134,7 +134,9 @@ namespace Intrinsic {
>     >     >     >        unsigned Pointer_AddressSpace;
>     >     >     >        unsigned Struct_NumElements;
>     >     >     >        unsigned Argument_Info;
>     >     >     > -      ElementCount Vector_Width;
>     >     >     > +      // There is no default constructor in
> `ElementCount`,
>     > so we
>     >     > need
>     >     >     > +      // to explicitly initialize this field with a
> value.
>     >     >     > +      ElementCount Vector_Width =
> ElementCount::getFixed(0);
>     >     >     >      };
>     >     >     >
>     >     >     >      enum ArgKind {
>     >     >     > @@ -190,8 +192,7 @@ namespace Intrinsic {
>     >     >     >      static IITDescriptor getVector(unsigned Width, bool
>     > IsScalable)
>     >     > {
>     >     >     >        IITDescriptor Result;
>     >     >     >        Result.Kind = Vector;
>     >     >     > -      Result.Vector_Width.Min = Width;
>     >     >     > -      Result.Vector_Width.Scalable = IsScalable;
>     >     >     > +      Result.Vector_Width = ElementCount::get(Width,
>     > IsScalable);
>     >     >     >        return Result;
>     >     >     >      }
>     >     >     >    };
>     >     >     >
>     >     >     > diff  --git
> a/llvm/include/llvm/Support/MachineValueType.h
>     >     >     > b/llvm/include/llvm/Support/MachineValueType.h
>     >     >     > index 3bb8220e72e5..172d4fd8c275 100644
>     >     >     > --- a/llvm/include/llvm/Support/MachineValueType.h
>     >     >     > +++ b/llvm/include/llvm/Support/MachineValueType.h
>     >     >     > @@ -737,7 +737,7 @@ namespace llvm {
>     >     >     >      }
>     >     >     >
>     >     >     >      ElementCount getVectorElementCount() const {
>     >     >     > -      return { getVectorNumElements(),
> isScalableVector() };
>     >     >     > +      return ElementCount::get(getVectorNumElements(),
>     >     >     > + isScalableVector());
>     >     >     >      }
>     >     >     >
>     >     >     >      /// Given a vector type, return the minimum number
> of
>     > elements
>     >     > it
>     >     >     > contains.
>     >     >     >
>     >     >     > diff  --git a/llvm/include/llvm/Support/TypeSize.h
>     >     >     > b/llvm/include/llvm/Support/TypeSize.h
>     >     >     > index d5a3614155b8..a95d38863035 100644
>     >     >     > --- a/llvm/include/llvm/Support/TypeSize.h
>     >     >     > +++ b/llvm/include/llvm/Support/TypeSize.h
>     >     >     > @@ -26,16 +26,23 @@ namespace llvm {
>     >     >     >  template <typename T> struct DenseMapInfo;
>     >     >     >
>     >     >     >  class ElementCount {
>     >     >     > +private:
>     >     >     > +  /// Prevent code from using initializer-list
> contructors
>     > like
>     >     >     > +  /// ElementCount EC = {<unsigned>, <bool>}. The
> static
>     > `get*`
>     >     >     > +  /// methods below are preferred, as users should
> always
>     > make a
>     >     >     > +  /// conscious choice on the type of `ElementCount`
> they are
>     >     >     > +  /// requesting.
>     >     >     > +  ElementCount(unsigned Min, bool Scalable) : Min(Min),
>     >     >     > +Scalable(Scalable) {}
>     >     >     > +
>     >     >     >  public:
>     >     >     > +  /// No default constructor. Users should use one of
> the
>     > `get*`
>     >     > ///
>     >     >     > + static methods below, as they should always make a
> conscious
>     > ///
>     >     >     > + choice on the type of `ElementCount` they are
> requesting.
>     >     >     > +  ElementCount() = delete;
>     >     >     >    unsigned Min;  // Minimum number of vector elements.
>     >     >     >    bool Scalable; // If true, NumElements is a multiple
> of
>     > 'Min'
>     >     >     > determined
>     >     >     >                   // at runtime rather than compile
> time.
>     >     >     >
>     >     >     > -  ElementCount() = default;
>     >     >     > -
>     >     >     > -  ElementCount(unsigned Min, bool Scalable)
>     >     >     > -  : Min(Min), Scalable(Scalable) {}
>     >     >     > -
>     >     >     >    ElementCount operator*(unsigned RHS) {
>     >     >     >      return { Min * RHS, Scalable };
>     >     >     >    }
>     >     >     > @@ -54,7 +61,13 @@ class ElementCount {
>     >     >     >    bool operator!=(unsigned RHS) const { return !(*this
> ==
>     > RHS); }
>     >     >     >
>     >     >     >    ElementCount NextPowerOf2() const {
>     >     >     > -    return ElementCount(llvm::NextPowerOf2(Min),
> Scalable);
>     >     >     > +    return {(unsigned)llvm::NextPowerOf2(Min),
> Scalable};  }
>     >     >     > +
>     >     >     > +  static ElementCount getFixed(unsigned Min) { return
> {Min,
>     > false};
>     >     > }
>     >     >     > + static ElementCount getScalable(unsigned Min) { return
> {Min,
>     >     > true}; }
>     >     >     > + static ElementCount get(unsigned Min, bool Scalable) {
>     >     >     > +    return {Min, Scalable};
>     >     >     >    }
>     >     >     >  };
>     >     >     >
>     >     >     > @@ -279,8 +292,12 @@ inline TypeSize alignTo(TypeSize
> Size,
>     > uint64_t
>     >     >     > Align) {  }
>     >     >     >
>     >     >     >  template <> struct DenseMapInfo<ElementCount> {
>     >     >     > -  static inline ElementCount getEmptyKey() { return
> {~0U,
>     > true}; }
>     >     >     > -  static inline ElementCount getTombstoneKey() { return
> {~0U
>     > - 1,
>     >     > false};
>     >     >     > }
>     >     >     > +  static inline ElementCount getEmptyKey() {
>     >     >     > +    return ElementCount::getScalable(~0U);  }  static
> inline
>     >     >     > + ElementCount getTombstoneKey() {
>     >     >     > +    return ElementCount::getFixed(~0U - 1);  }
>     >     >     >    static unsigned getHashValue(const ElementCount&
> EltCnt) {
>     >     >     >      if (EltCnt.Scalable)
>     >     >     >        return (EltCnt.Min * 37U) - 1U;
>     >     >     >
>     >     >     > diff  --git a/llvm/lib/Analysis/VFABIDemangling.cpp
>     >     >     > b/llvm/lib/Analysis/VFABIDemangling.cpp
>     >     >     > index 0192a216b2f7..56155b28132e 100644
>     >     >     > --- a/llvm/lib/Analysis/VFABIDemangling.cpp
>     >     >     > +++ b/llvm/lib/Analysis/VFABIDemangling.cpp
>     >     >     > @@ -310,7 +310,7 @@ ElementCount
>     > getECFromSignature(FunctionType
>     >     >     > *Signature) {
>     >     >     >      if (auto *VTy = dyn_cast<VectorType>(Ty))
>     >     >     >        return VTy->getElementCount();
>     >     >     >
>     >     >     > -  return ElementCount(/*Min=*/1, /*Scalable=*/false);
>     >     >     > +  return ElementCount::getFixed(/*Min=*/1);
>     >     >     >  }
>     >     >     >  } // namespace
>     >     >     >
>     >     >     >
>     >     >     > diff  --git a/llvm/lib/AsmParser/LLParser.cpp
>     >     >     > b/llvm/lib/AsmParser/LLParser.cpp index
>     > 06e5709983ea..fec10b8605c2
>     >     > 100644
>     >     >     > --- a/llvm/lib/AsmParser/LLParser.cpp
>     >     >     > +++ b/llvm/lib/AsmParser/LLParser.cpp
>     >     >     > @@ -7395,7 +7395,7 @@ int
>     > LLParser::ParseGetElementPtr(Instruction
>     >     > *&Inst,
>     >     >     > PerFunctionState &PFS) {
>     >     >     >    // All vector parameters should have the same vector
> width.
>     >     >     >    ElementCount GEPWidth = BaseType->isVectorTy()
>     >     >     >                                ?
> cast<VectorType>(BaseType)-
>     >     >     > >getElementCount()
>     >     >     > -                              : ElementCount(0, false);
>     >     >     > +                              :
> ElementCount::getFixed(0);
>     >     >     >
>     >     >     >    while (EatIfPresent(lltok::comma)) {
>     >     >     >      if (Lex.getKind() == lltok::MetadataVar) { @@ -
> 7408,7
>     > +7408,7
>     >     > @@ int
>     >     >     > LLParser::ParseGetElementPtr(Instruction *&Inst,
>     > PerFunctionState
>     >     > &PFS) {
>     >     >     >
>     >     >     >      if (auto *ValVTy = dyn_cast<VectorType>(Val-
> >getType()))
>     > {
>     >     >     >        ElementCount ValNumEl = ValVTy-
> >getElementCount();
>     >     >     > -      if (GEPWidth != ElementCount(0, false) &&
> GEPWidth !=
>     >     > ValNumEl)
>     >     >     > +      if (GEPWidth != ElementCount::getFixed(0) &&
> GEPWidth
>     > !=
>     >     >     > + ValNumEl)
>     >     >     >          return Error(EltLoc,
>     >     >     >            "getelementptr vector index has a wrong
> number of
>     >     > elements");
>     >     >     >        GEPWidth = ValNumEl;
>     >     >     >
>     >     >     > diff  --git
>     > a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
>     >     >     > b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
>     >     >     > index fd1859afee43..80a2db2a6b24 100644
>     >     >     > ---
> a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
>     >     >     > +++
> b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
>     >     >     > @@ -729,15 +729,15 @@ static void
>     > getCopyToPartsVector(SelectionDAG
>     >     > &DAG,
>     >     >     > const SDLoc &DL,
>     >     >     >    assert(IntermediateVT.isScalableVector() ==
>     >     > ValueVT.isScalableVector()
>     >     >     > &&
>     >     >     >           "Mixing scalable and fixed vectors when
> copying in
>     >     > parts");
>     >     >     >
>     >     >     > -  ElementCount DestEltCnt;
>     >     >     > +  Optional<ElementCount> DestEltCnt;
>     >     >     >
>     >     >     >    if (IntermediateVT.isVector())
>     >     >     >      DestEltCnt = IntermediateVT.getVectorElementCount()
> *
>     >     >     > NumIntermediates;
>     >     >     >    else
>     >     >     > -    DestEltCnt = ElementCount(NumIntermediates, false);
>     >     >     > +    DestEltCnt =
> ElementCount::getFixed(NumIntermediates);
>     >     >     >
>     >     >     >    EVT BuiltVectorTy = EVT::getVectorVT(
>     >     >     > -      *DAG.getContext(),
> IntermediateVT.getScalarType(),
>     >     > DestEltCnt);
>     >     >     > +      *DAG.getContext(),
> IntermediateVT.getScalarType(),
>     >     >     > + DestEltCnt.getValue());
>     >     >     >    if (ValueVT != BuiltVectorTy) {
>     >     >     >      if (SDValue Widened = widenVectorToPartType(DAG,
> Val, DL,
>     >     >     > BuiltVectorTy))
>     >     >     >        Val = Widened;
>     >     >     > @@ -3746,7 +3746,7 @@ void
>     >     > SelectionDAGBuilder::visitGetElementPtr(const
>     >     >     > User &I) {
>     >     >     >    bool IsVectorGEP = I.getType()->isVectorTy();
>     >     >     >    ElementCount VectorElementCount =
>     >     >     >        IsVectorGEP ? cast<VectorType>(I.getType())-
>     >     > >getElementCount()
>     >     >     > -                  : ElementCount(0, false);
>     >     >     > +                  : ElementCount::getFixed(0);
>     >     >     >
>     >     >     >    if (IsVectorGEP && !N.getValueType().isVector()) {
>     >     >     >      LLVMContext &Context = *DAG.getContext();
>     >     >     >
>     >     >     > diff  --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp
>     >     >     > b/llvm/lib/CodeGen/TargetLoweringBase.cpp
>     >     >     > index 63e55c9c47e3..868302abc999 100644
>     >     >     > --- a/llvm/lib/CodeGen/TargetLoweringBase.cpp
>     >     >     > +++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp
>     >     >     > @@ -866,7 +866,7 @@
>     >     > TargetLoweringBase::getTypeConversion(LLVMContext
>     >     >     > &Context, EVT VT) const {
>     >     >     >    if (NumElts == 1)
>     >     >     >      return LegalizeKind(TypeScalarizeVector, EltVT);
>     >     >     >
>     >     >     > -  if (VT.getVectorElementCount() == ElementCount(1,
> true))
>     >     >     > +  if (VT.getVectorElementCount() ==
>     > ElementCount::getScalable(1))
>     >     >     >      report_fatal_error("Cannot legalize this vector");
>     >     >     >
>     >     >     >    // Try to widen vector elements until the element
> type is a
>     > power
>     >     > of
>     >     >     > two and
>     >     >     >
>     >     >     > diff  --git a/llvm/lib/CodeGen/ValueTypes.cpp
>     >     >     > b/llvm/lib/CodeGen/ValueTypes.cpp index
>     > 57e26e8cb7a1..c3974519bfc6
>     >     > 100644
>     >     >     > --- a/llvm/lib/CodeGen/ValueTypes.cpp
>     >     >     > +++ b/llvm/lib/CodeGen/ValueTypes.cpp
>     >     >     > @@ -49,8 +49,7 @@ EVT
> EVT::getExtendedVectorVT(LLVMContext
>     > &Context,
>     >     > EVT
>     >     >     > VT, unsigned NumElements,
>     >     >     >
>     >     >     >  EVT EVT::getExtendedVectorVT(LLVMContext &Context, EVT
> VT,
>     >     > ElementCount
>     >     >     > EC) {
>     >     >     >    EVT ResultVT;
>     >     >     > -  ResultVT.LLVMTy =
>     >     >     > -      VectorType::get(VT.getTypeForEVT(Context),
> {EC.Min,
>     >     > EC.Scalable});
>     >     >     > +  ResultVT.LLVMTy =
>     > VectorType::get(VT.getTypeForEVT(Context), EC);
>     >     >     >    assert(ResultVT.isExtended() && "Type is not
> extended!");
>     >     >     >    return ResultVT;
>     >     >     >  }
>     >     >     >
>     >     >     > diff  --git a/llvm/lib/IR/ConstantFold.cpp
>     >     > b/llvm/lib/IR/ConstantFold.cpp
>     >     >     > index 2d3afca6d58c..e5c4250665e4 100644
>     >     >     > --- a/llvm/lib/IR/ConstantFold.cpp
>     >     >     > +++ b/llvm/lib/IR/ConstantFold.cpp
>     >     >     > @@ -919,7 +919,8 @@ Constant
>     >     >     > *llvm::ConstantFoldShuffleVectorInstruction(Constant
> *V1,
>     > Constant
>     >     > *V2,
>     >     >     >
>     > ArrayRef<int>
>     >     > Mask)
>     >     >     > {
>     >     >     >    auto *V1VTy = cast<VectorType>(V1->getType());
>     >     >     >    unsigned MaskNumElts = Mask.size();
>     >     >     > -  ElementCount MaskEltCount = {MaskNumElts,
>     >     >     > isa<ScalableVectorType>(V1VTy)};
>     >     >     > +  auto MaskEltCount =
>     >     >     > +      ElementCount::get(MaskNumElts,
>     >     > isa<ScalableVectorType>(V1VTy));
>     >     >     >    Type *EltTy = V1VTy->getElementType();
>     >     >     >
>     >     >     >    // Undefined shuffle mask -> undefined value.
>     >     >     >
>     >     >     > diff  --git a/llvm/lib/IR/Constants.cpp
>     > b/llvm/lib/IR/Constants.cpp
>     >     > index
>     >     >     > cbbcca20ea51..b252ef71c8ee 100644
>     >     >     > --- a/llvm/lib/IR/Constants.cpp
>     >     >     > +++ b/llvm/lib/IR/Constants.cpp
>     >     >     > @@ -2245,7 +2245,7 @@ Constant
>     > *ConstantExpr::getGetElementPtr(Type
>     >     > *Ty,
>     >     >     > Constant *C,
>     >     >     >    unsigned AS = C->getType()->getPointerAddressSpace();
>     >     >     >    Type *ReqTy = DestTy->getPointerTo(AS);
>     >     >     >
>     >     >     > -  ElementCount EltCount = {0, false};
>     >     >     > +  auto EltCount = ElementCount::getFixed(0);
>     >     >     >    if (VectorType *VecTy = dyn_cast<VectorType>(C-
> >getType()))
>     >     >     >      EltCount = VecTy->getElementCount();
>     >     >     >    else
>     >     >     > @@ -2938,7 +2938,7 @@ Constant
>     >     > *ConstantDataVector::getSplat(unsigned
>     >     >     > NumElts, Constant *V) {
>     >     >     >        return getFP(V->getType(), Elts);
>     >     >     >      }
>     >     >     >    }
>     >     >     > -  return ConstantVector::getSplat({NumElts, false}, V);
>     >     >     > +  return
>     > ConstantVector::getSplat(ElementCount::getFixed(NumElts),
>     >     > V);
>     >     >     >  }
>     >     >     >
>     >     >     >
>     >     >     >
>     >     >     > diff  --git a/llvm/lib/IR/IRBuilder.cpp
>     > b/llvm/lib/IR/IRBuilder.cpp
>     >     > index
>     >     >     > f059f80ecec4..1de25c25cd05 100644
>     >     >     > --- a/llvm/lib/IR/IRBuilder.cpp
>     >     >     > +++ b/llvm/lib/IR/IRBuilder.cpp
>     >     >     > @@ -997,7 +997,7 @@ Value
>     >     > *IRBuilderBase::CreateStripInvariantGroup(Value
>     >     >     > *Ptr) {
>     >     >     >
>     >     >     >  Value *IRBuilderBase::CreateVectorSplat(unsigned
> NumElts,
>     > Value *V,
>     >     >     >                                          const Twine
> &Name) {
>     >     >     > -  ElementCount EC(NumElts, false);
>     >     >     > +  auto EC = ElementCount::getFixed(NumElts);
>     >     >     >    return CreateVectorSplat(EC, V, Name);  }
>     >     >     >
>     >     >     >
>     >     >     > diff  --git a/llvm/lib/IR/Instructions.cpp
>     >     > b/llvm/lib/IR/Instructions.cpp
>     >     >     > index 2f17a0d73af4..7a3fbc367d1c 100644
>     >     >     > --- a/llvm/lib/IR/Instructions.cpp
>     >     >     > +++ b/llvm/lib/IR/Instructions.cpp
>     >     >     > @@ -3330,9 +3330,9 @@
>     > CastInst::castIsValid(Instruction::CastOps op,
>     >     > Value
>     >     >     > *S, Type *DstTy) {
>     >     >     >    // scalar types means that checking that vector
> lengths
>     > match
>     >     > also
>     >     >     > checks that
>     >     >     >    // scalars are not being converted to vectors or
> vectors to
>     >     > scalars).
>     >     >     >    ElementCount SrcEC = SrcIsVec ?
> cast<VectorType>(SrcTy)-
>     >     >     > >getElementCount()
>     >     >     > -                                : ElementCount(0,
> false);
>     >     >     > +                                :
> ElementCount::getFixed(0);
>     >     >     >    ElementCount DstEC = DstIsVec ?
> cast<VectorType>(DstTy)-
>     >     >     > >getElementCount()
>     >     >     > -                                : ElementCount(0,
> false);
>     >     >     > +                                :
> ElementCount::getFixed(0);
>     >     >     >
>     >     >     >    // Switch on the opcode provided
>     >     >     >    switch (op) {
>     >     >     > @@ -3390,9 +3390,9 @@
>     > CastInst::castIsValid(Instruction::CastOps op,
>     >     > Value
>     >     >     > *S, Type *DstTy) {
>     >     >     >      if (SrcIsVec && DstIsVec)
>     >     >     >        return SrcEC == DstEC;
>     >     >     >      if (SrcIsVec)
>     >     >     > -      return SrcEC == ElementCount(1, false);
>     >     >     > +      return SrcEC == ElementCount::getFixed(1);
>     >     >     >      if (DstIsVec)
>     >     >     > -      return DstEC == ElementCount(1, false);
>     >     >     > +      return DstEC == ElementCount::getFixed(1);
>     >     >     >
>     >     >     >      return true;
>     >     >     >    }
>     >     >     >
>     >     >     > diff  --git a/llvm/lib/IR/Type.cpp
> b/llvm/lib/IR/Type.cpp
>     > index
>     >     >     > d869a6e07cca..1cf0d1345ab3 100644
>     >     >     > --- a/llvm/lib/IR/Type.cpp
>     >     >     > +++ b/llvm/lib/IR/Type.cpp
>     >     >     > @@ -619,7 +619,7 @@ FixedVectorType
> *FixedVectorType::get(Type
>     >     >     > *ElementType, unsigned NumElts) {
>     >     >     >                                              "be an
> integer,
>     >     > floating
>     >     >     > point, or "
>     >     >     >                                              "pointer
> type.");
>     >     >     >
>     >     >     > -  ElementCount EC(NumElts, false);
>     >     >     > +  auto EC = ElementCount::getFixed(NumElts);
>     >     >     >
>     >     >     >    LLVMContextImpl *pImpl = ElementType-
> >getContext().pImpl;
>     >     >     >    VectorType *&Entry = ElementType->getContext() @@ -
> 641,7
>     > +641,7
>     >     > @@
>     >     >     > ScalableVectorType *ScalableVectorType::get(Type
> *ElementType,
>     >     >     >                                              "be an
> integer,
>     >     > floating
>     >     >     > point, or "
>     >     >     >                                              "pointer
> type.");
>     >     >     >
>     >     >     > -  ElementCount EC(MinNumElts, true);
>     >     >     > +  auto EC = ElementCount::getScalable(MinNumElts);
>     >     >     >
>     >     >     >    LLVMContextImpl *pImpl = ElementType-
> >getContext().pImpl;
>     >     >     >    VectorType *&Entry = ElementType->getContext()
>     >     >     >
>     >     >     > diff  --git
> a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
>     >     >     > b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
>     >     >     > index b37947495a43..6c7624304e90 100644
>     >     >     > --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
>     >     >     > +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
>     >     >     > @@ -11985,7 +11985,8 @@ static SDValue
>     > LowerSVEIntrinsicEXT(SDNode
>     >     > *N,
>     >     >     > SelectionDAG &DAG) {
>     >     >     >
>     >     >     >    unsigned ElemSize =
>     > VT.getVectorElementType().getSizeInBits() /
>     >     > 8;
>     >     >     >    unsigned ByteSize =
> VT.getSizeInBits().getKnownMinSize() /
>     > 8;
>     >     >     > -  EVT ByteVT = EVT::getVectorVT(Ctx, MVT::i8, {
> ByteSize,
>     > true });
>     >     >     > +  EVT ByteVT =
>     >     >     > +      EVT::getVectorVT(Ctx, MVT::i8,
>     >     >     > + ElementCount::getScalable(ByteSize));
>     >     >     >
>     >     >     >    // Convert everything to the domain of EXT (i.e
> bytes).
>     >     >     >    SDValue Op0 = DAG.getNode(ISD::BITCAST, dl, ByteVT,
> N-
>     >     > >getOperand(1));
>     >     >     >
>     >     >     > diff  --git
> a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
>     >     >     > b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
>     >     >     > index ee8289983687..90a8d4703d65 100644
>     >     >     > --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
>     >     >     > +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
>     >     >     > @@ -1804,10 +1804,10 @@ void
>     >     >     > InnerLoopVectorizer::createVectorIntOrFpInductionPHI(
>     >     >     >    // FIXME: If the step is non-constant, we create the
> vector
>     > splat
>     >     > with
>     >     >     >    //        IRBuilder. IRBuilder can constant-fold the
>     > multiply,
>     >     > but it
>     >     >     > doesn't
>     >     >     >    //        handle a constant vector splat.
>     >     >     > -  Value *SplatVF =
>     >     >     > -      isa<Constant>(Mul)
>     >     >     > -          ? ConstantVector::getSplat({VF, false},
>     >     > cast<Constant>(Mul))
>     >     >     > -          : Builder.CreateVectorSplat(VF, Mul);
>     >     >     > +  Value *SplatVF = isa<Constant>(Mul)
>     >     >     > +                       ?
>     >     >     > ConstantVector::getSplat(ElementCount::getFixed(VF),
>     >     >     > +
>     >     > cast<Constant>(Mul))
>     >     >     > +                       : Builder.CreateVectorSplat(VF,
> Mul);
>     >     >     >    Builder.restoreIP(CurrIP);
>     >     >     >
>     >     >     >    // We may need to add the step a number of times,
> depending
>     > on
>     >     > the
>     >     >     > unroll @@ -3399,7 +3399,8 @@ unsigned
>     >     >     > LoopVectorizationCostModel::getVectorCallCost(CallInst
> *CI,
>     >     >     >    // If we can't emit a vector call for this function,
> then
>     > the
>     >     > currently
>     >     >     > found
>     >     >     >    // cost is the cost we need to return.
>     >     >     >    NeedToScalarize = true;
>     >     >     > -  VFShape Shape = VFShape::get(*CI, {VF, false}, false
>     >     >     > /*HasGlobalPred*/);
>     >     >     > +  VFShape Shape =
>     >     >     > +      VFShape::get(*CI, ElementCount::getFixed(VF),
> false
>     >     >     > + /*HasGlobalPred*/);
>     >     >     >    Function *VecFunc =
>     > VFDatabase(*CI).getVectorizedFunction(Shape);
>     >     >     >
>     >     >     >    if (!TLI || CI->isNoBuiltin() || !VecFunc) @@ -3860,7
>     > +3861,7 @@
>     >     > void
>     >     >     > InnerLoopVectorizer::fixReduction(PHINode *Phi) {
>     >     >     >        // incoming scalar reduction.
>     >     >     >        VectorStart = ReductionStartValue;
>     >     >     >      } else {
>     >     >     > -      Identity = ConstantVector::getSplat({VF, false},
> Iden);
>     >     >     > +      Identity =
>     >     > ConstantVector::getSplat(ElementCount::getFixed(VF),
>     >     >     > + Iden);
>     >     >     >
>     >     >     >        // This vector is the Identity vector where the
> first
>     > element
>     >     > is
>     >     >     > the
>     >     >     >        // incoming scalar reduction.
>     >     >     > @@ -4541,8 +4542,8 @@ void
>     >     >     > InnerLoopVectorizer::widenCallInstruction(CallInst &I,
> VPUser
>     >     >     > &ArgOperands,
>     >     >     >        assert(VectorF && "Can't retrieve vector
> intrinsic.");
>     >     >     >      } else {
>     >     >     >        // Use vector version of the function call.
>     >     >     > -      const VFShape Shape =
>     >     >     > -          VFShape::get(*CI, {VF, false} /*EC*/, false
>     >     > /*HasGlobalPred*/);
>     >     >     > +      const VFShape Shape = VFShape::get(*CI,
>     >     > ElementCount::getFixed(VF),
>     >     >     > +                                         false
>     > /*HasGlobalPred*/);
>     >     >     >  #ifndef NDEBUG
>     >     >     >
> assert(VFDatabase(*CI).getVectorizedFunction(Shape) !=
>     >     > nullptr &&
>     >     >     >               "Can't create vector function.");
>     >     >     >
>     >     >     > diff  --git
> a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
>     >     >     > b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
>     >     >     > index 6a5e8e25951c..6d8a12ab25ad 100644
>     >     >     > --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
>     >     >     > +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
>     >     >     > @@ -3029,7 +3029,7 @@ void
>     > BoUpSLP::buildTree_rec(ArrayRef<Value *>
>     >     > VL,
>     >     >     > unsigned Depth,
>     >     >     >        Intrinsic::ID ID =
> getVectorIntrinsicIDForCall(CI,
>     > TLI);
>     >     >     >
>     >     >     >        VFShape Shape = VFShape::get(
>     >     >     > -          *CI, {static_cast<unsigned int>(VL.size()),
> false
>     >     >     > /*Scalable*/},
>     >     >     > +          *CI,
> ElementCount::getFixed(static_cast<unsigned
>     >     >     > + int>(VL.size())),
>     >     >     >            false /*HasGlobalPred*/);
>     >     >     >        Function *VecFunc =
>     >     > VFDatabase(*CI).getVectorizedFunction(Shape);
>     >     >     >
>     >     >     > @@ -3264,9 +3264,9 @@ getVectorCallCosts(CallInst *CI,
>     > VectorType
>     >     > *VecTy,
>     >     >     > TargetTransformInfo *TTI,
>     >     >     >    int IntrinsicCost =
>     >     >     >      TTI->getIntrinsicInstrCost(CostAttrs,
>     >     > TTI::TCK_RecipThroughput);
>     >     >     >
>     >     >     > -  auto Shape =
>     >     >     > -      VFShape::get(*CI, {static_cast<unsigned>(VecTy-
>     >     > >getNumElements()),
>     >     >     > false},
>     >     >     > -                   false /*HasGlobalPred*/);
>     >     >     > +  auto Shape = VFShape::get(*CI,
>     >     >     > ElementCount::getFixed(static_cast<unsigned>(
>     >     >     > +                                     VecTy-
>     > >getNumElements())),
>     >     >     > +                            false /*HasGlobalPred*/);
>     >     >     >    Function *VecFunc =
>     > VFDatabase(*CI).getVectorizedFunction(Shape);
>     >     >     >    int LibCost = IntrinsicCost;
>     >     >     >    if (!CI->isNoBuiltin() && VecFunc) {
>     >     >     > @@ -4553,9 +4553,10 @@ Value
> *BoUpSLP::vectorizeTree(TreeEntry
>     > *E) {
>     >     >     >
>     >     >     >        Function *CF;
>     >     >     >        if (!UseIntrinsic) {
>     >     >     > -        VFShape Shape = VFShape::get(
>     >     >     > -            *CI, {static_cast<unsigned>(VecTy-
>     > >getNumElements()),
>     >     > false},
>     >     >     > -            false /*HasGlobalPred*/);
>     >     >     > +        VFShape Shape =
>     >     >     > +            VFShape::get(*CI,
>     >     >     > ElementCount::getFixed(static_cast<unsigned>(
>     >     >     > +                                  VecTy-
> >getNumElements())),
>     >     >     > +                         false /*HasGlobalPred*/);
>     >     >     >          CF =
> VFDatabase(*CI).getVectorizedFunction(Shape);
>     >     >     >        } else {
>     >     >     >          Type *Tys[] = {FixedVectorType::get(CI-
> >getType(), E-
>     >     >     > >Scalars.size())};
>     >     >     >
>     >     >     > diff  --git
> a/llvm/unittests/Analysis/VectorUtilsTest.cpp
>     >     >     > b/llvm/unittests/Analysis/VectorUtilsTest.cpp
>     >     >     > index 731ebdfe16f5..c4e19c7fa810 100644
>     >     >     > --- a/llvm/unittests/Analysis/VectorUtilsTest.cpp
>     >     >     > +++ b/llvm/unittests/Analysis/VectorUtilsTest.cpp
>     >     >     > @@ -93,7 +93,8 @@ TEST_F(BasicTest, isSplat) {
>     >     >     >    Value *SplatC = IRB.CreateVectorSplat(5, ScalarC);
>     >     >     >    EXPECT_TRUE(isSplatValue(SplatC));
>     >     >     >
>     >     >     > -  Value *SplatC_SVE =
> IRB.CreateVectorSplat(ElementCount(5,
>     > true),
>     >     >     > ScalarC);
>     >     >     > +  Value *SplatC_SVE =
>     >     >     > +
> IRB.CreateVectorSplat(ElementCount::getScalable(5),
>     > ScalarC);
>     >     >     >    EXPECT_TRUE(isSplatValue(SplatC_SVE));
>     >     >     >
>     >     >     >    // FIXME: Constant splat analysis does not allow
> undef
>     > elements.
>     >     >     > @@ -502,7 +503,7 @@ class VFShapeAPITest : public
>     > testing::Test {
>     >     >     >    SmallVector<VFParameter, 8> &ExpectedParams =
>     >     > Expected.Parameters;
>     >     >     >
>     >     >     >    void buildShape(unsigned VF, bool IsScalable, bool
>     > HasGlobalPred)
>     >     > {
>     >     >     > -    Shape = VFShape::get(*CI, {VF, IsScalable},
>     > HasGlobalPred);
>     >     >     > +    Shape = VFShape::get(*CI, ElementCount::get(VF,
>     > IsScalable),
>     >     >     > + HasGlobalPred);
>     >     >     >    }
>     >     >     >
>     >     >     >    bool validParams(ArrayRef<VFParameter> Parameters) {
>     >     >     >
>     >     >     > diff  --git
>     > a/llvm/unittests/CodeGen/ScalableVectorMVTsTest.cpp
>     >     >     > b/llvm/unittests/CodeGen/ScalableVectorMVTsTest.cpp
>     >     >     > index 81c99163229a..f1c4a8bea1f5 100644
>     >     >     > --- a/llvm/unittests/CodeGen/ScalableVectorMVTsTest.cpp
>     >     >     > +++ b/llvm/unittests/CodeGen/ScalableVectorMVTsTest.cpp
>     >     >     > @@ -49,12 +49,12 @@ TEST(ScalableVectorMVTsTest,
> HelperFuncs)
>     > {
>     >     >     >    ASSERT_TRUE(Vnx4i32.isScalableVector());
>     >     >     >
>     >     >     >    // Create with separate llvm::ElementCount
>     >     >     > -  auto EltCnt = ElementCount(2, true);
>     >     >     > +  auto EltCnt = ElementCount::getScalable(2);
>     >     >     >    EVT Vnx2i32 = EVT::getVectorVT(Ctx, MVT::i32,
> EltCnt);
>     >     >     >    ASSERT_TRUE(Vnx2i32.isScalableVector());
>     >     >     >
>     >     >     >    // Create with inline llvm::ElementCount
>     >     >     > -  EVT Vnx2i64 = EVT::getVectorVT(Ctx, MVT::i64, {2,
> true});
>     >     >     > +  EVT Vnx2i64 = EVT::getVectorVT(Ctx, MVT::i64,
>     >     >     > + ElementCount::getScalable(2));
>     >     >     >    ASSERT_TRUE(Vnx2i64.isScalableVector());
>     >     >     >
>     >     >     >    // Check that changing scalar types/element count
> works @@
>     > -66,7
>     >     > +66,7
>     >     >     > @@ TEST(ScalableVectorMVTsTest, HelperFuncs) {
>     >     >     >    EXPECT_EQ(EVT::getVectorVT(Ctx, MVT::i64, EltCnt /
> 2),
>     >     > MVT::nxv1i64);
>     >     >     >
>     >     >     >    // Check that float->int conversion works
>     >     >     > -  EVT Vnx2f64 = EVT::getVectorVT(Ctx, MVT::f64, {2,
> true});
>     >     >     > +  EVT Vnx2f64 = EVT::getVectorVT(Ctx, MVT::f64,
>     >     >     > + ElementCount::getScalable(2));
>     >     >     >    EXPECT_EQ(Vnx2f64.changeTypeToInteger(), Vnx2i64);
>     >     >     >
>     >     >     >    // Check fields inside llvm::ElementCount @@ -77,7
> +77,7 @@
>     >     >     > TEST(ScalableVectorMVTsTest, HelperFuncs) {
>     >     >     >    // Check that fixed-length vector types aren't
> scalable.
>     >     >     >    EVT V8i32 = EVT::getVectorVT(Ctx, MVT::i32, 8);
>     >     >     >    ASSERT_FALSE(V8i32.isScalableVector());
>     >     >     > -  EVT V4f64 = EVT::getVectorVT(Ctx, MVT::f64, {4,
> false});
>     >     >     > +  EVT V4f64 = EVT::getVectorVT(Ctx, MVT::f64,
>     >     >     > + ElementCount::getFixed(4));
>     >     >     >    ASSERT_FALSE(V4f64.isScalableVector());
>     >     >     >
>     >     >     >    // Check that llvm::ElementCount works for fixed-
> length
>     > types.
>     >     >     > @@ -90,7 +90,8 @@ TEST(ScalableVectorMVTsTest,
>     > IRToVTTranslation) {
>     >     >     >    LLVMContext Ctx;
>     >     >     >
>     >     >     >    Type *Int64Ty = Type::getInt64Ty(Ctx);
>     >     >     > -  VectorType *ScV8Int64Ty = VectorType::get(Int64Ty,
> {8,
>     > true});
>     >     >     > +  VectorType *ScV8Int64Ty =
>     >     >     > +      VectorType::get(Int64Ty,
> ElementCount::getScalable(8));
>     >     >     >
>     >     >     >    // Check that we can map a scalable IR type to an MVT
>     >     >     >    MVT Mnxv8i64 = MVT::getVT(ScV8Int64Ty); @@ -110,7
> +111,7 @@
>     >     >     > TEST(ScalableVectorMVTsTest, IRToVTTranslation) {
>     >     >     > TEST(ScalableVectorMVTsTest, VTToIRTranslation) {
>     >     >     >    LLVMContext Ctx;
>     >     >     >
>     >     >     > -  EVT Enxv4f64 = EVT::getVectorVT(Ctx, MVT::f64, {4,
> true});
>     >     >     > +  EVT Enxv4f64 = EVT::getVectorVT(Ctx, MVT::f64,
>     >     >     > + ElementCount::getScalable(4));
>     >     >     >
>     >     >     >    Type *Ty = Enxv4f64.getTypeForEVT(Ctx);
>     >     >     >    VectorType *ScV4Float64Ty = cast<VectorType>(Ty);
>     >     >     >
>     >     >     > diff  --git
> a/llvm/unittests/FuzzMutate/OperationsTest.cpp
>     >     >     > b/llvm/unittests/FuzzMutate/OperationsTest.cpp
>     >     >     > index c329d053dec9..4de3d43ba960 100644
>     >     >     > --- a/llvm/unittests/FuzzMutate/OperationsTest.cpp
>     >     >     > +++ b/llvm/unittests/FuzzMutate/OperationsTest.cpp
>     >     >     > @@ -92,8 +92,8 @@ TEST(OperationsTest, SourcePreds) {
>     >     >     >        ConstantStruct::get(StructType::create(Ctx,
>     > "OpaqueStruct"));
>     >     >     >    Constant *a =
>     >     >     >        ConstantArray::get(ArrayType::get(i32->getType(),
> 2),
>     > {i32,
>     >     > i32});
>     >     >     > -  Constant *v8i8 = ConstantVector::getSplat({8, false},
> i8);
>     >     >     > -  Constant *v4f16 = ConstantVector::getSplat({4,
> false},
>     > f16);
>     >     >     > +  Constant *v8i8 =
>     >     > ConstantVector::getSplat(ElementCount::getFixed(8),
>     >     >     > + i8);  Constant *v4f16 =
>     >     >     > + ConstantVector::getSplat(ElementCount::getFixed(4),
> f16);
>     >     >     >    Constant *p0i32 =
>     >     >     >        ConstantPointerNull::get(PointerType::get(i32-
>     > >getType(),
>     >     > 0));
>     >     >     >
>     >     >     >
>     >     >     > diff  --git a/llvm/unittests/IR/ConstantsTest.cpp
>     >     >     > b/llvm/unittests/IR/ConstantsTest.cpp
>     >     >     > index f1c1c86293c8..5fb2d2dfc7ac 100644
>     >     >     > --- a/llvm/unittests/IR/ConstantsTest.cpp
>     >     >     > +++ b/llvm/unittests/IR/ConstantsTest.cpp
>     >     >     > @@ -646,8 +646,8 @@ TEST(ConstantsTest,
>     > GetSplatValueRoundTrip) {
>     >     >     >    Type *Int8Ty = Type::getInt8Ty(Context);
>     >     >     >
>     >     >     >    for (unsigned Min : {1, 2, 8}) {
>     >     >     > -    ElementCount ScalableEC = {Min, true};
>     >     >     > -    ElementCount FixedEC = {Min, false};
>     >     >     > +    auto ScalableEC = ElementCount::getScalable(Min);
>     >     >     > +    auto FixedEC = ElementCount::getFixed(Min);
>     >     >     >
>     >     >     >      for (auto EC : {ScalableEC, FixedEC}) {
>     >     >     >        for (auto *Ty : {FloatTy, Int32Ty, Int8Ty}) {
>     >     >     >
>     >     >     > diff  --git a/llvm/unittests/IR/PatternMatch.cpp
>     >     >     > b/llvm/unittests/IR/PatternMatch.cpp
>     >     >     > index 8e6e48d05d37..97d8da5b07b4 100644
>     >     >     > --- a/llvm/unittests/IR/PatternMatch.cpp
>     >     >     > +++ b/llvm/unittests/IR/PatternMatch.cpp
>     >     >     > @@ -1445,8 +1445,8 @@ TEST_F(PatternMatchTest,
>     >     > ConstantPredicateType) {
>     >     >     >    EXPECT_TRUE(match(CF32Pi,
>     >     > cstfp_pred_ty<always_true_pred<APFloat>>()));
>     >     >     >    EXPECT_FALSE(match(CF32Pi,
>     >     >     > cstfp_pred_ty<always_false_pred<APFloat>>()));
>     >     >     >
>     >     >     > -  ElementCount FixedEC(4, false);
>     >     >     > -  ElementCount ScalableEC(4, true);
>     >     >     > +  auto FixedEC = ElementCount::getFixed(4);  auto
> ScalableEC
>     > =
>     >     >     > + ElementCount::getScalable(4);
>     >     >     >
>     >     >     >    // Vector splat
>     >     >     >
>     >     >     >
>     >     >     > diff  --git a/llvm/unittests/IR/VectorTypesTest.cpp
>     >     >     > b/llvm/unittests/IR/VectorTypesTest.cpp
>     >     >     > index 0dbf15ee6fc0..b28e445c97a7 100644
>     >     >     > --- a/llvm/unittests/IR/VectorTypesTest.cpp
>     >     >     > +++ b/llvm/unittests/IR/VectorTypesTest.cpp
>     >     >     > @@ -59,13 +59,13 @@ TEST(VectorTypesTest, FixedLength) {
>     >     >     >
> dyn_cast<FixedVectorType>(VectorType::get(Int32Ty,
>     >     > V8Int32Ty));
>     >     >     >    EXPECT_VTY_EQ(V8Int32Ty, V8Int32Ty2);
>     >     >     >
>     >     >     > -  auto *V8Int16Ty =
>     >     >     > -
> dyn_cast<FixedVectorType>(VectorType::get(Int16Ty, {8,
>     >     > false}));
>     >     >     > +  auto *V8Int16Ty = dyn_cast<FixedVectorType>(
>     >     >     > +      VectorType::get(Int16Ty,
> ElementCount::getFixed(8)));
>     >     >     >    ASSERT_NE(nullptr, V8Int16Ty);
>     >     >     >    EXPECT_EQ(V8Int16Ty->getNumElements(), 8U);
>     >     >     >    EXPECT_EQ(V8Int16Ty->getElementType()-
>     > >getScalarSizeInBits(),
>     >     > 16U);
>     >     >     >
>     >     >     > -  ElementCount EltCnt(4, false);
>     >     >     > +  auto EltCnt = ElementCount::getFixed(4);
>     >     >     >    auto *V4Int64Ty =
>     >     > dyn_cast<FixedVectorType>(VectorType::get(Int64Ty,
>     >     >     > EltCnt));
>     >     >     >    ASSERT_NE(nullptr, V4Int64Ty);
>     >     >     >    EXPECT_EQ(V4Int64Ty->getNumElements(), 4U); @@ -
> 153,13
>     > +153,13 @@
>     >     >     > TEST(VectorTypesTest, Scalable) {
>     >     >     >
> dyn_cast<ScalableVectorType>(VectorType::get(Int32Ty,
>     >     >     > ScV8Int32Ty));
>     >     >     >    EXPECT_VTY_EQ(ScV8Int32Ty, ScV8Int32Ty2);
>     >     >     >
>     >     >     > -  auto *ScV8Int16Ty =
>     >     >     > -
> dyn_cast<ScalableVectorType>(VectorType::get(Int16Ty,
>     > {8,
>     >     > true}));
>     >     >     > +  auto *ScV8Int16Ty = dyn_cast<ScalableVectorType>(
>     >     >     > +      VectorType::get(Int16Ty,
>     > ElementCount::getScalable(8)));
>     >     >     >    ASSERT_NE(nullptr, ScV8Int16Ty);
>     >     >     >    EXPECT_EQ(ScV8Int16Ty->getMinNumElements(), 8U);
>     >     >     >    EXPECT_EQ(ScV8Int16Ty->getElementType()-
>     > >getScalarSizeInBits(),
>     >     > 16U);
>     >     >     >
>     >     >     > -  ElementCount EltCnt(4, true);
>     >     >     > +  auto EltCnt = ElementCount::getScalable(4);
>     >     >     >    auto *ScV4Int64Ty =
>     >     >     >
> dyn_cast<ScalableVectorType>(VectorType::get(Int64Ty,
>     >     > EltCnt));
>     >     >     >    ASSERT_NE(nullptr, ScV4Int64Ty);
>     >     >     > @@ -225,14 +225,15 @@ TEST(VectorTypesTest,
> BaseVectorType) {
>     >     >     >    Type *Int16Ty = Type::getInt16Ty(Ctx);
>     >     >     >    Type *Int32Ty = Type::getInt32Ty(Ctx);
>     >     >     >
>     >     >     > -  std::array<VectorType *, 8> VTys =
>     > {VectorType::get(Int16Ty, {4,
>     >     >     > true}),
>     >     >     > -
>     > VectorType::get(Int16Ty, {4,
>     >     >     > false}),
>     >     >     > -
>     > VectorType::get(Int16Ty, {2,
>     >     >     > true}),
>     >     >     > -
>     > VectorType::get(Int16Ty, {2,
>     >     >     > false}),
>     >     >     > -
>     > VectorType::get(Int32Ty, {4,
>     >     >     > true}),
>     >     >     > -
>     > VectorType::get(Int32Ty, {4,
>     >     >     > false}),
>     >     >     > -
>     > VectorType::get(Int32Ty, {2,
>     >     >     > true}),
>     >     >     > -
>     > VectorType::get(Int32Ty, {2,
>     >     >     > false})};
>     >     >     > +  std::array<VectorType *, 8> VTys = {
>     >     >     > +      VectorType::get(Int16Ty,
> ElementCount::getScalable(4)),
>     >     >     > +      VectorType::get(Int16Ty,
> ElementCount::getFixed(4)),
>     >     >     > +      VectorType::get(Int16Ty,
> ElementCount::getScalable(2)),
>     >     >     > +      VectorType::get(Int16Ty,
> ElementCount::getFixed(2)),
>     >     >     > +      VectorType::get(Int32Ty,
> ElementCount::getScalable(4)),
>     >     >     > +      VectorType::get(Int32Ty,
> ElementCount::getFixed(4)),
>     >     >     > +      VectorType::get(Int32Ty,
> ElementCount::getScalable(2)),
>     >     >     > +      VectorType::get(Int32Ty,
> ElementCount::getFixed(2))};
>     >     >     >
>     >     >     >    /*
>     >     >     >      The comparison matrix is symmetric, so we only
> check the
>     > upper
>     >     >     > triangle:
>     >     >     >
>     >     >     > diff  --git a/llvm/unittests/IR/VerifierTest.cpp
>     >     >     > b/llvm/unittests/IR/VerifierTest.cpp
>     >     >     > index f6a6a6ec7128..174e3eea3cce 100644
>     >     >     > --- a/llvm/unittests/IR/VerifierTest.cpp
>     >     >     > +++ b/llvm/unittests/IR/VerifierTest.cpp
>     >     >     > @@ -57,7 +57,7 @@ TEST(VerifierTest, Freeze) {
>     >     >     >    ConstantInt *CI = ConstantInt::get(ITy, 0);
>     >     >     >
>     >     >     >    // Valid type : freeze(<2 x i32>)
>     >     >     > -  Constant *CV = ConstantVector::getSplat({2, false},
> CI);
>     >     >     > +  Constant *CV =
>     >     > ConstantVector::getSplat(ElementCount::getFixed(2),
>     >     >     > + CI);
>     >     >     >    FreezeInst *FI_vec = new FreezeInst(CV);
>     >     >     >    FI_vec->insertBefore(RI);
>     >     >     >
>     >     >     >
>     >     >     >
>     >     >     >
>     >     >     > _______________________________________________
>     >     >     > llvm-commits mailing list
>     >     >     > llvm-commits at lists.llvm.org
>     >     >     > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-
> commits
>     >
> 



More information about the llvm-commits mailing list