Skip to content

Commit

Permalink
speed up llvmcall unique name generation
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Mar 17, 2020
1 parent aa977cf commit d6ea11b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ccall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,6 @@ static jl_cgval_t emit_llvmcall(jl_codectx_t &ctx, jl_value_t **args, size_t nar
}
if (at == NULL)
at = try_eval(ctx, args[3], "error statically evaluating llvmcall argument tuple");
int i = 1;
if (jl_is_tuple(ir)) {
// if the IR is a tuple, we expect (declarations, ir)
if (jl_nfields(ir) != 2)
Expand Down Expand Up @@ -937,10 +936,11 @@ static jl_cgval_t emit_llvmcall(jl_codectx_t &ctx, jl_value_t **args, size_t nar
Type *rettype = julia_type_to_llvm(ctx, rtt, &retboxed);
if (isString) {
// Make sure to find a unique name
static int llvmcallUnique = 1;
std::string ir_name;
while (true) {
std::stringstream name;
name << (ctx.f->getName().str()) << "u" << i++;
name << (ctx.f->getName().str()) << "u" << llvmcallUnique++;
ir_name = name.str();
if (jl_Module->getFunction(ir_name) == NULL)
break;
Expand Down

0 comments on commit d6ea11b

Please sign in to comment.