@@ -941,10 +941,9 @@ static void scalarize(Instruction *I,
941941 llvm_unreachable (" Unsupported instruction type" );
942942
943943 Result = Builder.CreateInsertElement (Result, NewOp, Idx);
944- if (auto *ScalarizedI = dyn_cast<Instruction>(NewOp)) {
945- ScalarizedI->copyIRFlags (I, true );
946- Worklist.push_back (ScalarizedI);
947- }
944+ Instruction *ScalarizedI = cast<Instruction>(NewOp);
945+ ScalarizedI->copyIRFlags (I, true );
946+ Worklist.push_back (ScalarizedI);
948947 }
949948
950949 I->replaceAllUsesWith (Result);
@@ -993,7 +992,6 @@ static void addToWorklist(Instruction &I,
993992static bool runImpl (Function &F, const TargetLowering &TLI,
994993 AssumptionCache *AC) {
995994 SmallVector<Instruction *, 4 > Worklist;
996- bool Modified = false ;
997995
998996 unsigned MaxLegalFpConvertBitWidth =
999997 TLI.getMaxLargeFPConvertBitWidthSupported ();
@@ -1015,7 +1013,6 @@ static bool runImpl(Function &F, const TargetLowering &TLI,
10151013 if (!targetSupportsFrem (TLI, Ty) &&
10161014 FRemExpander::canExpandType (Ty->getScalarType ())) {
10171015 addToWorklist (I, Worklist);
1018- Modified = true ;
10191016 }
10201017 break ;
10211018 case Instruction::FPToUI:
@@ -1025,7 +1022,6 @@ static bool runImpl(Function &F, const TargetLowering &TLI,
10251022 continue ;
10261023
10271024 addToWorklist (I, Worklist);
1028- Modified = true ;
10291025 break ;
10301026 }
10311027 case Instruction::UIToFP:
@@ -1036,14 +1032,14 @@ static bool runImpl(Function &F, const TargetLowering &TLI,
10361032 continue ;
10371033
10381034 addToWorklist (I, Worklist);
1039- Modified = true ;
10401035 break ;
10411036 }
10421037 default :
10431038 break ;
10441039 }
10451040 }
10461041
1042+ bool Modified = !Worklist.empty ();
10471043 while (!Worklist.empty ()) {
10481044 Instruction *I = Worklist.pop_back_val ();
10491045 if (I->getOpcode () == Instruction::FRem) {
0 commit comments