Applied, thanks:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20060508/034683.html
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20060508/034684.html
Sorry for the delay. :(
In the future, please attach the patch to the email (instead of including
it inline) as it makes it easier to apply and reduces the chance of the
mail program mangling it.
-Chris
On Wed, 3 May 2006, Domagoj Babic wrote:
> Hi,
>
> A number of transforms are actually independent, so here's a partial
fix. I
> updated the
> dependencies in a cluster of transforms: LowerSwitch, Mem2Reg, LowerSelect,
> LowerAllocations, UnifyFunctionExitNodes.
>
> The patch has been tested, but not extensively. PassManager doesn't
> complain, and
> the result of a test pass that requires all these (except for
> LowerAllocations) together
> works fine.
>
> Domagoj
>
>
> ***************************** PATCH BEGIN
> **********************************************
>
> Index: ./lib/Transforms/Scalar/LowerSwitch.cpp
> ==================================================================> RCS
file: /var/cvs/llvm/llvm/lib/Transforms/Scalar/LowerSwitch.cpp,v
> retrieving revision 1.19
> diff -u -p -r1.19 LowerSwitch.cpp
> --- ./lib/Transforms/Scalar/LowerSwitch.cpp 2 May 2006 04:24:36
> -0000 1.19
> +++ ./lib/Transforms/Scalar/LowerSwitch.cpp 3 May 2006 18:01:53 -0000
> @@ -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:
> Index: ./lib/Transforms/Scalar/Mem2Reg.cpp
> ==================================================================> RCS
file: /var/cvs/llvm/llvm/lib/Transforms/Scalar/Mem2Reg.cpp,v
> retrieving revision 1.15
> diff -u -p -r1.15 Mem2Reg.cpp
> --- ./lib/Transforms/Scalar/Mem2Reg.cpp 2 May 2006 04:24:36 -0000
1.15
> +++ ./lib/Transforms/Scalar/Mem2Reg.cpp 3 May 2006 18:01:53 -0000
> @@ -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);
> }
> };
>
> Index: ./lib/Transforms/Scalar/LowerSelect.cpp
> ==================================================================> RCS
file: /var/cvs/llvm/llvm/lib/Transforms/Scalar/LowerSelect.cpp,v
> retrieving revision 1.4
> diff -u -p -r1.4 LowerSelect.cpp
> --- ./lib/Transforms/Scalar/LowerSelect.cpp 2 May 2006 04:24:36
> -0000 1.4
> +++ ./lib/Transforms/Scalar/LowerSelect.cpp 3 May 2006 18:01:53 -0000
> @@ -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"
> @@ -38,6 +39,12 @@ namespace {
>
> virtual void getAnalysisUsage(AnalysisUsage &AU) const {
> // Doesn't really preserve anything. It can certainly destroy the
> CFG.
> + // But it preserves some Transforms.
> +
> + // This is a cluster of orthogonal Transforms:
> + AU.addPreserved<UnifyFunctionExitNodes>();
> + AU.addPreservedID(PromoteMemoryToRegisterID);
> + AU.addPreservedID(LowerSwitchID);
> }
>
> bool runOnFunction(Function &F);
> Index: ./lib/Transforms/Scalar/LowerAllocations.cpp
> ==================================================================> RCS
file: /var/cvs/llvm/llvm/lib/Transforms/Scalar/LowerAllocations.cpp,v
> retrieving revision 1.56
> diff -u -p -r1.56 LowerAllocations.cpp
> --- ./lib/Transforms/Scalar/LowerAllocations.cpp 2 May 2006 04:24:36
> -0000 1.56
> +++ ./lib/Transforms/Scalar/LowerAllocations.cpp 3 May 2006 18:01:53
> -0000
> @@ -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
> Index: ./lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
> ==================================================================> RCS
file:
> /var/cvs/llvm/llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp,v
> retrieving revision 1.33
> diff -u -p -r1.33 UnifyFunctionExitNodes.cpp
> --- ./lib/Transforms/Utils/UnifyFunctionExitNodes.cpp 21 Apr 2005
23:45:34
> -0000 1.33
> +++ ./lib/Transforms/Utils/UnifyFunctionExitNodes.cpp 3 May 2006 18:01:53
> -0000
> @@ -32,6 +32,10 @@ Pass *llvm::createUnifyFunctionExitNodes
> 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
>
> ***************************** PATCH END
> **********************************************
>
-Chris
--
http://nondot.org/sabre/
http://llvm.org/