Skip to content

Commit

Permalink
Don't create unwanted global declarations.
Browse files Browse the repository at this point in the history
Swift SVN r32539
  • Loading branch information
rjmccall committed Oct 9, 2015
1 parent c449b4a commit 411b9e1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/IRGen/GenMeta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,14 +325,14 @@ static llvm::Value *emitNominalMetadataRef(IRGenFunction &IGF,
// If we have less than four arguments, use a fast entry point.
assert(genericArgs.Values.size() > 0 && "no generic args?!");
if (genericArgs.Values.size() <= 4) {
llvm::Constant *fastMetadataGetters[] = {
nullptr,
IGF.IGM.getGetGenericMetadata1Fn(),
IGF.IGM.getGetGenericMetadata2Fn(),
IGF.IGM.getGetGenericMetadata3Fn(),
IGF.IGM.getGetGenericMetadata4Fn(),
};
auto fastGetter = fastMetadataGetters[genericArgs.Values.size()];
llvm::Constant *fastGetter;
switch (genericArgs.Values.size()) {
case 1: fastGetter = IGF.IGM.getGetGenericMetadata1Fn(); break;
case 2: fastGetter = IGF.IGM.getGetGenericMetadata2Fn(); break;
case 3: fastGetter = IGF.IGM.getGetGenericMetadata3Fn(); break;
case 4: fastGetter = IGF.IGM.getGetGenericMetadata4Fn(); break;
default: llvm_unreachable("bad number of generic arguments");
}

SmallVector<llvm::Value *, 5> args;
args.push_back(metadata);
Expand Down

0 comments on commit 411b9e1

Please sign in to comment.