| /arkcompiler/runtime_core/static_core/compiler/optimizer/optimizations/ |
| D | loop_transform.h | 32 virtual bool TransformLoop(Loop *loop) = 0; 45 for (auto loop : GetGraph()->GetRootLoop()->GetInnerLoops()) { in RunLoopsVisitor() local 46 LoopVisitLRN(loop, markerLoopExit); in RunLoopsVisitor() 50 bool IsSupportedLoopType(const Loop *loop) in IsSupportedLoopType() argument 52 if (loop->IsIrreducible()) { in IsSupportedLoopType() 53 … COMPILER_LOG(DEBUG, LOOP_TRANSFORM) << "Irreducible loop isn't visited, id = " << loop->GetId(); in IsSupportedLoopType() 56 if (loop->IsOsrLoop()) { in IsSupportedLoopType() 57 … COMPILER_LOG(DEBUG, LOOP_TRANSFORM) << "OSR entry isn't visited, loop id = " << loop->GetId(); in IsSupportedLoopType() 60 if (loop->IsTryCatchLoop()) { in IsSupportedLoopType() 61 …COMPILER_LOG(DEBUG, LOOP_TRANSFORM) << "Try-catch loop isn't visited, loop id = " << loop->GetId(); in IsSupportedLoopType() [all …]
|
| D | redundant_loop_elimination.cpp | 36 BasicBlock *RedundantLoopElimination::IsRedundant(Loop *loop) in IsRedundant() argument 39 for (auto block : loop->GetBlocks()) { in IsRedundant() 40 // check that loop have only one exit and one outside blocks in IsRedundant() 42 if (succ->GetLoop() == loop) { in IsRedundant() 52 // check that loop doesn't contains not redundant insts in IsRedundant() 60 … [loop](auto &user) { return user.GetInst()->GetBasicBlock()->GetLoop() != loop; }); in IsRedundant() 66 // Check that loop is finite. in IsRedundant() 68 if (!CountableLoopParser(*loop).Parse().has_value()) { in IsRedundant() 74 void RedundantLoopElimination::DeleteLoop(Loop *loop, BasicBlock *outsideSucc) const in DeleteLoop() argument 76 auto header = loop->GetHeader(); in DeleteLoop() [all …]
|
| D | loop_unroll.cpp | 90 void LoopUnroll::TransformLoopImpl(Loop *loop, std::optional<uint64_t> optIterations, bool noSideEx… in TransformLoopImpl() argument 107 Loop *cloneLoop = remainingIters == 0 ? nullptr : graphCloner.CloneLoop(loop); in TransformLoopImpl() 108 // Unroll loop without side-exits and fix compare in the pre-header and back-edge in TransformLoopImpl() 109 graphCloner.UnrollLoopBody<UnrollType::UNROLL_WITHOUT_SIDE_EXITS>(loop, unrollFactor); in TransformLoopImpl() 110 FixCompareInst(loopInfo.value(), loop->GetHeader(), unrollFactor); in TransformLoopImpl() 111 // Unroll loop without side-exits for remaining iterations in TransformLoopImpl() 116 … << "Unrolled without side-exits the loop with constant number of iterations (" << iterations in TransformLoopImpl() 117 << "). Loop id = " << loop->GetId(); in TransformLoopImpl() 119 auto cloneLoop = graphCloner.CloneLoop(loop); in TransformLoopImpl() 120 // Unroll loop without side-exits and fix compare in the pre-header and back-edge in TransformLoopImpl() [all …]
|
| D | loop_unroll.h | 24 * Loop unroll optimization 25 * @param inst_limit - the maximum number of loop instructions after its unrolling 26 * @param unroll_factor - the number of loop body copies including the original one 54 static bool HasPreHeaderCompare(Loop *loop, const CountableLoopInfo &loopInfo); 57 bool TransformLoop(Loop *loop) override; 58 …bool UnrollWithBranching(uint32_t unrollFactor, Loop *loop, std::optional<CountableLoopInfo> loopI… 60 UnrollParams GetUnrollParams(Loop *loop); 61 …void TransformLoopImpl(Loop *loop, std::optional<uint64_t> optIterations, bool noSideExits, uint32…
|
| D | loop_peeling.cpp | 26 * Loop-peeling optimization works with a loops with the following requirements: 27 * - loop is not irreducible; 29 * - loop-header is a single loop-exit point; 40 * 1 stage - insert pre-loop which is an if-block: 45 * [pre-loop]--------\ 61 * [pre-loop]--------\ 106 bool LoopPeeling::TransformLoop(Loop *loop) in TransformLoop() argument 108 ASSERT(loop->GetBackEdges().size() == 1); in TransformLoop() 109 ASSERT(loop->GetHeader()->GetLastInst()->GetOpcode() == Opcode::IfImm || in TransformLoop() 110 loop->GetHeader()->GetLastInst()->GetOpcode() == Opcode::If); in TransformLoop() [all …]
|
| /arkcompiler/runtime_core/static_core/libllvmbackend/transforms/ |
| D | pipeline.cfg | 18 loop-mssa( 20 simple-loop-unswitch<nontrivial> 27 loop-simplify, # Canonicalize natural loops 28 lcssa # Loop-Closed SSA Form Pass 51 inline-devirt, # Run Inline+Devirt passes in loop 68 loop-simplify, # Canonicalize natural loops 69 lcssa, # Loop-Closed SSA Form Pass 70 loop-mssa( 71 loop-instsimplify, 72 loop-simplifycfg, [all …]
|
| D | pipeline_irtoc.cfg | 28 loop-simplify, # Canonicalize natural loops 29 lcssa, # Loop-Closed SSA Form Pass 31 loop-unroll<O2;no-upperbound;peeling;partial> 70 loop-simplify, # Canonicalize natural loops 71 lcssa, # Loop-Closed SSA Form Pass 72 loop-mssa( 73 loop-instsimplify, 74 loop-simplifycfg, 75 licm, # Loop Invariant Code Motion 76 loop-rotate, # Rotate Loops [all …]
|
| /arkcompiler/runtime_core/compiler/optimizer/analysis/ |
| D | loop_analyzer.cpp | 29 for (auto loop : GetGraph()->GetRootLoop()->GetInnerLoops()) { in RunImpl() local 30 FindAndInsertPreHeaders(loop); in RunImpl() 49 Loop *LoopAnalyzer::CreateNewLoop(BasicBlock *loop_header) in CreateNewLoop() 51 …auto loop = GetGraph()->GetAllocator()->New<Loop>(GetGraph()->GetAllocator(), loop_header, loop_co… in CreateNewLoop() local 52 CHECK_NOT_NULL(loop); in CreateNewLoop() 53 loop->AppendBlock(loop_header); in CreateNewLoop() 54 return loop; in CreateNewLoop() 60 …auto root_loop = GetGraph()->GetAllocator()->New<Loop>(GetGraph()->GetAllocator(), nullptr, loop_c… in CreateRootLoop() 96 * Create new Loop if it doesn't exists. 97 * Append information about its header, back edge and check if this loop is irreducible. [all …]
|
| D | loop_analyzer.h | 26 class Loop final { 28 Loop(ArenaAllocator *allocator, BasicBlock *header, uint32_t id) in Loop() function 37 DEFAULT_MOVE_SEMANTIC(Loop); 38 DEFAULT_COPY_SEMANTIC(Loop); 39 ~Loop() = default; 41 bool operator==(const Loop &other) const 103 // 1. is not a header of the loop 104 // 2. is not a back-edge of the loop 105 // 3. is not a pre-header of any inner loop 116 void AppendInnerLoop(Loop *inner_loop) in AppendInnerLoop() [all …]
|
| /arkcompiler/runtime_core/static_core/compiler/docs/ |
| D | loop_unrolling.md | 1 # Loop Unrolling 4 `Loop unrolling` optimization increases loop body by copying instructions of the original loop body. 8 Increase number of instructions for each loop iteration, reduce branch penalty. 12 * Loop Analysis 15 * Loop Peeling (to make loop with exit-point from backedge) 20 `Loop unrolling` modifies loops with the following requirements: 22 * loop is not irreducible; 23 * loop-header is not OSR-entry; 25 * loop-backedge is a single loop-exit point; 30 **Instructions limit** - the maximum number of loop instructions after its unrolling; [all …]
|
| D | redundant_loop_elimination_doc.md | 1 # Redundant Loop Elimination 3 **Redundant Loop Elimination(RLE)** - optimization which find and remove useless loops. 7 * Loop analysis 10 For each loop check that: 12 * Loop doesn't contain instructions with side effect (ex. call instructions). 13 * Loop doesn't contain instructions with users out of the loop. 15 If all checks are true then loop is removing: 16 1. Loop pre-header connect with loop outer block. 17 2. Loop inner blocks disconnect from graph. 20 LoopVisitLRN(Loop* loop) { [all …]
|
| D | loop_unswitch_doc.md | 1 # Loop Unswitch 4 `Loop Unswitch` optimization moves a conditional inside a loop outside of it by duplicating the loo… 7 Reduce branches count in the loop's body. Each of new loops can be separately optimized. 10 * Loop Analysis 16 `Loop Unswitch` starts with original loop and iterates on each new loop (which was created while un… 18 * find branch instruction where loop can be unswitched 19 * clone loop 20 * move branch instruction outside a loop 21 …ns are replaced with constant conditions corresponding `true` and `false` branches in original loop 24 * Max loop unswitch level [all …]
|
| D | loop_peeling.md | 1 # Loop Peeling 4 `Loop peeling` optimization modifies the loops with exit-point at loop-header to the loops with exi… 8 Simplify the loop and allow further loop optimizations. 12 * Loop Analysis 18 `Loop peeling` modifies loops with the following requirements: 19 - loop is not irreducible; 20 - loop-header is not OSR-entry; 22 - loop-header is a single loop-exit point; 37 ### 1. Insert pre-loop 42 [pre-loop]--------\ [all …]
|
| /arkcompiler/runtime_core/static_core/compiler/optimizer/analysis/ |
| D | loop_analyzer.cpp | 31 for (auto loop : GetGraph()->GetRootLoop()->GetInnerLoops()) { in RunImpl() local 32 FindAndInsertPreHeaders(loop); in RunImpl() 33 CheckActualLengthAsLoopInitOrBound(loop); in RunImpl() 53 Loop *LoopAnalyzer::CreateNewLoop(BasicBlock *loopHeader) in CreateNewLoop() 55 …auto loop = GetGraph()->GetAllocator()->New<Loop>(GetGraph()->GetAllocator(), loopHeader, loopCoun… in CreateNewLoop() local 56 ASSERT(loop != nullptr); in CreateNewLoop() 57 loop->AppendBlock(loopHeader); in CreateNewLoop() 58 return loop; in CreateNewLoop() 64 …auto rootLoop = GetGraph()->GetAllocator()->New<Loop>(GetGraph()->GetAllocator(), nullptr, loopCou… in CreateRootLoop() 100 * Create new Loop if it doesn't exists. [all …]
|
| D | loop_analyzer.h | 26 class Loop final { 28 Loop(ArenaAllocator *allocator, BasicBlock *header, uint32_t id) in Loop() function 37 DEFAULT_MOVE_SEMANTIC(Loop); 38 DEFAULT_COPY_SEMANTIC(Loop); 39 ~Loop() = default; 41 bool operator==(const Loop &other) const 97 // 1. is not a header of the loop 98 // 2. is not a back-edge of the loop 99 // 3. is not a pre-header of any inner loop 110 void AppendInnerLoop(Loop *innerLoop) in AppendInnerLoop() [all …]
|
| /arkcompiler/ets_runtime/ecmascript/compiler/codegen/maple/maple_be/src/cg/ |
| D | loop.cpp | 16 #include "loop.h" 21 // a dominates b, then there is a loop from a to b. Loop identification is done 22 // in a preorder traversal of the dominator tree. In this order, outer loop is 23 // always detected before its nested loop(s). The building of the LoopDesc data 55 auto *loop = bbLoopParent[headBB.GetId()]; in GetOrCreateLoopDesc() local 56 if (loop == nullptr || loop->GetHeader().GetId() != headBB.GetId()) { in GetOrCreateLoopDesc() 57 // If the headBB is not in loop or loop's header is not the headBB, create a new loop. in GetOrCreateLoopDesc() 58 loop = alloc.New<LoopDesc>(alloc, headBB); in GetOrCreateLoopDesc() 59 loops.push_back(loop); in GetOrCreateLoopDesc() 61 return loop; in GetOrCreateLoopDesc() [all …]
|
| /arkcompiler/runtime_core/static_core/tests/cts-assembly/ |
| D | arrays-15.pa | 19 loop: 25 jmp loop 32 loop: 38 jmp loop 45 loop: 51 jmp loop 58 loop: 64 jmp loop 71 loop: 77 jmp loop [all …]
|
| /arkcompiler/runtime_core/compiler/tests/ |
| D | loop_analyzer_new_test.cpp | 84 Loop loop(graph->GetAllocator(), bb->GetSuccessor(0), 1); in __anonb3d776f20202() local 85 Loop other(graph->GetAllocator(), bb->GetSuccessor(0), 1); in __anonb3d776f20202() 86 EXPECT_FALSE(loop.IsInside(&other)); in __anonb3d776f20202() 88 loop.SetOuterLoop(&other); in __anonb3d776f20202() 89 EXPECT_TRUE(loop.IsInside(&other)); in __anonb3d776f20202() 118 Loop loop(graph->GetAllocator(), bb->GetSuccessor(0), 1); in __anonb3d776f20302() local 119 loop.AppendBackEdge(bb->GetSuccessor(1)); in __anonb3d776f20302() 120 loop.GetBackEdges()[0]->AddSucc(bb->GetSuccessor(0)); in __anonb3d776f20302() 121 EXPECT_EQ(loop.GetBackEdges()[0]->GetSuccBlockIndex(loop.GetHeader()), 1); in __anonb3d776f20302() 122 EXPECT_NE(GetLoopOutsideSuccessor(&loop), nullptr); in __anonb3d776f20302() [all …]
|
| /arkcompiler/runtime_core/static_core/compiler/optimizer/ir/ |
| D | loop_unswitcher.h | 23 * Class unswitchs loop: 24 * - Clone loop; 29 static Inst *FindUnswitchInst(Loop *loop); 30 static bool IsSmallLoop(Loop *loop); 31 …static void EstimateInstructionsCount(const Loop *loop, const Inst *unswitchInst, int64_t *loopSiz… 34 Loop *UnswitchLoop(Loop *loop, Inst *inst);
|
| D | loop_unswitcher.cpp | 28 * Unswitch loop in selected branch instruction. 29 * Return pointer to new loop or nullptr if cannot unswitch loop. 31 Loop *LoopUnswitcher::UnswitchLoop(Loop *loop, Inst *inst) in UnswitchLoop() argument 33 ASSERT(loop != nullptr && !loop->IsRoot()); in UnswitchLoop() 34 …ASSERT_PRINT(IsLoopSingleBackEdgeExitPoint(loop), "Cloning blocks doesn't have single entry/exit p… in UnswitchLoop() 35 ASSERT(loop->GetPreHeader() != nullptr); in UnswitchLoop() 36 ASSERT(!loop->IsIrreducible()); in UnswitchLoop() 37 ASSERT(!loop->IsOsrLoop()); in UnswitchLoop() 38 if (loop->GetPreHeader()->GetSuccsBlocks().size() != MAX_SUCCS_NUM) { in UnswitchLoop() 45 auto unswitchData = PrepareLoopToClone(loop); in UnswitchLoop() [all …]
|
| /arkcompiler/runtime_core/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/01.assignment-like_contexts/ |
| D | unboxing_call.ets | 24 public fld_{{loop.index}}: {{c.type}}; 27 …public constructor({% for v in c['values'] %}p{{loop.index}}: {{c.type}}{{ ", " if not loop.last }… 29 this.fld_{{loop.index}} = p{{loop.index}}; 33 …public foo({% for v in c['values'] %}p{{loop.index}}: {{c.type}}{{ ", " if not loop.last }}{% endf… 36 this.fld_{{loop.index}} != p{{loop.index}}{{ " ||" if not loop.last }} 48 let v{{loop.index}}: {{c.ref_type}} = {{v|safe}}; 51 …let c: A = new A({% for v in c['values'] %}v{{loop.index}}{{ ", " if not loop.last }}{% endfor %}); 52 return c.foo({% for v in c['values'] %}v{{loop.index}}{{ ", " if not loop.last }}{% endfor %});
|
| D | boxing_call.ets | 24 public fld_{{loop.index}}: {{c.type}}; 27 …public constructor({% for v in c['values'] %}p{{loop.index}}: {{c.type}}{{ ", " if not loop.last }… 29 this.fld_{{loop.index}} = p{{loop.index}}; 33 …public foo({% for v in c['values'] %}p{{loop.index}}: {{c.type}}{{ ", " if not loop.last }}{% endf… 36 this.fld_{{loop.index}}.unboxed() != p{{loop.index}}.unboxed(){{ " ||" if not loop.last }} 48 let v{{loop.index}}: {{c.prim_type}} = {{v|safe}}; 51 …let c: A = new A({% for v in c['values'] %}v{{loop.index}}{{ ", " if not loop.last }}{% endfor %}); 52 return c.foo({% for v in c['values'] %}v{{loop.index}}{{ ", " if not loop.last }}{% endfor %});
|
| D | unboxing2_call.ets | 24 public fld_{{loop.index}}: {{c.type}}; 27 …public constructor({% for v in c['values'] %}p{{loop.index}}: {{c.type}}{{ ", " if not loop.last }… 29 this.fld_{{loop.index}} = p{{loop.index}}; 33 …public foo({% for v in c['values'] %}p{{loop.index}}: {{c.type}}{{ ", " if not loop.last }}{% endf… 36 this.fld_{{loop.index}} != p{{loop.index}}{{ " ||" if not loop.last }} 48 let v{{loop.index}}: {{c.ref_type}} = {{v|safe}}; 51 …let c: A = new A({% for v in c['values'] %}v{{loop.index}}{{ ", " if not loop.last }}{% endfor %}); 52 return c.foo({% for v in c['values'] %}v{{loop.index}}{{ ", " if not loop.last }}{% endfor %});
|
| D | boxing2_call.ets | 24 public fld_{{loop.index}}: {{c.type}}; 27 …public constructor({% for v in c['values'] %}p{{loop.index}}: {{c.type}}{{ ", " if not loop.last }… 29 this.fld_{{loop.index}} = p{{loop.index}}; 33 …public foo({% for v in c['values'] %}p{{loop.index}}: {{c.type}}{{ ", " if not loop.last }}{% endf… 36 this.fld_{{loop.index}} == null {{ " ||" if not loop.last }} 48 let v{{loop.index}}: {{c.prim_type}} = {{v|safe}}; 51 …let c: A = new A({% for v in c['values'] %}v{{loop.index}}{{ ", " if not loop.last }}{% endfor %}); 52 return c.foo({% for v in c['values'] %}v{{loop.index}}{{ ", " if not loop.last }}{% endfor %});
|
| /arkcompiler/runtime_core/compiler/optimizer/ir/ |
| D | graph_cloner.h | 30 bool IsLoopSingleBackEdgeExitPoint(Loop *loop); 41 * - Clone loop; 42 * - Unroll loop; 43 * - Peel loop; 70 Loop *CloneLoop(Loop *loop); 71 bool IsLoopClonable(Loop *loop, size_t inst_limit); 74 * Make equal to the `factor` number of clones of loop body and insert them into the graph 76 * /----[pre-loop] 79 * | [loop-body]<----\ 91 * /----[pre-loop] [all …]
|