Workaround change to linker behavior in LLVM 3.1

Now, the Linker::LinkModules() call doesn't link in any functions
marked as 'internal', which is problematic, since we'd like to have
just about all of the builtins marked as internal so that they are
eliminated after they've been inlined when they are in fact used.

This change removes all of the internal qualifiers in the builtins
and adds a lSetInternalFunctions() routine to builtins.cpp that
sets this property on the functions that need it after they've
been linked in by LinkModules().
This commit is contained in:
Matt Pharr
2011-11-05 16:57:26 -07:00
parent b0d476fcdc
commit cabe358c0a
13 changed files with 760 additions and 447 deletions

11
opt.cpp
View File

@@ -2814,11 +2814,11 @@ llvm::RegisterPass<MakeInternalFuncsStaticPass>
bool
MakeInternalFuncsStaticPass::runOnModule(llvm::Module &module) {
const char *names[] = {
"__do_print", "__fast_masked_vload", "__num_cores",
"__fast_masked_vload",
"__gather_base_offsets_i8", "__gather_base_offsets_i16",
"__gather_base_offsets_i32", "__gather_base_offsets_i64",
"__gather_elt_8", "__gather_elt_16",
"__gather_elt_32", "__gather_elt_64",
"__gather_elt_i8", "__gather_elt_i16",
"__gather_elt_i32", "__gather_elt_i64",
"__load_and_broadcast_8", "__load_and_broadcast_16",
"__load_and_broadcast_32", "__load_and_broadcast_64",
"__load_masked_8", "__load_masked_16",
@@ -2827,11 +2827,10 @@ MakeInternalFuncsStaticPass::runOnModule(llvm::Module &module) {
"__masked_store_32", "__masked_store_64",
"__masked_store_blend_8", "__masked_store_blend_16",
"__masked_store_blend_32", "__masked_store_blend_64",
"__packed_load_active", "__packed_store_active",
"__scatter_base_offsets_i8", "__scatter_base_offsets_i16",
"__scatter_base_offsets_i32", "__scatter_base_offsets_i64",
"__scatter_elt_8", "__scatter_elt_16",
"__scatter_elt_32", "__scatter_elt_64",
"__scatter_elt_i8", "__scatter_elt_i16",
"__scatter_elt_i32", "__scatter_elt_i64",
};
bool modifiedAny = false;