From c3c8d95c51f3741c4d864a0cccf203d4e6c9147d Mon Sep 17 00:00:00 2001 From: Hans Wennborg Date: Wed, 7 Nov 2012 21:35:12 +0000 Subject: Only do switch-to-lookup table transformation when TargetTransformInfo is available. llvm-svn: 167552 --- llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Transforms/Utils') diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 9823433e861..b33d0d473b1 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -3538,7 +3538,8 @@ static bool SwitchToLookupTable(SwitchInst *SI, const TargetTransformInfo *TTI) { assert(SI->getNumCases() > 1 && "Degenerate switch?"); - if (TTI && !TTI->getScalarTargetTransformInfo()->shouldBuildLookupTables()) + // Only build lookup table when we have a target that supports it. + if (!TTI || !TTI->getScalarTargetTransformInfo()->shouldBuildLookupTables()) return false; // FIXME: If the switch is too sparse for a lookup table, perhaps we could -- cgit v1.2.3