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 @@ -266,7 +266,7 @@ ElementCount VPIntrinsic::getStaticVectorLength() const { auto GetVectorLengthOfType = [](const Type *T) -> ElementCount { - auto VT = cast(T); + const auto *VT = cast(T); auto ElemCount = VT->getElementCount(); return ElemCount; }; @@ -380,7 +380,7 @@ // Check whether "W == vscale * EC.getKnownMinValue()" if (EC.isScalable()) { // Undig the DL - auto ParMod = this->getModule(); + const auto *ParMod = this->getModule(); if (!ParMod) return false; const auto &DL = ParMod->getDataLayout(); @@ -393,7 +393,7 @@ } // standard SIMD operation - auto VLConst = dyn_cast(VLParam); + const auto *VLConst = dyn_cast(VLParam); if (!VLConst) return false; 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 @@ -32,7 +32,7 @@ LLVMContext C; SMDiagnostic Err; - std::unique_ptr CreateVPDeclarationModule() { + std::unique_ptr createVPDeclarationModule() { const char *BinaryIntOpcodes[] = {"add", "sub", "mul", "sdiv", "srem", "udiv", "urem", "and", "xor", "or", "ashr", "lshr", "shl"}; @@ -78,7 +78,7 @@ /// Check that every VP intrinsic in the test module is recognized as a VP /// intrinsic. TEST_F(VPIntrinsicTest, VPModuleComplete) { - std::unique_ptr M = CreateVPDeclarationModule(); + std::unique_ptr M = createVPDeclarationModule(); assert(M); // Check that all @llvm.vp.* functions in the module are recognized vp @@ -135,25 +135,24 @@ auto *F = M->getFunction("test_static_vlen"); assert(F); - const int NumExpected = 12; const bool Expected[] = {false, true, false, false, false, true, false, false, true, false, true, false}; - int i = 0; + const auto *ExpectedIt = std::begin(Expected); for (auto &I : F->getEntryBlock()) { VPIntrinsic *VPI = dyn_cast(&I); if (!VPI) continue; - ASSERT_LT(i, NumExpected); - ASSERT_EQ(Expected[i], VPI->canIgnoreVectorLengthParam()); - ++i; + ASSERT_NE(ExpectedIt, std::end(Expected)); + ASSERT_EQ(*ExpectedIt, VPI->canIgnoreVectorLengthParam()); + ++ExpectedIt; } } /// Check that the argument returned by /// VPIntrinsic::getParamPos(Intrinsic::ID) has the expected type. TEST_F(VPIntrinsicTest, GetParamPos) { - std::unique_ptr M = CreateVPDeclarationModule(); + std::unique_ptr M = createVPDeclarationModule(); assert(M); for (Function &F : *M) { @@ -209,7 +208,7 @@ /// Check that going from VP intrinsic to Opcode and back results in the same /// intrinsic id. TEST_F(VPIntrinsicTest, IntrinsicIDRoundTrip) { - std::unique_ptr M = CreateVPDeclarationModule(); + std::unique_ptr M = createVPDeclarationModule(); assert(M); unsigned FullTripCounts = 0; @@ -231,7 +230,7 @@ /// Check that VPIntrinsic::getDeclarationForParams works. TEST_F(VPIntrinsicTest, VPIntrinsicDeclarationForParams) { - std::unique_ptr M = CreateVPDeclarationModule(); + std::unique_ptr M = createVPDeclarationModule(); assert(M); auto OutM = std::make_unique("", M->getContext()); @@ -251,8 +250,10 @@ // Check that 'old decl' == 'new decl'. ASSERT_EQ(F.getIntrinsicID(), NewDecl->getIntrinsicID()); - auto ItNewParams = NewDecl->getFunctionType()->param_begin(); - auto EndItNewParams = NewDecl->getFunctionType()->param_end(); + FunctionType::param_iterator ItNewParams = + NewDecl->getFunctionType()->param_begin(); + FunctionType::param_iterator EndItNewParams = + NewDecl->getFunctionType()->param_end(); for (auto *ParamTy : FuncTy->params()) { ASSERT_NE(ItNewParams, EndItNewParams); ASSERT_EQ(*ItNewParams, ParamTy); diff --git a/llvm/utils/vim/syntax/llvm.vim b/llvm/utils/vim/syntax/llvm.vim --- a/llvm/utils/vim/syntax/llvm.vim +++ b/llvm/utils/vim/syntax/llvm.vim @@ -26,15 +26,15 @@ syn keyword llvmStatement bitcast br catchpad catchswitch catchret call callbr syn keyword llvmStatement cleanuppad cleanupret cmpxchg eq exact extractelement syn keyword llvmStatement extractvalue fadd fast fcmp fdiv fence fmul fpext -syn keyword llvmStatement fptosi fptoui fptrunc free freeze frem fsub fneg getelementptr -syn keyword llvmStatement icmp inbounds indirectbr insertelement insertvalue -syn keyword llvmStatement inttoptr invoke landingpad load lshr malloc max min -syn keyword llvmStatement mul nand ne ninf nnan nsw nsz nuw oeq oge ogt ole -syn keyword llvmStatement olt one or ord phi ptrtoint resume ret sdiv select -syn keyword llvmStatement sext sge sgt shl shufflevector sitofp sle slt srem -syn keyword llvmStatement store sub switch trunc udiv ueq uge ugt uitofp ule ult -syn keyword llvmStatement umax umin une uno unreachable unwind urem va_arg -syn keyword llvmStatement xchg xor zext +syn keyword llvmStatement fptosi fptoui fptrunc free freeze frem fsub fneg +syn keyword llvmStatement getelementptr icmp inbounds indirectbr insertelement +syn keyword llvmStatement insertvalue inttoptr invoke landingpad load lshr +syn keyword llvmStatement malloc max min mul nand ne ninf nnan nsw nsz nuw oeq +syn keyword llvmStatement oge ogt ole olt one or ord phi ptrtoint resume ret +syn keyword llvmStatement sdiv select sext sge sgt shl shufflevector sitofp +syn keyword llvmStatement sle slt srem store sub switch trunc udiv ueq uge ugt +syn keyword llvmStatement uitofp ule ult umax umin une uno unreachable unwind +syn keyword llvmStatement urem va_arg xchg xor zext " Keywords. syn keyword llvmKeyword