Commit 1864de07 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Fix

parent ce6e1531
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <sstream> #include <sstream>
#include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
#include "codegen/codegen.h" #include "codegen/codegen.h"
......
...@@ -481,6 +481,7 @@ void RefcountTracker::addRefcounts(IRGenState* irstate) { ...@@ -481,6 +481,7 @@ void RefcountTracker::addRefcounts(IRGenState* irstate) {
llvm::outs() << "Processing " << BB.getName() << '\n'; llvm::outs() << "Processing " << BB.getName() << '\n';
} }
bool firsttime = (states.count(&BB) == 0);
RefState& state = states[&BB]; RefState& state = states[&BB];
llvm::DenseMap<llvm::Value*, int> orig_ending_refs = std::move(state.ending_refs); llvm::DenseMap<llvm::Value*, int> orig_ending_refs = std::move(state.ending_refs);
...@@ -663,7 +664,9 @@ void RefcountTracker::addRefcounts(IRGenState* irstate) { ...@@ -663,7 +664,9 @@ void RefcountTracker::addRefcounts(IRGenState* irstate) {
state.ending_refs.clear(); state.ending_refs.clear();
} }
if (endingRefsDifferent(orig_ending_refs, state.ending_refs)) { // It is possible that we ended with zero live variables, which due to our skipping of un-run blocks,
// is not the same thing as an un-run block. Hence the check of 'firsttime'
if (firsttime || endingRefsDifferent(orig_ending_refs, state.ending_refs)) {
for (auto&& SBB : llvm::predecessors(&BB)) { for (auto&& SBB : llvm::predecessors(&BB)) {
// llvm::outs() << "reconsidering: " << SBB->getName() << '\n'; // llvm::outs() << "reconsidering: " << SBB->getName() << '\n';
orderer.add(SBB); orderer.add(SBB);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment