diff options
author | Hans Wennborg <hans@hanshq.net> | 2012-11-07 21:35:12 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2012-11-07 21:35:12 +0000 |
commit | b0319962cfdb18da38ef47da621f148fe144b092 (patch) | |
tree | 7ef69b3a6830545f7264a821fbdec697060668b2 /lib/Transforms/Utils | |
parent | e90a3bcae1cd936aa760cffe5607266279b210d1 (diff) | |
download | external_llvm-b0319962cfdb18da38ef47da621f148fe144b092.zip external_llvm-b0319962cfdb18da38ef47da621f148fe144b092.tar.gz external_llvm-b0319962cfdb18da38ef47da621f148fe144b092.tar.bz2 |
Only do switch-to-lookup table transformation when TargetTransformInfo
is available.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167552 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils')
-rw-r--r-- | lib/Transforms/Utils/SimplifyCFG.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp index 9823433..b33d0d4 100644 --- a/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/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 |