Skip to content

Commit

Permalink
Revert "Add a stack promotion optimization."
Browse files Browse the repository at this point in the history
This reverts commit 0dd045c.

StackPromotion crashes when compiling MatMult in stdlib-asserts configuration
  • Loading branch information
eeckstein committed Nov 6, 2015
1 parent e3e6183 commit d7b7fc7
Show file tree
Hide file tree
Showing 13 changed files with 7 additions and 1,081 deletions.
9 changes: 0 additions & 9 deletions include/swift/LLVMPasses/Passes.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,6 @@ namespace swift {
SwiftARCContract() : llvm::FunctionPass(ID) {}
};

class SwiftStackPromotion : public llvm::FunctionPass {
virtual void getAnalysisUsage(llvm::AnalysisUsage &AU) const override;
virtual bool runOnFunction(llvm::Function &F) override;
public:
static char ID;
SwiftStackPromotion() : llvm::FunctionPass(ID) {}
};


} // end namespace swift

#endif
2 changes: 0 additions & 2 deletions include/swift/LLVMPasses/PassesFwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@ namespace llvm {
void initializeSwiftRCIdentityPass(PassRegistry &);
void initializeSwiftARCOptPass(PassRegistry &);
void initializeSwiftARCContractPass(PassRegistry &);
void initializeSwiftStackPromotionPass(PassRegistry &);
}

namespace swift {
llvm::FunctionPass *createSwiftARCOptPass();
llvm::FunctionPass *createSwiftARCContractPass();
llvm::FunctionPass *createSwiftStackPromotionPass();
llvm::ImmutablePass *createSwiftAAWrapperPass();
llvm::ImmutablePass *createSwiftRCIdentityPass();
} // end namespace swift
Expand Down
2 changes: 0 additions & 2 deletions include/swift/SILPasses/Passes.def
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,6 @@ PASS(SplitAllCriticalEdges, "split-critical-edges",
"Split all critical edges")
PASS(SplitNonCondBrCriticalEdges, "split-non-cond_br-critical-edges",
"Split all critical edges that do not involve cond_br")
PASS(StackPromotion, "stack-promotion",
"Promote allocated objects on the stack")
PASS(StripDebugInfo, "strip-debug-info",
"Strip debug info")
PASS(SwiftArrayOpts, "array-specialize",
Expand Down
9 changes: 0 additions & 9 deletions lib/IRGen/IRGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,6 @@ static void addSwiftContractPass(const PassManagerBuilder &Builder,
PM.add(createSwiftARCContractPass());
}

static void addSwiftStackPromotionPass(const PassManagerBuilder &Builder,
PassManagerBase &PM) {
if (Builder.OptLevel > 0)
PM.add(createSwiftStackPromotionPass());
}

// FIXME: Copied from clang/lib/CodeGen/CGObjCMac.cpp.
// These should be moved to a single definition shared by clang and swift.
enum ImageInfoFlags {
Expand Down Expand Up @@ -131,9 +125,6 @@ void swift::performLLVMOptimizations(IRGenOptions &Opts, llvm::Module *Module,
llvm::createAlwaysInlinerPass(/*insertlifetime*/false);
}

PMBuilder.addExtension(PassManagerBuilder::EP_ModuleOptimizerEarly,
addSwiftStackPromotionPass);

// If the optimizer is enabled, we run the ARCOpt pass in the scalar optimizer
// and the Contract pass as late as possible.
if (!Opts.DisableLLVMARCOpts) {
Expand Down
1 change: 0 additions & 1 deletion lib/LLVMPasses/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ add_swift_library(swiftLLVMPasses
LLVMSwiftRCIdentity.cpp
LLVMARCOpts.cpp
LLVMARCContract.cpp
LLVMStackPromotion.cpp
)

add_dependencies(swiftLLVMPasses LLVMAnalysis)
196 changes: 0 additions & 196 deletions lib/LLVMPasses/LLVMStackPromotion.cpp

This file was deleted.

1 change: 0 additions & 1 deletion lib/SILPasses/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,5 @@ add_swift_library(swiftSILPasses
SimplifyCFG.cpp
Sink.cpp
SpeculativeDevirtualizer.cpp
StackPromotion.cpp
UsePrespecialized.cpp
LINK_LIBRARIES swiftSILPassesUtils swiftSILAnalysis)
6 changes: 0 additions & 6 deletions lib/SILPasses/Passes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,6 @@ void swift::runSILOptimizationPasses(SILModule &Module) {
PM.addGlobalPropertyOpt();
PM.addUpdateEscapeAnalysis();

// Do the first stack promotion on high-level SIL.
PM.addStackPromotion();

PM.runOneIteration();
PM.resetAndRemoveTransformations();

Expand Down Expand Up @@ -292,9 +289,6 @@ void swift::runSILOptimizationPasses(SILModule &Module) {

PM.addUpdateEscapeAnalysis();

// Do the first stack promotion on low-level SIL.
PM.addStackPromotion();

// Speculate virtual call targets.
PM.addSpeculativeDevirtualization();

Expand Down
Loading

0 comments on commit d7b7fc7

Please sign in to comment.