Don't build switch lookup tables for dllimport or TLS variables
[oota-llvm.git] / lib / Transforms / Utils / SimplifyCFG.cpp
index e155daf6fcce39872bb43a2a1353e673242bc0b9..ff2f2a0362254146dfa4db781f2a9d5ccfe7dea5 100644 (file)
@@ -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) ||