[PATCH] D28934: Write a new SSAUpdater
Daniel Berlin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 20 15:58:26 PST 2017
dberlin added a comment.
Updating the patch in a second, i templated the trivial phi removal, fixed some bug, started on unit tests enough for others to play with it.
It should be a pretty direct conversion from the old ssaupdater (setAvailableValue->writeVariable, getvalueAtEndOfBlock->readVariableAfterDef, getvalueAtMiddleOfBlock->readVariableBeforeDef)
A few notes from more testing:
1. The old updater crashes if you call getValueAtEndOfBlock for a currently empty block (you have to insert the instruction first) (I can make the new one work on incomplete cfgs, actually, if we want)
2. The only cases we generate spurious phis now is in the case of irreducible control flow. This will go away once i implement the SCC algorithm.
Something like this:
define void @F(i32, i32) {
if:
br i1 true, label %loopmain, label %loopstart
loopstart: ; preds = %loopmain, %if
br label %loopmain
loopmain: ; preds = %loopstart, %if
br i1 true, label %loopstart, label %afterloop
afterloop: ; preds = %loopmain
ret i32 %0
}
Will become
define void @F(i32, i32) {
if:
br i1 true, label %loopmain, label %loopstart
loopstart: ; preds = %loopmain, %if
%update1 = phi i32 [ %update, %loopmain ], [ %0, %if ]
br label %loopmain
loopmain: ; preds = %loopstart, %if
%update = phi i32 [ %update1, %loopstart ], [ %0, %if ]
br i1 true, label %loopstart, label %afterloop
afterloop: ; preds = %loopmain
ret i32 %0
}
https://reviews.llvm.org/D28934
More information about the llvm-commits
mailing list