Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correct codegen bugs introduced by allocation-hoisting-PR #45476

Merged
merged 17 commits into from
Jul 21, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove unused variable and small refactor
  • Loading branch information
gbaraldi committed Jun 6, 2022
commit e366acb49228a87e9afe6c0831231a1091c2db3e
15 changes: 7 additions & 8 deletions src/cgutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3163,18 +3163,17 @@ static Value *box_union(jl_codectx_t &ctx, const jl_cgval_t &vinfo, const SmallB
return box_merge;
}

static Function *mangleIntrinsic(IntrinsicInst *call)
static Function *mangleIntrinsic(IntrinsicInst *call) //mangling based on replaceIntrinsicUseWith
{
Intrinsic::ID ID = call->getIntrinsicID();
auto nargs = call->arg_size();
SmallVector<Value*, 8> args(nargs);
SmallVector<Type*, 8> argTys(nargs);
for (unsigned i = 0; i < nargs; i++) {
auto arg = call->getArgOperand(i);
args[i] = arg;
argTys[i] = args[i]->getType();
}
auto oldfType = call->getFunctionType();
for (unsigned i = 0; i < oldfType->getNumParams(); i++) {
auto argi = call->getArgOperand(i);
argTys[i] = argi->getType();
}

auto newfType = FunctionType::get(
oldfType->getReturnType(),
makeArrayRef(argTys).slice(0, oldfType->getNumParams()),
Expand Down Expand Up @@ -3210,7 +3209,7 @@ static void recursively_adjust_ptr_type(llvm::Value *Val, unsigned FromAS, unsig
Inst->mutateType(PointerType::getWithSamePointeeType(cast<PointerType>(Inst->getType()), ToAS));
recursively_adjust_ptr_type(Inst, FromAS, ToAS);
}
else if (isa<IntrinsicInst>(User)) { //mangling based on function_sig_t::emit_a_ccall and replaceIntrinsicWith
else if (isa<IntrinsicInst>(User)) {
IntrinsicInst *call = cast<IntrinsicInst>(User);
call->setCalledFunction(mangleIntrinsic(call));
}
Expand Down