@@ -102,11 +102,14 @@ bool ProfileInjector::inject() {
102102 for (auto &BB : F) {
103103 if (AnnotateSelect) {
104104 for (auto &I : BB) {
105- if (auto *SI = dyn_cast<SelectInst>(&I))
106- if (!SI->getCondition ()->getType ()->isVectorTy () &&
107- !I.getMetadata (LLVMContext::MD_prof))
108- setBranchWeights (I, {SelectTrueWeight, SelectFalseWeight},
109- /* IsExpected=*/ false );
105+ if (auto *SI = dyn_cast<SelectInst>(&I)) {
106+ if (SI->getCondition ()->getType ()->isVectorTy ())
107+ continue ;
108+ if (I.getMetadata (LLVMContext::MD_prof))
109+ continue ;
110+ setBranchWeights (I, {SelectTrueWeight, SelectFalseWeight},
111+ /* IsExpected=*/ false );
112+ }
110113 }
111114 }
112115 auto *Term = getTerminatorBenefitingFromMDProf (BB);
@@ -187,11 +190,14 @@ PreservedAnalyses ProfileVerifierPass::run(Function &F,
187190 for (const auto &BB : F) {
188191 if (AnnotateSelect) {
189192 for (const auto &I : BB)
190- if (auto *SI = dyn_cast<SelectInst>(&I))
191- if (!SI->getCondition ()->getType ()->isVectorTy () &&
192- !I.getMetadata (LLVMContext::MD_prof))
193- F.getContext ().emitError (
194- " Profile verification failed: select annotation missing" );
193+ if (auto *SI = dyn_cast<SelectInst>(&I)) {
194+ if (SI->getCondition ()->getType ()->isVectorTy ())
195+ continue ;
196+ if (I.getMetadata (LLVMContext::MD_prof))
197+ continue ;
198+ F.getContext ().emitError (
199+ " Profile verification failed: select annotation missing" );
200+ }
195201 }
196202 if (const auto *Term =
197203 ProfileInjector::getTerminatorBenefitingFromMDProf (BB))
0 commit comments