@@ -6462,7 +6462,7 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I,
6462
6462
Instruction::ICmp,
6463
6463
ToVectorTy (Switch->getCondition ()->getType (), VF),
6464
6464
ToVectorTy (Type::getInt1Ty (I->getContext ()), VF),
6465
- CmpInst::BAD_ICMP_PREDICATE , CostKind);
6465
+ CmpInst::ICMP_EQ , CostKind);
6466
6466
}
6467
6467
case Instruction::PHI: {
6468
6468
auto *Phi = cast<PHINode>(I);
@@ -7867,11 +7867,13 @@ void VPRecipeBuilder::createSwitchEdgeMasks(SwitchInst *SI) {
7867
7867
BasicBlock *DefaultDst = SI->getDefaultDest ();
7868
7868
MapVector<BasicBlock *, SmallVector<VPValue *>> Dst2Compares;
7869
7869
for (auto &C : SI->cases ()) {
7870
+ BasicBlock *Dst = C.getCaseSuccessor ();
7871
+ assert (!EdgeMaskCache.contains ({Src, Dst}) && " Edge masks already created" );
7870
7872
// Cases whose destination is the same as default are redundant and can be
7871
7873
// ignored - they will get there anyhow.
7872
- if (C. getCaseSuccessor () == DefaultDst)
7874
+ if (Dst == DefaultDst)
7873
7875
continue ;
7874
- auto I = Dst2Compares.insert ({C. getCaseSuccessor () , {}});
7876
+ auto I = Dst2Compares.insert ({Dst , {}});
7875
7877
VPValue *V = getVPValueOrAddLiveIn (C.getCaseValue (), Plan);
7876
7878
I.first ->second .push_back (Builder.createICmp (CmpInst::ICMP_EQ, Cond, V));
7877
7879
}
0 commit comments