[llvm-commits] CVS: llvm/lib/Transforms/Utils/LowerSwitch.cpp

Nick Lewycky nicholas at mxc.ca
Sat Mar 10 08:50:41 PST 2007


Anton Korobeynikov wrote:
> 
> Changes in directory llvm/lib/Transforms/Utils:
> 
> LowerSwitch.cpp updated: 1.34 -> 1.35
> ---
> Log message:
> 
> Use range tests in LowerSwitch, where possible
> 
> 
> ---
> Diffs of the changes:  (+114 -31)
> 
>  LowerSwitch.cpp |  145 ++++++++++++++++++++++++++++++++++++++++++++------------
>  1 files changed, 114 insertions(+), 31 deletions(-)
> 
> 
> Index: llvm/lib/Transforms/Utils/LowerSwitch.cpp
> diff -u llvm/lib/Transforms/Utils/LowerSwitch.cpp:1.34 llvm/lib/Transforms/Utils/LowerSwitch.cpp:1.35
> --- llvm/lib/Transforms/Utils/LowerSwitch.cpp:1.34	Fri Mar  2 17:15:21 2007
> +++ llvm/lib/Transforms/Utils/LowerSwitch.cpp	Sat Mar 10 10:46:28 2007
> @@ -40,26 +40,38 @@
>        AU.addPreservedID(LowerInvokePassID);
>        AU.addPreservedID(LowerAllocationsID);
>      }
> -        
> -    typedef std::pair<Constant*, BasicBlock*> Case;
> -    typedef std::vector<Case>::iterator       CaseItr;
> +
> +    struct CaseRange {
> +      Constant* Low;
> +      Constant* High;
> +      BasicBlock* BB;
> +
> +      CaseRange(Constant* _Low = NULL, Constant* _High = NULL,
> +                BasicBlock* _BB = NULL):
> +        Low(_Low), High(_High), BB(_BB) { }
> +    };

Do you ever store non-ConstantInt in Low and High? If not, could you
either replace this with, or make it a wrapper around ConstantRange?

Nick



More information about the llvm-commits mailing list