Home | History | Annotate | Download | only in optimizing

Lines Matching refs:block

34   // Anything that returns is allowed to jump into the exit block.
38 // Anything that always throws is allowed to jump into the exit block.
45 static bool IsExitTryBoundaryIntoExitBlock(HBasicBlock* block) {
46 if (!block->IsSingleTryBoundary()) {
50 HTryBoundary* boundary = block->GetLastInstruction()->AsTryBoundary();
51 return block->GetPredecessors().size() == 1u &&
56 void GraphChecker::VisitBasicBlock(HBasicBlock* block) {
57 current_block_ = block;
62 // Check consistency with respect to predecessors of `block`.
66 sorted_predecessors.assign(block->GetPredecessors().begin(), block->GetPredecessors().end());
75 std::count(p->GetSuccessors().begin(), p->GetSuccessors().end(), block);
78 "Block %d lists %zu occurrences of block %d in its predecessors, whereas "
79 "block %d lists %zu occurrences of block %d in its successors.",
80 block->GetBlockId(), p_count_in_block_predecessors, p->GetBlockId(),
81 p->GetBlockId(), block_count_in_p_successors, block->GetBlockId()));
85 // Check consistency with respect to successors of `block`.
89 sorted_successors.assign(block->GetSuccessors().begin(), block->GetSuccessors().end());
98 std::count(s->GetPredecessors().begin(), s->GetPredecessors().end(), block);
101 "Block %d lists %zu occurrences of block %d in its successors, whereas "
102 "block %d lists %zu occurrences of block %d in its predecessors.",
103 block->GetBlockId(), s_count_in_block_successors, s->GetBlockId(),
104 s->GetBlockId(), block_count_in_s_predecessors, block->GetBlockId()));
108 // Ensure `block` ends with a branch instruction.
112 if (GetGraph()->IsInSsaForm() && !block->EndsWithControlFlowInstruction()) {
113 AddError(StringPrintf("Block %d does not end with a branch instruction.",
114 block->GetBlockId()));
118 // may be between the instructions if the Throw/Return(Void) is in a try block.
119 if (block->IsExitBlock()) {
120 for (HBasicBlock* predecessor : block->GetPredecessors()) {
125 AddError(StringPrintf("Unexpected instruction %s:%d jumps into the exit block.",
132 // Visit this block's list of phis.
133 for (HInstructionIterator it(block->GetPhis()); !it.Done(); it.Advance()) {
135 // Ensure this block's list of phis contains only phis.
137 AddError(StringPrintf("Block %d has a non-phi in its phi list.",
140 if (current->GetNext() == nullptr && current != block->GetLastPhi()) {
141 AddError(StringPrintf("The recorded last phi of block %d does not match "
149 // Visit this block's list of instructions.
150 for (HInstructionIterator it(block->GetInstructions()); !it.Done(); it.Advance()) {
152 // Ensure this block's list of instructions does not contains phis.
154 AddError(StringPrintf("Block %d has a phi in its non-phi list.",
157 if (current->GetNext() == nullptr && current != block->GetLastInstruction()) {
158 AddError(StringPrintf("The recorded last instruction of block %d does not match "
168 for (HBasicBlock* successor : block->GetNormalSuccessors()) {
170 AddError(StringPrintf("Catch block %d is a normal successor of block %d.",
172 block->GetBlockId()));
175 for (HBasicBlock* successor : block->GetExceptionalSuccessors()) {
177 AddError(StringPrintf("Normal block %d is an exceptional successor of block %d.",
179 block->GetBlockId()));
183 // Ensure dominated blocks have `block` as the dominator.
184 for (HBasicBlock* dominated : block->GetDominatedBlocks()) {
185 if (dominated->GetDominator() != block) {
186 AddError(StringPrintf("Block %d should be the dominator of %d.",
187 block->GetBlockId(),
193 // block with multiple successors to a block with multiple
196 if (block->GetSuccessors().size() > 1) {
197 if (IsExitTryBoundaryIntoExitBlock(block)) {
200 for (HBasicBlock* successor : block->GetNormalSuccessors()) {
203 block->GetBlockId(),
211 if (block->IsCatchBlock()) {
212 if (block->IsTryBlock()) {
213 const HTryBoundary& try_entry = block->GetTryCatchInformation()->GetTryEntry();
214 AddError(StringPrintf("Catch blocks should not be try blocks but catch block %d "
216 block->GetBlockId(),
221 if (block->IsLoopHeader()) {
222 AddError(StringPrintf("Catch blocks should not be loop headers but catch block %d is.",
223 block->GetBlockId()));
226 for (HBasicBlock* predecessor : block->GetPredecessors()) {
228 if (block->IsTryBlock()) {
229 const HTryBoundary& stored_try_entry = block->GetTryCatchInformation()->GetTryEntry();
231 AddError(StringPrintf("Block %d has try entry %s:%d but no try entry follows "
233 block->GetBlockId(),
238 AddError(StringPrintf("Block %d has try entry %s:%d which is not consistent "
240 block->GetBlockId(),
248 AddError(StringPrintf("Block %d is not a try block but try entry %s:%d follows "
250 block->GetBlockId(),
258 if (block->IsLoopHeader()) {
259 HandleLoop(block);
288 // Note that a normal-flow successor may be a catch block before CFG
292 AddError(StringPrintf("Block %d with %s:%d has exceptional successor %d which "
293 "is not a catch block.",
304 AddError(StringPrintf("Exception handler block %d of %s:%d is listed multiple times.",
315 // Ensure that LoadException is the first instruction in a catch block.
317 AddError(StringPrintf("%s:%d is in a non-catch block %d.",
322 AddError(StringPrintf("%s:%d is not the first instruction in catch block %d.",
339 AddError(StringPrintf("%s %d in block %d not associated with any block.",
344 AddError(StringPrintf("%s %d in block %d associated with block %d.",
351 // Ensure the inputs of `instruction` are defined in a block of the graph.
355 "basic block of the control-flow graph.",
364 "in a basic block of the control-flow graph.",
371 // Ensure the uses of `instruction` are defined in a block of the graph,
380 "in a basic block of the control-flow graph.",
432 AddError(StringPrintf("Instruction %s:%d in block %d does not dominate "
433 "use %s:%d in block %d.",
444 AddError(StringPrintf("Instruction %s:%d in block %d requires an environment "
461 "from block %d does not dominate instruction %d.",
482 // the catch block since we do not inline methods with try/catch.
495 AddError(StringPrintf("Instruction %s:%d throws into catch block %d "
535 AddError(StringPrintf("%s:%d does not jump to the exit block.",
545 AddError(StringPrintf("%s:%d does not jump to the exit block.",
662 // Ensure the pre-header block is first in the list of predecessors of a loop
663 // header and that the header block is its only successor.
675 AddError(StringPrintf("Loop defined by header %d contains a previously removed block %d.",
679 AddError(StringPrintf("Loop block %d not dominated by loop header %d.",
728 AddError(StringPrintf("Loop phi %d in block %d is its own first input.",
738 "Input %d at index %zu of phi %d from block %d does not have the "
746 AddError(StringPrintf("Phi %d in block %d does not have an expected phi type: %s",
754 // instructions caught by this catch block. We do not enforce this, however,
759 AddError(StringPrintf("Phi %d in catch block %d has zero inputs.",
767 AddError(StringPrintf("Phi %d in catch block %d has %zu inputs, "
783 "Phi %d in block %d has %zu inputs, "
784 "but block %d has %zu predecessors.",
789 // predecessor or from a block that dominates this predecessor.
796 "Input %d at index %zu of phi %d from block %d is not defined in "
797 "predecessor number %zu nor in a block dominating it.",
811 AddError(StringPrintf("Catch phis %d and %d in block %d are not sorted by their "
892 // Check that the number of block successors matches the switch count plus
893 // one for the default block.
894 HBasicBlock* block = instruction->GetBlock();
895 if (instruction->GetNumEntries() + 1u != block->GetSuccessors().size()) {
897 "%s instruction %d in block %d expects %u successors to the block, but found: %zu.",
900 block->GetBlockId(),
902 block->GetSuccessors().size()));
1024 HBasicBlock* block = instruction->GetBlock();
1025 if (!block->IsEntryBlock()) {
1027 "%s %d should be in the entry block but is in block %d.",
1030 block->GetBlockId()));