[llvm-dev] Malloc signature errors
David Blaikie via llvm-dev
llvm-dev at lists.llvm.org
Thu Jun 17 10:49:46 PDT 2021
Might be missing the noalias attribute on the result?
On Thu, Jun 17, 2021 at 10:46 AM zealain via llvm-dev <
llvm-dev at lists.llvm.org> wrote:
> I am trying to insert malloc calls in my function pass, yet it keeps
> complaining about the parameter type:
> Call parameter type does not match function signature!
> i64 4096
> i8* %malloccall = tail call i8* @malloc(i64 4096)
> Comparing this to a call generated by simply having a malloc in the C
> code, I cannot spot significant differences. The following (generated by
> clang) works just fine:
> %2 = call noalias i8* @malloc(i64 4096) #2
> Why does one work but the other doesn't? Below is the code I use to
> generate the instruction:
> Type *int8Type = Type::getInt8Ty(this->currentFunction->getContext());
> Type *int64Type = Type::getInt64Ty(this->currentFunction->getContext());
> auto allocSize = ConstantInt::get(int64Type, 4096);
> Instruction* mallocInstr =
> int8Type->getPointerTo(), int8Type, allocSize,
> nullptr, nullptr, "");
> I tried changing up the types already but didn't find a combination that
> works yet. Any hints would be appreciated.
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev