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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211753 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Hans Wennborg
2014-06-26 00:30:52 +00:00
parent 45f166017c
commit 0545f16700
2 changed files with 11 additions and 7 deletions

View 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) ||