Skip to content

Conversation

@dnguyen-23
Copy link

No description provided.

Copy link
Owner

@titzer titzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial comments.

var LocalRegAlloc = flags.get("LocalRegAlloc", level >= 1) && !CLOptions.DWARF.get();
var NormOptimize = flags.get("NormOptimize", level >= 2);
var MachOptimize = flags.get("MachOptimize", level >= 2);
var LoopInvariantCodeMotion = flags.get("LoopInvariantCodeMotion", true);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be false by default.

// and is used in linear scan register allocation and code generation.
def ON_STACK = -2;
def DONE = -3;
def ON_STACK: u31 = 1;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why these values need to be changed.

private var count: int;
private var list: List<SsaBlock>;
var loopEdges: List<SsaCfEdge>;
def marker = SsaExternalMarker.new();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be an argument to the constructor.

}
}
buf.putc('#').putd(b.uid).putc('m').putd(b.mark);
// buf.putc('#').putd(b.uid).putc('m').putd(b.mark);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this prints the output twice now.

// Grab the next link in the current block. `link` could be hoisted elsewhere.
nextLink = link.next;
if (link.facts.O_PURE && SsaApplyOp.?(link) &&
instrDominatesExitsAndBackedge(SsaInstr.!(link), curBlock, loopsInScope[loopsInScope.length - 1])) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need to check every instruction in the block, just that the block dominates.

def instrDominatesExitsAndBackedge(instr: SsaInstr, curBlock: SsaBlock, loopInfo: SsaLoopInfo) -> bool {
var isValid: bool = true;
def header: SsaBlock = blockOrdering.order[loopInfo.start];
def exits: Array<SsaCfEdge> = Lists.toArray(loopInfo.exits);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a little inefficient, since it makes a garbage array.

continue;
}
def dominatesExit: bool = blockOrdering.isDominator(curBlock.info, exit.dest.info);
if (!dominatesExit && isValid) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could just early-return false here.

if (!loopInfo.contains(predBlock)) { continue; }
// Check the current block dominates the predecessor
def dominatesPred: bool = blockOrdering.isDominator(curBlock.info, predBlock.info);
if (!dominatesPred && isValid) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same; you can early return false.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants