mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[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:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user