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