mirror of
				https://github.com/intel/intel-graphics-compiler.git
				synced 2025-10-30 08:18:26 +08:00 
			
		
		
		
	Minor fixes and refactors.
- Pass string by const ref where makes sense. - Construct + push_back -> emplace_back. - Move NewOutputArgs instead of cpy. - const auto to const auto ref where possible. - dyn_cast to cast where certain cast won't fail.
This commit is contained in:
		| @ -924,7 +924,7 @@ void InlineRaytracing::HandleOptimizationsAndSpills(llvm::Function &F, LivenessD | ||||
|   for (const auto [I, closures] : instructionClosures) { | ||||
|  | ||||
|     IRB.SetInsertPoint(I); | ||||
|     for (const auto c : closures) | ||||
|     for (const auto &c : closures) | ||||
|       c(IRB); | ||||
|   } | ||||
|  | ||||
| @ -938,7 +938,7 @@ void InlineRaytracing::HandleOptimizationsAndSpills(llvm::Function &F, LivenessD | ||||
|  | ||||
|     IRB.SetInsertPoint(succ->getFirstNonPHI()); | ||||
|  | ||||
|     for (const auto c : closures) | ||||
|     for (const auto &c : closures) | ||||
|       c(IRB); | ||||
|   } | ||||
| } | ||||
|  | ||||
| @ -1220,8 +1220,8 @@ private: | ||||
|   llvm::raw_ostream *LogStream; | ||||
|  | ||||
|   // Helper function to format debug information string | ||||
|   static std::string formatDebugInfo(int32_t CurrentPressure, int32_t Estimate, const std::string Type, | ||||
|                                      const std::string AddString = "") { | ||||
|   static std::string formatDebugInfo(int32_t CurrentPressure, int32_t Estimate, const std::string &Type, | ||||
|                                      const std::string &AddString = "") { | ||||
|     const int ESTIMATION_NUMBERS_WIDTH = 12; | ||||
|     const int INFO_WIDTH = 20; | ||||
|     std::string Info = std::to_string(CurrentPressure) + ", " + std::to_string(Estimate); | ||||
|  | ||||
| @ -478,7 +478,7 @@ void CustomSafeOptPass::visitIntAtomicIAddToIncOrDec(CallInst *I) { | ||||
|   if (m_modMD->compOpt.DisableConvertingAtomicIAddToIncDec) | ||||
|     return; | ||||
|  | ||||
|   GenIntrinsicInst *instr = dyn_cast<GenIntrinsicInst>(I); | ||||
|   GenIntrinsicInst *instr = cast<GenIntrinsicInst>(I); | ||||
|   GenISAIntrinsic::ID id = instr->getIntrinsicID(); | ||||
|  | ||||
| // clang-format off | ||||
|  | ||||
| @ -510,7 +510,7 @@ bool TranslateBuildSPMDAndESIMD(llvm::ArrayRef<SPVTranslationPair> InputModules, | ||||
|     // If this is the last SPIR-V to compile, stop here. The rest of the code | ||||
|     // handles extracting information for further compilations. | ||||
|     if (IsLast) { | ||||
|       *pOutputArgs = NewOutputArgs; | ||||
|       *pOutputArgs = std::move(NewOutputArgs); | ||||
|       break; | ||||
|     } | ||||
|  | ||||
|  | ||||
| @ -178,8 +178,7 @@ static bool tryParsePassNumber(PassDisableConfig &pdc, const std::string &Token) | ||||
|   if (std::all_of(tempTokenWithoutSpaces.cbegin(), tempTokenWithoutSpaces.cend(), ::isdigit)) { | ||||
|     std::cerr << "You want to skip pass ID " << Token << std::endl; | ||||
|     unsigned int passNumber = std::stoi(Token); | ||||
|     auto localSkipComand = SkipCommand(passNumber); | ||||
|     pdc.skipCommands.push_back(std::move(localSkipComand)); | ||||
|     pdc.skipCommands.emplace_back(passNumber); | ||||
|     // move to next Token | ||||
|     return true; | ||||
|   } | ||||
| @ -234,8 +233,7 @@ static bool tryParsePassRange(PassDisableConfig &pdc, const std::string &Token) | ||||
|     unsigned int skippingTo = std::stoi(vectorOfSubTokens[1]); | ||||
|     if (checkSkipCommandBounds(skippingFrom, skippingTo)) { | ||||
|       std::cerr << "You want to skip passes from " << skippingFrom << " to " << skippingTo << std::endl; | ||||
|       auto localSkipComand = SkipCommand(skippingFrom, skippingTo); | ||||
|       pdc.skipCommands.push_back(localSkipComand); | ||||
|       pdc.skipCommands.emplace_back(skippingFrom, skippingTo); | ||||
|     } | ||||
|     break; | ||||
|   } | ||||
| @ -247,9 +245,8 @@ static bool tryParsePassRange(PassDisableConfig &pdc, const std::string &Token) | ||||
|     if (SkipCommand *sc = getFirstCommand(pdc, TokenSkipCase::OpenRange)) { | ||||
|       sc->start = std::min(sc->start, skippingFrom); | ||||
|     } else { | ||||
|       auto localSkipComand = | ||||
|           SkipCommand("", skippingFrom, std::numeric_limits<unsigned int>::max(), TokenSkipCase::OpenRange); | ||||
|       pdc.skipCommands.push_back(std::move(localSkipComand)); | ||||
|       pdc.skipCommands.emplace_back("", skippingFrom, std::numeric_limits<unsigned int>::max(), | ||||
|                                     TokenSkipCase::OpenRange); | ||||
|     } | ||||
|     break; | ||||
|   } | ||||
| @ -275,9 +272,7 @@ static bool tryParsePassNameSpecificOccurrence(PassDisableConfig &pdc, const std | ||||
|   } | ||||
|   std::cerr << "You want to skip pass " << nameOfPassToSkip << " occurrence " << occurrenceOfPass << std::endl; | ||||
|   unsigned int passOccurrence = std::stoi(occurrenceOfPass); | ||||
|   auto localSkipComand = | ||||
|       SkipCommand(nameOfPassToSkip, passOccurrence, passOccurrence, TokenSkipCase::SpecificPassOccurrence); | ||||
|   pdc.skipCommands.push_back(std::move(localSkipComand)); | ||||
|   pdc.skipCommands.emplace_back(nameOfPassToSkip, passOccurrence, passOccurrence, TokenSkipCase::SpecificPassOccurrence); | ||||
|   // move to next Token | ||||
|   return true; | ||||
| } | ||||
| @ -315,9 +310,7 @@ static bool tryParsePassNameOccurrenceRange(PassDisableConfig &pdc, const std::s | ||||
|     if (checkSkipCommandBounds(skippingFrom, skippingTo)) { | ||||
|       std::cerr << "You want to skip pass " << nameOfPassToSkip << " from occurrence " << skippingFrom | ||||
|                 << " to occurrence " << skippingTo << std::endl; | ||||
|       auto localSkipComand = | ||||
|           SkipCommand(nameOfPassToSkip, skippingFrom, skippingTo, TokenSkipCase::SpecificPassOccurrenceRange); | ||||
|       pdc.skipCommands.push_back(localSkipComand); | ||||
|       pdc.skipCommands.emplace_back(nameOfPassToSkip, skippingFrom, skippingTo, TokenSkipCase::SpecificPassOccurrenceRange); | ||||
|     } | ||||
|     break; | ||||
|   } | ||||
| @ -330,9 +323,8 @@ static bool tryParsePassNameOccurrenceRange(PassDisableConfig &pdc, const std::s | ||||
|     if (SkipCommand *sc = getFirstCommand(pdc, TokenSkipCase::SpecificPassOccurrenceOpenRange, nameOfPassToSkip)) { | ||||
|       sc->start = std::min(sc->start, skippingFrom); | ||||
|     } else { | ||||
|       auto localSkipComand = SkipCommand(nameOfPassToSkip, skippingFrom, std::numeric_limits<unsigned int>::max(), | ||||
|       pdc.skipCommands.emplace_back(nameOfPassToSkip, skippingFrom, std::numeric_limits<unsigned int>::max(), | ||||
|                                          TokenSkipCase::SpecificPassOccurrenceOpenRange); | ||||
|       pdc.skipCommands.push_back(std::move(localSkipComand)); | ||||
|     } | ||||
|     break; | ||||
|   } | ||||
| @ -376,8 +368,7 @@ static bool tryParsePassNames(PassDisableConfig &pdc, const std::string &Token) | ||||
|   case 1: { | ||||
|     const std::string &nameOfPassToSkip = vectorOfSubTokens[0]; | ||||
|     std::cerr << "You want to skip all occurrence of " << nameOfPassToSkip << std::endl; | ||||
|     auto localSkipComand = SkipCommand(nameOfPassToSkip); | ||||
|     pdc.skipCommands.push_back(std::move(localSkipComand)); | ||||
|     pdc.skipCommands.emplace_back(nameOfPassToSkip); | ||||
|     // move to next Token | ||||
|     return true; | ||||
|   } | ||||
| @ -405,7 +396,7 @@ static void parseShaderPassDisableFlag(PassDisableConfig &pdc) { | ||||
|     debugOutputStream << "Your input to ShaderPassDisable: " << passToSkip << '\n'; | ||||
|     debugOutputStream << "You want to skip pass ID " << passToSkip << '\n'; | ||||
|  | ||||
|     pdc.skipCommands.push_back(SkipCommand(passToSkip)); | ||||
|     pdc.skipCommands.emplace_back(passToSkip); | ||||
|   } | ||||
|   // Treat it as a string otherwise | ||||
|   else { | ||||
|  | ||||
| @ -120,7 +120,7 @@ void MetadataDumpRA::addKernelMD(G4_Kernel* kernel) { | ||||
|     } | ||||
|  | ||||
|     // add this kernel metadata to the total metadata | ||||
|     kernelMetadatas.push_back(kernelMD); | ||||
|     kernelMetadatas.push_back(std::move(kernelMD)); | ||||
|     numKernels += 1; | ||||
|     return; | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Milczek, Szymon
					Milczek, Szymon