[wasm] Do not unroll unreachable loops
Bug: v8:11298, v8:13292 Change-Id: Ifabcbb64889012778439fb14e22a7cf885965b1e Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3905724 Commit-Queue: Manos Koukoutos <manoskouk@chromium.org> Reviewed-by: Tobias Tebbi <tebbi@chromium.org> Cr-Commit-Position: refs/heads/main@{#83363}
This commit is contained in:
parent
b588a3c658
commit
c1287aeb2c
@ -19,6 +19,7 @@
|
||||
#include "src/codegen/reloc-info.h"
|
||||
#include "src/common/high-allocation-throughput-scope.h"
|
||||
#include "src/compiler/add-type-assertions-reducer.h"
|
||||
#include "src/compiler/all-nodes.h"
|
||||
#include "src/compiler/backend/code-generator.h"
|
||||
#include "src/compiler/backend/frame-elider.h"
|
||||
#include "src/compiler/backend/instruction-selector.h"
|
||||
@ -1699,8 +1700,11 @@ struct WasmLoopUnrollingPhase {
|
||||
|
||||
void Run(PipelineData* data, Zone* temp_zone,
|
||||
std::vector<compiler::WasmLoopInfo>* loop_infos) {
|
||||
if (loop_infos->empty()) return;
|
||||
AllNodes all_nodes(temp_zone, data->graph(), data->graph()->end());
|
||||
for (WasmLoopInfo& loop_info : *loop_infos) {
|
||||
if (loop_info.can_be_innermost) {
|
||||
if (!loop_info.can_be_innermost) continue;
|
||||
if (!all_nodes.IsReachable(loop_info.header)) continue;
|
||||
ZoneUnorderedSet<Node*>* loop =
|
||||
LoopFinder::FindSmallInnermostLoopFromHeader(
|
||||
loop_info.header, temp_zone,
|
||||
@ -1708,10 +1712,9 @@ struct WasmLoopUnrollingPhase {
|
||||
// size for its depth.
|
||||
maximum_unrollable_size(loop_info.nesting_depth), true);
|
||||
if (loop == nullptr) continue;
|
||||
UnrollLoop(loop_info.header, loop, loop_info.nesting_depth,
|
||||
data->graph(), data->common(), temp_zone,
|
||||
data->source_positions(), data->node_origins());
|
||||
}
|
||||
UnrollLoop(loop_info.header, loop, loop_info.nesting_depth, data->graph(),
|
||||
data->common(), temp_zone, data->source_positions(),
|
||||
data->node_origins());
|
||||
}
|
||||
|
||||
EliminateLoopExits(loop_infos);
|
||||
|
Loading…
Reference in New Issue
Block a user