@@ -443,12 +443,8 @@ void saveFCallState(G4_Kernel* kernel, savedFCallStates& savedFCallState)
443443 // the IR can be reused for another kernel rather than
444444 // recompiling.
445445 // kernel points to a stackcall function.
446- for ( BB_LIST_ITER bb_it = kernel->fg .BBs .begin ();
447- bb_it != kernel->fg .BBs .end ();
448- bb_it++ )
446+ for (auto curBB : kernel->fg .BBs )
449447 {
450- G4_BB* curBB = (*bb_it);
451-
452448 if ( curBB->size () > 0 && curBB->isEndWithFCall () )
453449 {
454450 // Save state for this fcall
@@ -542,8 +538,8 @@ void restoreFCallState(G4_Kernel* kernel, savedFCallStates& savedFCallState)
542538
543539G4_Kernel* Get_Resolved_Compilation_Unit ( common_isa_header header, std::list<G4_Kernel*> compilation_units, int idx )
544540{
545- for ( std::list<G4_Kernel*>::iterator k = compilation_units.begin ();
546- k != compilation_units. end () ; k++ )
541+ for ( std::list<G4_Kernel*>::iterator k = compilation_units.begin (), c_end = compilation_units. end () ;
542+ k != c_end ; k++ )
547543 {
548544 if ( (*k)->fg .builder ->getCUnitId () == (header.num_kernels + idx) && (*k)->fg .builder ->getIsKernel () == false )
549545 {
@@ -696,7 +692,7 @@ void Stitch_Compiled_Units( common_isa_header header, std::list<G4_Kernel*>& com
696692 }
697693
698694 // Append declarations and color attributes from all callees to kernel
699- for (auto it = callee_index.begin (); it ! = callee_index.end (); ++it )
695+ for (auto it = callee_index.begin (), ciEnd = callee_index.end (); it != ciEnd; ++it)
700696 {
701697 G4_Kernel* callee = Get_Resolved_Compilation_Unit ( header, compilation_units, (*it) );
702698
@@ -839,17 +835,17 @@ int CISA_IR_Builder::Compile( const char* nameInput)
839835
840836 savedFCallStates savedFCallState;
841837
842- for (std::list<VISAKernelImpl*>::iterator kernel_it = kernels.begin ();
843- kernel_it != kernels. end () ;
838+ for (std::list<VISAKernelImpl*>::iterator kernel_it = kernels.begin (), kend = kernels. end () ;
839+ kernel_it != kend ;
844840 kernel_it++)
845841 {
846842 VISAKernelImpl* kernel = (*kernel_it);
847843
848844 saveFCallState (kernel->getKernel (), savedFCallState);
849845 }
850846
851- for ( std::list<VISAKernelImpl*>::iterator func_it = functions.begin ();
852- func_it != functions. end () ;
847+ for ( std::list<VISAKernelImpl*>::iterator func_it = functions.begin (), fend = functions. end () ;
848+ func_it != fend ;
853849 func_it++ )
854850 {
855851 VISAKernelImpl* function = (*func_it);
@@ -1041,8 +1037,8 @@ int CISA_IR_Builder::CreateVISAFileVar(VISA_FileVar *& decl, char *varName, unsi
10411037 if ( IS_GEN_BOTH_PATH )
10421038 {
10431039 // Append file var to all kernel/function objects in CISA_IR_Builder
1044- for ( std::list<VISAKernelImpl*>::iterator it = m_kernels.begin ();
1045- it != m_kernels. end () ;
1040+ for ( std::list<VISAKernelImpl*>::iterator it = m_kernels.begin (), kend = m_kernels. end () ;
1041+ it != kend ;
10461042 it++ )
10471043 {
10481044 VISAKernelImpl* kernel = (*it);
0 commit comments