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:
@@ -33,7 +33,8 @@ enum class PassKind {
|
||||
InOutDeshadowing,
|
||||
MandatoryInlining,
|
||||
CapturePromotion,
|
||||
SILCleanup
|
||||
SILCleanup,
|
||||
SILCombine
|
||||
};
|
||||
|
||||
static llvm::cl::opt<std::string>
|
||||
@@ -72,6 +73,10 @@ Passes(llvm::cl::desc("Passes:"),
|
||||
clEnumValN(PassKind::SILCleanup,
|
||||
"cleanup",
|
||||
"Cleanup SIL in preparation for IRGen"),
|
||||
clEnumValN(PassKind::SILCombine,
|
||||
"sil-combine",
|
||||
"Perform small peepholes/combine operations/"
|
||||
"dead code elimination."),
|
||||
clEnumValEnd));
|
||||
|
||||
static llvm::cl::opt<bool>
|
||||
@@ -164,6 +169,9 @@ int main(int argc, char **argv) {
|
||||
case PassKind::SILCleanup:
|
||||
performSILCleanup(CI.getSILModule());
|
||||
break;
|
||||
case PassKind::SILCombine:
|
||||
performSILCombine(CI.getSILModule());
|
||||
break;
|
||||
}
|
||||
|
||||
// Verify the module after every pass.
|
||||
|
||||
Reference in New Issue
Block a user