Commit bd61b5b0 authored by Ross McIlroy's avatar Ross McIlroy Committed by Commit Bot

Reland "[TurboProp] Add MidTierMachineLoweringPhase to avoid Late/MemoryOptimizationPhases"

This is a reland of c70de45c

Original change's description:
> [TurboProp] Add MidTierMachineLoweringPhase to avoid Late/MemoryOptimizationPhases
>
> Adds a MidTierMachineLoweringPhase which does select and memory lowering to machine
> nodes. This allows TurboProp to avoid the LateOptimizationPhase and
> MemoryOptimizationPhase phases while still lowering all simplified nodes to
> machine nodes before instruction selection.
>
> BUG=v8:9684
>
> Change-Id: I60533db93152ff044a2fa8c1c31adedeb3747856
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1815130
> Reviewed-by: Georg Neis <neis@chromium.org>
> Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#63981}

TBR=neis@chromium.org

Bug: v8:9684
Change-Id: I9cf3d087b81bb81a09a725168da9dc19238da91f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1826726
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64003}
parent 70e07cdb
......@@ -1783,6 +1783,24 @@ struct MachineOperatorOptimizationPhase {
}
};
struct MidTierMachineLoweringPhase {
static const char* phase_name() { return "V8.TFMidTierMachineLoweringPhase"; }
void Run(PipelineData* data, Zone* temp_zone) {
GraphReducer graph_reducer(temp_zone, data->graph(),
&data->info()->tick_counter(),
data->jsgraph()->Dead());
SelectLowering select_lowering(data->jsgraph()->graph(),
data->jsgraph()->common());
MemoryLowering memory_lowering(data->jsgraph(), temp_zone,
data->info()->GetPoisoningMitigationLevel());
AddReducer(data, &graph_reducer, &memory_lowering);
AddReducer(data, &graph_reducer, &select_lowering);
graph_reducer.ReduceGraph();
}
};
struct CsaEarlyOptimizationPhase {
static const char* phase_name() { return "V8.CSAEarlyOptimization"; }
......@@ -2455,15 +2473,8 @@ bool PipelineImpl::OptimizeGraphForMidTier(Linkage* linkage) {
Run<EffectControlLinearizationPhase>();
RunPrintAndVerify(EffectControlLinearizationPhase::phase_name(), true);
// TODO(9684): Remove LateOptimizationPhase and move SelectLowering into the
// preceeding or subsequent phase.
Run<LateOptimizationPhase>();
RunPrintAndVerify(LateOptimizationPhase::phase_name(), true);
// TODO(9684): Consider directly lowering memory operations without memory
// optimizations.
Run<MemoryOptimizationPhase>();
RunPrintAndVerify(MemoryOptimizationPhase::phase_name(), true);
Run<MidTierMachineLoweringPhase>();
RunPrintAndVerify(MidTierMachineLoweringPhase::phase_name(), true);
data->source_positions()->RemoveDecorator();
if (data->info()->trace_turbo_json_enabled()) {
......
......@@ -24,6 +24,8 @@ const std::string kPReg = // NOLINT(runtime/string)
TEST(DisasmPoisonMonomorphicLoad) {
#ifdef ENABLE_DISASSEMBLER
if (i::FLAG_always_opt || !i::FLAG_opt) return;
// TODO(9684): Re-enable for TurboProp if necessary.
if (i::FLAG_turboprop) return;
i::FLAG_allow_natives_syntax = true;
i::FLAG_untrusted_code_mitigations = true;
......@@ -58,6 +60,8 @@ TEST(DisasmPoisonMonomorphicLoad) {
TEST(DisasmPoisonPolymorphicLoad) {
#ifdef ENABLE_DISASSEMBLER
if (i::FLAG_always_opt || !i::FLAG_opt) return;
// TODO(9684): Re-enable for TurboProp if necessary.
if (i::FLAG_turboprop) return;
i::FLAG_allow_natives_syntax = true;
i::FLAG_untrusted_code_mitigations = true;
......
......@@ -24,6 +24,8 @@ const std::string kPReg = // NOLINT(runtime/string)
TEST(DisasmPoisonMonomorphicLoad) {
#ifdef ENABLE_DISASSEMBLER
if (i::FLAG_always_opt || !i::FLAG_opt) return;
// TODO(9684): Re-enable for TurboProp if necessary.
if (i::FLAG_turboprop) return;
i::FLAG_allow_natives_syntax = true;
i::FLAG_untrusted_code_mitigations = true;
......@@ -71,6 +73,8 @@ TEST(DisasmPoisonMonomorphicLoad) {
TEST(DisasmPoisonPolymorphicLoad) {
#ifdef ENABLE_DISASSEMBLER
if (i::FLAG_always_opt || !i::FLAG_opt) return;
// TODO(9684): Re-enable for TurboProp if necessary.
if (i::FLAG_turboprop) return;
i::FLAG_allow_natives_syntax = true;
i::FLAG_untrusted_code_mitigations = true;
......
......@@ -1121,6 +1121,7 @@
'compiler/concurrent-inlining-2': [SKIP],
'compiler/diamond-followedby-branch': [SKIP],
'compiler/load-elimination-const-field': [SKIP],
'compiler/constant-fold-add-static': [SKIP],
}], # variant == turboprop
##############################################################################
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment