Track the list of blocks that form the body of a function. (#2941)

Use that list for lowering in lexical order, instead of rediscovering
the list based on which blocks are referenced as branch targets.
This commit is contained in:
Richard Smith authored and GitHub committed 2023-06-23 08:36:13 -07:00
1 parent 5a90f660b9
commit b908c6e274
61 files changed
+145 -176

No files matched your search

@@ -21,7 +21,6 @@ auto LoweringFunctionContext::GetBlock(SemanticsNodeBlockId block_id)
llvm::BasicBlock*& entry = blocks_[block_id];
if (!entry) {
entry = llvm::BasicBlock::Create(llvm_context(), "", function_);
block_worklist().Push(block_id);
}
return entry;
}
@@ -31,7 +30,6 @@ auto LoweringFunctionContext::TryToReuseBlock(SemanticsNodeBlockId block_id,
if (!blocks_.insert({block_id, block}).second) {
return false;
}
block_worklist().Push(block_id);
if (block == synthetic_block_) {
synthetic_block_ = nullptr;
}