diff --git a/llvm/include/llvm/IR/IntrinsicInst.h b/llvm/include/llvm/IR/IntrinsicInst.h --- a/llvm/include/llvm/IR/IntrinsicInst.h +++ b/llvm/include/llvm/IR/IntrinsicInst.h @@ -389,14 +389,14 @@ /// This is the common base class for vector predication intrinsics. class VPIntrinsic : public IntrinsicInst { public: - static Optional GetMaskParamPos(Intrinsic::ID IntrinsicID); - static Optional GetVectorLengthParamPos(Intrinsic::ID IntrinsicID); + static Optional getMaskParamPos(Intrinsic::ID IntrinsicID); + static Optional getVectorLengthParamPos(Intrinsic::ID IntrinsicID); /// The llvm.vp.* intrinsics for this instruction Opcode - static Intrinsic::ID GetForOpcode(unsigned OC); + static Intrinsic::ID getForOpcode(unsigned OC); // Whether \p ID is a VP intrinsic ID. - static bool IsVPIntrinsic(Intrinsic::ID); + static bool isVPIntrinsic(Intrinsic::ID); /// \return the mask parameter or nullptr. Value *getMaskParam() const; @@ -415,7 +415,7 @@ // Methods for support type inquiry through isa, cast, and dyn_cast: static bool classof(const IntrinsicInst *I) { - return IsVPIntrinsic(I->getIntrinsicID()); + return isVPIntrinsic(I->getIntrinsicID()); } static bool classof(const Value *V) { return isa(V) && classof(cast(V)); @@ -423,11 +423,11 @@ // Equivalent non-predicated opcode Optional getFunctionalOpcode() const { - return GetFunctionalOpcodeForVP(getIntrinsicID()); + return getFunctionalOpcodeForVP(getIntrinsicID()); } // Equivalent non-predicated opcode - static Optional GetFunctionalOpcodeForVP(Intrinsic::ID ID); + static Optional getFunctionalOpcodeForVP(Intrinsic::ID ID); }; /// This is the common base class for constrained floating point intrinsics. diff --git a/llvm/lib/IR/IntrinsicInst.cpp b/llvm/lib/IR/IntrinsicInst.cpp --- a/llvm/lib/IR/IntrinsicInst.cpp +++ b/llvm/lib/IR/IntrinsicInst.cpp @@ -288,35 +288,36 @@ return ElemCount; }; - auto VPMask = getMaskParam(); + Value *VPMask = getMaskParam(); + assert(VPMask && "No mask param?"); return GetVectorLengthOfType(VPMask->getType()); } Value *VPIntrinsic::getMaskParam() const { - auto maskPos = GetMaskParamPos(getIntrinsicID()); - if (maskPos) - return getArgOperand(maskPos.getValue()); + auto MaskPos = getMaskParamPos(getIntrinsicID()); + if (MaskPos) + return getArgOperand(MaskPos.getValue()); return nullptr; } void VPIntrinsic::setMaskParam(Value *NewMask) { - auto MaskPos = GetMaskParamPos(getIntrinsicID()); + auto MaskPos = getMaskParamPos(getIntrinsicID()); setArgOperand(*MaskPos, NewMask); } Value *VPIntrinsic::getVectorLengthParam() const { - auto vlenPos = GetVectorLengthParamPos(getIntrinsicID()); - if (vlenPos) - return getArgOperand(vlenPos.getValue()); + auto EVLPos = getVectorLengthParamPos(getIntrinsicID()); + if (EVLPos) + return getArgOperand(EVLPos.getValue()); return nullptr; } void VPIntrinsic::setVectorLengthParam(Value *NewEVL) { - auto EVLPos = GetVectorLengthParamPos(getIntrinsicID()); + auto EVLPos = getVectorLengthParamPos(getIntrinsicID()); setArgOperand(*EVLPos, NewEVL); } -Optional VPIntrinsic::GetMaskParamPos(Intrinsic::ID IntrinsicID) { +Optional VPIntrinsic::getMaskParamPos(Intrinsic::ID IntrinsicID) { switch (IntrinsicID) { default: return None; @@ -328,7 +329,7 @@ } } -Optional VPIntrinsic::GetVectorLengthParamPos(Intrinsic::ID IntrinsicID) { +Optional VPIntrinsic::getVectorLengthParamPos(Intrinsic::ID IntrinsicID) { switch (IntrinsicID) { default: return None; @@ -340,7 +341,7 @@ } } -bool VPIntrinsic::IsVPIntrinsic(Intrinsic::ID ID) { +bool VPIntrinsic::isVPIntrinsic(Intrinsic::ID ID) { switch (ID) { default: return false; @@ -354,7 +355,7 @@ } // Equivalent non-predicated opcode -Optional VPIntrinsic::GetFunctionalOpcodeForVP(Intrinsic::ID ID) { +Optional VPIntrinsic::getFunctionalOpcodeForVP(Intrinsic::ID ID) { Optional FunctionalOC; switch (ID) { default: @@ -368,7 +369,7 @@ return FunctionalOC; } -Intrinsic::ID VPIntrinsic::GetForOpcode(unsigned IROPC) { +Intrinsic::ID VPIntrinsic::getForOpcode(unsigned IROPC) { switch (IROPC) { default: return Intrinsic::not_intrinsic; diff --git a/llvm/unittests/IR/VPIntrinsicTest.cpp b/llvm/unittests/IR/VPIntrinsicTest.cpp --- a/llvm/unittests/IR/VPIntrinsicTest.cpp +++ b/llvm/unittests/IR/VPIntrinsicTest.cpp @@ -81,7 +81,7 @@ std::set SeenIDs; for (const auto &VPDecl : *M) { ASSERT_TRUE(VPDecl.isIntrinsic()); - ASSERT_TRUE(VPIntrinsic::IsVPIntrinsic(VPDecl.getIntrinsicID())); + ASSERT_TRUE(VPIntrinsic::isVPIntrinsic(VPDecl.getIntrinsicID())); SeenIDs.insert(VPDecl.getIntrinsicID()); } @@ -145,23 +145,23 @@ } /// Check that the argument returned by -/// VPIntrinsic::GetParamPos(Intrinsic::ID) has the expected type. +/// VPIntrinsic::getParamPos(Intrinsic::ID) has the expected type. TEST_F(VPIntrinsicTest, GetParamPos) { std::unique_ptr M = CreateVPDeclarationModule(); assert(M); for (Function &F : *M) { ASSERT_TRUE(F.isIntrinsic()); - Optional MaskParamPos = - VPIntrinsic::GetMaskParamPos(F.getIntrinsicID()); + Optional MaskParamPos = + VPIntrinsic::getMaskParamPos(F.getIntrinsicID()); if (MaskParamPos.hasValue()) { Type *MaskParamType = F.getArg(MaskParamPos.getValue())->getType(); ASSERT_TRUE(MaskParamType->isVectorTy()); ASSERT_TRUE(cast(MaskParamType)->getElementType()->isIntegerTy(1)); } - Optional VecLenParamPos = - VPIntrinsic::GetVectorLengthParamPos(F.getIntrinsicID()); + Optional VecLenParamPos = + VPIntrinsic::getVectorLengthParamPos(F.getIntrinsicID()); if (VecLenParamPos.hasValue()) { Type *VecLenParamType = F.getArg(VecLenParamPos.getValue())->getType(); ASSERT_TRUE(VecLenParamType->isIntegerTy(32)); @@ -182,13 +182,13 @@ unsigned FullTripCounts = 0; for (unsigned OC : Opcodes) { - Intrinsic::ID VPID = VPIntrinsic::GetForOpcode(OC); + Intrinsic::ID VPID = VPIntrinsic::getForOpcode(OC); // No equivalent VP intrinsic available. if (VPID == Intrinsic::not_intrinsic) continue; Optional RoundTripOC = - VPIntrinsic::GetFunctionalOpcodeForVP(VPID); + VPIntrinsic::getFunctionalOpcodeForVP(VPID); // No equivalent Opcode available. if (!RoundTripOC) continue; @@ -208,13 +208,13 @@ unsigned FullTripCounts = 0; for (const auto &VPDecl : *M) { auto VPID = VPDecl.getIntrinsicID(); - Optional OC = VPIntrinsic::GetFunctionalOpcodeForVP(VPID); + Optional OC = VPIntrinsic::getFunctionalOpcodeForVP(VPID); // no equivalent Opcode available if (!OC) continue; - Intrinsic::ID RoundTripVPID = VPIntrinsic::GetForOpcode(*OC); + Intrinsic::ID RoundTripVPID = VPIntrinsic::getForOpcode(*OC); ASSERT_EQ(RoundTripVPID, VPID); ++FullTripCounts;