[CPU] Added disable_context_promotion option

This disable ContextPromotionPass that causes instability in some games
This commit is contained in:
EmiGITs 2024-10-16 18:53:28 -03:00 committed by Radosław Gliński
parent 8af296a200
commit 0712132ed0
1 changed files with 15 additions and 3 deletions

View File

@ -28,6 +28,11 @@
DEFINE_bool(dump_translated_hir_functions, false, "dumps translated hir",
"CPU");
DEFINE_bool(disable_context_promotion, false,
"Disables Context Promotion optimizations, this may be needed for "
"some sports games, but will reduce performance.",
"CPU");
namespace xe {
namespace cpu {
namespace ppc {
@ -54,10 +59,17 @@ PPCTranslator::PPCTranslator(PPCFrontend* frontend) : frontend_(frontend) {
// Passes are executed in the order they are added. Multiple of the same
// pass type may be used.
if (validate) compiler_->AddPass(std::make_unique<passes::ValidationPass>());
compiler_->AddPass(std::make_unique<passes::ContextPromotionPass>());
if (validate) compiler_->AddPass(std::make_unique<passes::ValidationPass>());
if (!cvars::disable_context_promotion) {
if (validate) {
compiler_->AddPass(std::make_unique<passes::ValidationPass>());
}
compiler_->AddPass(std::make_unique<passes::ContextPromotionPass>());
if (validate) {
compiler_->AddPass(std::make_unique<passes::ValidationPass>());
}
}
// Grouped simplification + constant propagation.
// Loops until no changes are made.
auto sap = std::make_unique<passes::ConditionalGroupPass>();