diff options
author | Oliver Stannard <oliver.stannard@arm.com> | 2016-10-17 12:00:24 +0000 |
---|---|---|
committer | Oliver Stannard <oliver.stannard@arm.com> | 2016-10-17 12:00:24 +0000 |
commit | fe4432b105665badd6a88a120767864e4a2efbae (patch) | |
tree | da81ad4688a298236f63d9ba5a3fa3fb613e8c8d /llvm/lib/Transforms/Utils/SimplifyCFG.cpp | |
parent | 2bbec0ee7f22ac7e23e67b7d342f3b4823da72c4 (diff) | |
download | bcm5719-llvm-fe4432b105665badd6a88a120767864e4a2efbae.tar.gz bcm5719-llvm-fe4432b105665badd6a88a120767864e4a2efbae.zip |
[SimplifyCFG] Don't lower complex ConstantExprs to lookup tables
Not all ConstantExprs can be represented by a global variable, for example most
pointer arithmetic other than addition of a constant, so we can't convert these
values from switch statements to lookup tables.
Differential Revision: https://reviews.llvm.org/D25550
llvm-svn: 284379
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 21bb87b84fc..c7c66fd9d74 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -4449,9 +4449,12 @@ static bool ValidLookupTableConstant(Constant *C, const TargetTransformInfo &TTI !isa<UndefValue>(C) && !isa<ConstantExpr>(C)) return false; - if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) + if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) { if (!CE->isGEPWithNoNotionalOverIndexing()) return false; + if (!ValidLookupTableConstant(CE->getOperand(0), TTI)) + return false; + } if (!TTI.shouldBuildLookupTablesForConstant(C)) return false; |