[sil-combine] Initial SILCombine implementation.

This pass is a port of InstCombine from LLVM to SIL. Thus if you are familiar
with the code from InstCombine you will feel right at home.

Keep in mind that in order to help with review, this is just a skeleton with no
optimizations in it besides a simple DCE based off of isInstructionTriviallyDead
(which this patch exposes in Local.h like LLVM does) to ensure that trivial
testing of the pass can be accomplished since otherwise it would do nothing
implying that no tests could be written at all.

I additionally modified one test which no longer passed due to SILCombine
removing 1x unused metatype instruction from the standard library.

Swift SVN r9404
This commit is contained in:
Michael Gottesman
2013-10-16 03:10:14 +00:00
parent 964dd6a5b6
commit bdf7cbe178
8 changed files with 580 additions and 3 deletions

View File

@@ -35,8 +35,8 @@ static bool isSideEffectFree(BuiltinFunctionRefInst *FR) {
/// \brief Perform a fast local check to see if the instruction is dead.
///
/// This rutine only examines the state of the instruction at hand.
static bool isInstructionTriviallyDead(SILInstruction *I) {
/// This routine only examines the state of the instruction at hand.
bool swift::isInstructionTriviallyDead(SILInstruction *I) {
if (!I->use_empty() || isa<TermInst>(I))
return false;