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 | c3c8d95c51f3741c4d864a0cccf203d4e6c9147d (patch) | |
| tree | c41dca67ac2be5799cf7d4a602d0b8e22d70e52c /llvm/lib/Transforms/Utils | |
| parent | efa45b2508bc25c7ae8fd2ea855b5e4c17276a6b (diff) | |
| download | bcm5719-llvm-c3c8d95c51f3741c4d864a0cccf203d4e6c9147d.tar.gz bcm5719-llvm-c3c8d95c51f3741c4d864a0cccf203d4e6c9147d.zip | |
Only do switch-to-lookup table transformation when TargetTransformInfo
is available.
llvm-svn: 167552
Diffstat (limited to 'llvm/lib/Transforms/Utils')
| -rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
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 |

