@@ -10811,14 +10811,12 @@ void SelectionDAGISel::LowerArguments(const Function &F) {
10811
10811
void
10812
10812
SelectionDAGBuilder::HandlePHINodesInSuccessorBlocks (const BasicBlock *LLVMBB) {
10813
10813
const TargetLowering &TLI = DAG.getTargetLoweringInfo ();
10814
- const Instruction *TI = LLVMBB->getTerminator ();
10815
10814
10816
10815
SmallPtrSet<MachineBasicBlock *, 4 > SuccsHandled;
10817
10816
10818
10817
// Check PHI nodes in successors that expect a value to be available from this
10819
10818
// block.
10820
- for (unsigned succ = 0 , e = TI->getNumSuccessors (); succ != e; ++succ) {
10821
- const BasicBlock *SuccBB = TI->getSuccessor (succ);
10819
+ for (const BasicBlock *SuccBB : successors (LLVMBB->getTerminator ())) {
10822
10820
if (!isa<PHINode>(SuccBB->begin ())) continue ;
10823
10821
MachineBasicBlock *SuccMBB = FuncInfo.MBBMap [SuccBB];
10824
10822
@@ -10844,7 +10842,7 @@ SelectionDAGBuilder::HandlePHINodesInSuccessorBlocks(const BasicBlock *LLVMBB) {
10844
10842
unsigned Reg;
10845
10843
const Value *PHIOp = PN.getIncomingValueForBlock (LLVMBB);
10846
10844
10847
- if (const Constant *C = dyn_cast<Constant>(PHIOp)) {
10845
+ if (const auto *C = dyn_cast<Constant>(PHIOp)) {
10848
10846
unsigned &RegOut = ConstantsOut[C];
10849
10847
if (RegOut == 0 ) {
10850
10848
RegOut = FuncInfo.CreateRegs (C);
@@ -10875,10 +10873,9 @@ SelectionDAGBuilder::HandlePHINodesInSuccessorBlocks(const BasicBlock *LLVMBB) {
10875
10873
// the input for this MBB.
10876
10874
SmallVector<EVT, 4 > ValueVTs;
10877
10875
ComputeValueVTs (TLI, DAG.getDataLayout (), PN.getType (), ValueVTs);
10878
- for (unsigned vti = 0 , vte = ValueVTs.size (); vti != vte; ++vti) {
10879
- EVT VT = ValueVTs[vti];
10880
- unsigned NumRegisters = TLI.getNumRegisters (*DAG.getContext (), VT);
10881
- for (unsigned i = 0 , e = NumRegisters; i != e; ++i)
10876
+ for (EVT VT : ValueVTs) {
10877
+ const unsigned NumRegisters = TLI.getNumRegisters (*DAG.getContext (), VT);
10878
+ for (unsigned i = 0 ; i != NumRegisters; ++i)
10882
10879
FuncInfo.PHINodesToUpdate .push_back (
10883
10880
std::make_pair (&*MBBI++, Reg + i));
10884
10881
Reg += NumRegisters;
0 commit comments