@@ -426,7 +426,7 @@ static bool isHoistableInstruction(Instruction *I, BasicBlock *BB,
426426 return false ;
427427
428428 // If the instruction is not a zero cost instruction, return false.
429- auto Cost = TTI->getInstructionCost (I, TargetTransformInfo::TCK_CodeSize );
429+ auto Cost = TTI->getInstructionCost (I, TargetTransformInfo::TCK_Latency );
430430 InstructionCost::CostType CostVal =
431431 Cost.isValid ()
432432 ? Cost.getValue ()
@@ -435,8 +435,8 @@ static bool isHoistableInstruction(Instruction *I, BasicBlock *BB,
435435 return false ;
436436
437437 // Check if any operands are instructions defined in the same block.
438- for (unsigned i = 0 , e = I->getNumOperands (); i < e; ++i ) {
439- if (auto *OpI = dyn_cast<Instruction>(I-> getOperand (i) )) {
438+ for (auto &Op : I->operands () ) {
439+ if (auto *OpI = dyn_cast<Instruction>(Op )) {
440440 if (OpI->getParent () == BB)
441441 return false ;
442442 }
@@ -976,7 +976,9 @@ void StructurizeCFG::simplifyHoistedPhis() {
976976
977977 for (int i = 0 ; i < 2 ; i++) {
978978 Value *V = Phi->getIncomingValue (i);
979- if (!HoistedValues.count (V))
979+ auto BBIt = HoistedValues.find (V);
980+
981+ if (BBIt == HoistedValues.end ())
980982 continue ;
981983
982984 Value *OtherV = Phi->getIncomingValue (!i);
@@ -992,7 +994,7 @@ void StructurizeCFG::simplifyHoistedPhis() {
992994 break ;
993995 }
994996 if (PoisonValBBIdx == -1 ||
995- !DT->dominates (HoistedValues[V] ,
997+ !DT->dominates (BBIt-> second ,
996998 OtherPhi->getIncomingBlock (PoisonValBBIdx)))
997999 continue ;
9981000
0 commit comments