Create Instruction

Hi!

I’ve have Instruction in my code:

%call6 = call i32 %9(%class.A* %call3, i32 2)

And I want to get something like this:

%11 = icmp eq i32 (%class.D*, i32)* %10, @_ZThn4_N1D1xEi
br i1 %11, label %12, label %14

; :12 ; preds = %7
%13 = bitcast %class.A* %call3 to %class.D*
%call64 = call i32 @_ZThn4_N1D1xEi(%class.D* %13, i32 2) // this one should be called instead of original in true-block of icmp
br label %15

; :14 ; preds = %7
%call6 = call i32 %9(%class.A* %call3, i32 2) // this is my instruction
br label %15

; :15 ; preds = %12, %14

The problem is that results of instructions have different names (%call6, %call64). I create new CallInst by CallInst::Create(F1,args,CS.getInstruction()->getName(), rightCall); , where CS - original call site, but new Instruction still haven’t same name, but similar as I see…

It is possible to give exactly same name for result if CallInst in my case? Thanks!

Yours sincerely,
Kadysev Mikhail

Hi Михаил,

The problem is that results of instructions have different names (%call6,
%call64).

instruction names aren't used for anything (they only exist to make the IR
easier for humans to read), so it doesn't matter.

Ciao, Duncan.

  I create new CallInst by