[llvm-dev] Type unmatched after replacing functions

Will Lester via llvm-dev llvm-dev at lists.llvm.org
Thu Sep 19 01:20:47 PDT 2019


Hi all,
I am trying to merge functions with the same debug location by
using replaceAllUsesWith().
However, this leads to type unmatched problems because the
functions with the same debug location can have different parameters.

An example is foo(struct A) can be compiled to foo.1(struct A.1) and
foo.2(struct A.2).

I have inserted CastInst to solve the problems of arguments and return
values type unmatched. But I find the problem of unmatched type of uses
of function pointers is harder to solve.
The function pointers are often put in the initializers of global variables, and
they can not be simply replaced by a bitcast ConstantExpr since setOperand()
cannot be used for Constant.

So, is there any solution to this problem?
Thanks!


More information about the llvm-dev mailing list