Reset CFG edge tracking on re-run.
This commit is contained in:
parent
b6046b1860
commit
9efd372d92
|
@ -33,7 +33,8 @@ int Compiler::Compile(HIRBuilder* builder) {
|
||||||
|
|
||||||
// TODO(benvanik): sophisticated stuff. Run passes in parallel, run until they
|
// TODO(benvanik): sophisticated stuff. Run passes in parallel, run until they
|
||||||
// stop changing things, etc.
|
// stop changing things, etc.
|
||||||
for (auto& pass : passes_) {
|
for (size_t i = 0; i < passes_.size(); ++i) {
|
||||||
|
auto& pass = passes_[i];
|
||||||
scratch_arena_.Reset();
|
scratch_arena_.Reset();
|
||||||
if (pass->Run(builder)) {
|
if (pass->Run(builder)) {
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -30,10 +30,18 @@ ControlFlowAnalysisPass::~ControlFlowAnalysisPass() {}
|
||||||
int ControlFlowAnalysisPass::Run(HIRBuilder* builder) {
|
int ControlFlowAnalysisPass::Run(HIRBuilder* builder) {
|
||||||
SCOPE_profile_cpu_f("alloy");
|
SCOPE_profile_cpu_f("alloy");
|
||||||
|
|
||||||
// TODO(benvanik): reset edges for all blocks? Needed to be re-runnable.
|
// Reset edges for all blocks. Needed to be re-runnable.
|
||||||
|
// Note that this wastes a bunch of arena memory, so we shouldn't
|
||||||
|
// re-run too often.
|
||||||
|
auto block = builder->first_block();
|
||||||
|
while (block) {
|
||||||
|
block->incoming_edge_head = nullptr;
|
||||||
|
block->outgoing_edge_head = nullptr;
|
||||||
|
block = block->next;
|
||||||
|
}
|
||||||
|
|
||||||
// Add edges.
|
// Add edges.
|
||||||
auto block = builder->first_block();
|
block = builder->first_block();
|
||||||
while (block) {
|
while (block) {
|
||||||
auto instr = block->instr_tail;
|
auto instr = block->instr_tail;
|
||||||
while (instr) {
|
while (instr) {
|
||||||
|
|
Loading…
Reference in New Issue