summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2014-06-26 00:30:52 +0000
committerHans Wennborg <hans@hanshq.net>2014-06-26 00:30:52 +0000
commitb03ebfb77ee0a4da44c8191ae0ebcbb3615df939 (patch)
treec26bb5c203dfb4f54d9eb30f8dae3c79aff67385 /llvm/lib/Transforms/Utils/SimplifyCFG.cpp
parent2251672878c7212c96f16c6f2d30c142f2aae877 (diff)
downloadbcm5719-llvm-b03ebfb77ee0a4da44c8191ae0ebcbb3615df939.tar.gz
bcm5719-llvm-b03ebfb77ee0a4da44c8191ae0ebcbb3615df939.zip
Don't build switch tables for dllimport and TLS variables in GEPs
This is a follow-up to r211331, which failed to notice that we were returning early from ValidLookupTableConstant for GEPs. llvm-svn: 211753
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyCFG.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index ff2f2a03622..b1f9bff5377 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -3311,13 +3311,14 @@ static bool ForwardSwitchConditionToPHI(SwitchInst *SI) {
/// ValidLookupTableConstant - Return true if the backend will be able to handle
/// initializing an array of constants like C.
static bool ValidLookupTableConstant(Constant *C) {
- if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C))
- return CE->isGEPWithNoNotionalOverIndexing();
if (C->isThreadDependent())
return false;
if (C->isDLLImportDependent())
return false;
+ if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C))
+ return CE->isGEPWithNoNotionalOverIndexing();
+
return isa<ConstantFP>(C) ||
isa<ConstantInt>(C) ||
isa<ConstantPointerNull>(C) ||
OpenPOWER on IntegriCloud