From 65a29ec316e17903d445facaa1ce44cbae4a26d7 Mon Sep 17 00:00:00 2001 From: Matt Pharr Date: Mon, 18 Jul 2011 13:03:50 +0100 Subject: [PATCH] Only create ispc-callable functions for bitcode functions that start with "__" Don't create ispc-callable symbols for other functions that we find in the LLVM bitcode files that are loaded up and linked into the module so that they can be called from ispc stdlib functions. This fixes an issue where we had a clash between the declared versions of double sin(double) and the corresponding ispc stdlib routines for uniform doubles, which in turn led to bogus code being generated for calls to those ispc stdlib functions. --- builtins.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/builtins.cpp b/builtins.cpp index b7ea19a9..6b3f5045 100644 --- a/builtins.cpp +++ b/builtins.cpp @@ -151,6 +151,9 @@ lCreateISPCSymbol(llvm::Function *func, SymbolTable *symbolTable) { const llvm::FunctionType *ftype = func->getFunctionType(); std::string name = func->getName(); + if (name.size() < 3 || name[0] != '_' || name[1] != '_') + return false; + // An unfortunate hack: we want this builtin function to have the // signature "int __sext_varying_bool(bool)", but the ispc function // symbol creation code below assumes that any LLVM vector of i32s is a