summaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2014-06-20 00:38:12 +0000
committerHans Wennborg <hans@hanshq.net>2014-06-20 00:38:12 +0000
commit160dcf5b61b8d328cd1705a90c1e0ae27dcabd41 (patch)
tree78b0a3f152e6c4972f3908fbe5b8c535da137edc /lib/Transforms
parent6fda71e05edc6447f780dee7fff8bd4bf543f39e (diff)
downloadllvm-160dcf5b61b8d328cd1705a90c1e0ae27dcabd41.tar.gz
llvm-160dcf5b61b8d328cd1705a90c1e0ae27dcabd41.tar.bz2
llvm-160dcf5b61b8d328cd1705a90c1e0ae27dcabd41.tar.xz
Don't build switch lookup tables for dllimport or TLS variables
We would previously put dllimport variables in switch lookup tables, which doesn't work because the address cannot be used in a constant initializer. This is basically the same problem that we have in PR19955. Putting TLS variables in switch tables also desn't work, because the address of such a variable is not constant. Differential Revision: http://reviews.llvm.org/D4220 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211331 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Utils/SimplifyCFG.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp
index e155daf6fc..ff2f2a0362 100644
--- a/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -3313,6 +3313,10 @@ static bool ForwardSwitchConditionToPHI(SwitchInst *SI) {
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;
return isa<ConstantFP>(C) ||
isa<ConstantInt>(C) ||