[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LowerAllocations.cpp LowerSelect.cpp LowerSwitch.cpp Mem2Reg.cpp
Chris Lattner
lattner at cs.uiuc.edu
Mon May 8 21:13:54 PDT 2006
Changes in directory llvm/lib/Transforms/Scalar:
LowerAllocations.cpp updated: 1.56 -> 1.57
LowerSelect.cpp updated: 1.4 -> 1.5
LowerSwitch.cpp updated: 1.19 -> 1.20
Mem2Reg.cpp updated: 1.15 -> 1.16
---
Log message:
Patch to make some xforms preserve each other. Patch contributed by
Domagoj Babic!
---
Diffs of the changes: (+28 -2)
LowerAllocations.cpp | 7 +++++++
LowerSelect.cpp | 7 ++++++-
LowerSwitch.cpp | 11 ++++++++++-
Mem2Reg.cpp | 5 +++++
4 files changed, 28 insertions(+), 2 deletions(-)
Index: llvm/lib/Transforms/Scalar/LowerAllocations.cpp
diff -u llvm/lib/Transforms/Scalar/LowerAllocations.cpp:1.56 llvm/lib/Transforms/Scalar/LowerAllocations.cpp:1.57
--- llvm/lib/Transforms/Scalar/LowerAllocations.cpp:1.56 Mon May 1 23:24:36 2006
+++ llvm/lib/Transforms/Scalar/LowerAllocations.cpp Mon May 8 23:13:41 2006
@@ -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 @@
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
Index: llvm/lib/Transforms/Scalar/LowerSelect.cpp
diff -u llvm/lib/Transforms/Scalar/LowerSelect.cpp:1.4 llvm/lib/Transforms/Scalar/LowerSelect.cpp:1.5
--- llvm/lib/Transforms/Scalar/LowerSelect.cpp:1.4 Mon May 1 23:24:36 2006
+++ llvm/lib/Transforms/Scalar/LowerSelect.cpp Mon May 8 23:13:41 2006
@@ -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 @@
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);
Index: llvm/lib/Transforms/Scalar/LowerSwitch.cpp
diff -u llvm/lib/Transforms/Scalar/LowerSwitch.cpp:1.19 llvm/lib/Transforms/Scalar/LowerSwitch.cpp:1.20
--- llvm/lib/Transforms/Scalar/LowerSwitch.cpp:1.19 Mon May 1 23:24:36 2006
+++ llvm/lib/Transforms/Scalar/LowerSwitch.cpp Mon May 8 23:13:41 2006
@@ -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 @@
/// 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:
Index: llvm/lib/Transforms/Scalar/Mem2Reg.cpp
diff -u llvm/lib/Transforms/Scalar/Mem2Reg.cpp:1.15 llvm/lib/Transforms/Scalar/Mem2Reg.cpp:1.16
--- llvm/lib/Transforms/Scalar/Mem2Reg.cpp:1.15 Mon May 1 23:24:36 2006
+++ llvm/lib/Transforms/Scalar/Mem2Reg.cpp Mon May 8 23:13:41 2006
@@ -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 @@
AU.addRequired<DominanceFrontier>();
AU.addRequired<TargetData>();
AU.setPreservesCFG();
+ // This is a cluster of orthogonal Transforms
+ AU.addPreserved<UnifyFunctionExitNodes>();
+ AU.addPreservedID(LowerSelectID);
+ AU.addPreservedID(LowerSwitchID);
}
};
More information about the llvm-commits
mailing list