mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
Patch to make some xforms preserve each other. Patch contributed by
Domagoj Babic! llvm-svn: 28181
This commit is contained in:
parent
9e06c1b17f
commit
f49a22d601
@ -13,6 +13,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h"
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/DerivedTypes.h"
|
||||
#include "llvm/Instructions.h"
|
||||
@ -39,6 +40,12 @@ namespace {
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.addRequired<TargetData>();
|
||||
AU.setPreservesCFG();
|
||||
|
||||
// This is a cluster of orthogonal Transforms:
|
||||
AU.addPreserved<UnifyFunctionExitNodes>();
|
||||
AU.addPreservedID(PromoteMemoryToRegisterID);
|
||||
AU.addPreservedID(LowerSelectID);
|
||||
AU.addPreservedID(LowerSwitchID);
|
||||
}
|
||||
|
||||
/// doPassInitialization - For the lower allocations pass, this ensures that
|
||||
|
@ -19,6 +19,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h"
|
||||
#include "llvm/Function.h"
|
||||
#include "llvm/Instructions.h"
|
||||
#include "llvm/Pass.h"
|
||||
@ -37,7 +38,11 @@ namespace {
|
||||
LowerSelect(bool onlyfp = false) : OnlyFP(onlyfp) {}
|
||||
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
// Doesn't really preserve anything. It can certainly destroy the CFG.
|
||||
// This certainly destroys the CFG.
|
||||
// This is a cluster of orthogonal Transforms:
|
||||
AU.addPreserved<UnifyFunctionExitNodes>();
|
||||
AU.addPreservedID(PromoteMemoryToRegisterID);
|
||||
AU.addPreservedID(LowerSwitchID);
|
||||
}
|
||||
|
||||
bool runOnFunction(Function &F);
|
||||
|
@ -14,6 +14,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h"
|
||||
#include "llvm/Constants.h"
|
||||
#include "llvm/Function.h"
|
||||
#include "llvm/Instructions.h"
|
||||
@ -32,7 +33,15 @@ namespace {
|
||||
/// modifies the CFG!
|
||||
class LowerSwitch : public FunctionPass {
|
||||
public:
|
||||
bool runOnFunction(Function &F);
|
||||
virtual bool runOnFunction(Function &F);
|
||||
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
// This is a cluster of orthogonal Transforms
|
||||
AU.addPreserved<UnifyFunctionExitNodes>();
|
||||
AU.addPreservedID(PromoteMemoryToRegisterID);
|
||||
AU.addPreservedID(LowerSelectID);
|
||||
}
|
||||
|
||||
typedef std::pair<Constant*, BasicBlock*> Case;
|
||||
typedef std::vector<Case>::iterator CaseItr;
|
||||
private:
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/Transforms/Utils/PromoteMemToReg.h"
|
||||
#include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h"
|
||||
#include "llvm/Analysis/Dominators.h"
|
||||
#include "llvm/Instructions.h"
|
||||
#include "llvm/Function.h"
|
||||
@ -37,6 +38,10 @@ namespace {
|
||||
AU.addRequired<DominanceFrontier>();
|
||||
AU.addRequired<TargetData>();
|
||||
AU.setPreservesCFG();
|
||||
// This is a cluster of orthogonal Transforms
|
||||
AU.addPreserved<UnifyFunctionExitNodes>();
|
||||
AU.addPreservedID(LowerSelectID);
|
||||
AU.addPreservedID(LowerSwitchID);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -32,6 +32,10 @@ Pass *llvm::createUnifyFunctionExitNodesPass() {
|
||||
void UnifyFunctionExitNodes::getAnalysisUsage(AnalysisUsage &AU) const{
|
||||
// We preserve the non-critical-edgeness property
|
||||
AU.addPreservedID(BreakCriticalEdgesID);
|
||||
// This is a cluster of orthogonal Transforms
|
||||
AU.addPreservedID(PromoteMemoryToRegisterID);
|
||||
AU.addPreservedID(LowerSelectID);
|
||||
AU.addPreservedID(LowerSwitchID);
|
||||
}
|
||||
|
||||
// UnifyAllExitNodes - Unify all exit nodes of the CFG by creating a new
|
||||
|
Loading…
Reference in New Issue
Block a user