Instruction does not dominate all uses!

Hello All,

I am instrumenting IR to pass addres of the function to runtime but I am getting error - Instruction does not dominate all uses. I used M.dump() to get below dump, not able to figure out what I am doing wrong. Any help would be much appreciated.

define dso_local double @mysqrt(double %val1) local_unnamed_addr #0 {

entry:

%0 = bitcast double (double)* @mysqrt to i8*

%1 = call i64 @getAddr(i8* %0)

call void @funcInit(i64 %1)

%2 = call i64 @getRealFunArg(i32 0, i64 %1)

%mul = fmul double %val1, %val1

ret double %mul

}

!llvm.module.flags = !{!0}

!llvm.ident = !{!1}

!0 = !{i32 1, !“wchar_size”, i32 4}

!1 = !{!“clang version 7.0.0 (trunk 336308)”}

Instruction does not dominate all uses!

%1 = call i64 @getAddr(i8* %0)

%2 = call i64 @getRealFunArg(i32 0, i64 %1)

Instruction does not dominate all uses!

%1 = call i64 @getAddr(i8* %0)

call void @trackReturn(i64 %1, i64 %4)

LLVM ERROR: Broken function found, compilation aborted!

The dump of the function seems to be from before some transformation. The trackReturn mention in the error message does not appear in it. Can you provide the dump at the failure?

On this snippet:

Instruction does not dominate all uses!
%1 = call i64 @getAddr(i8* %0)
call void @trackReturn(i64 %1, i64 %4)

We don't see the def of %4, could it be the problem?