Instruction does not dominate all uses

Hi,
I am writing an alias profiler using the points-to relation.
For this I'm inserting a function call of external function with the
following type
profile(int,int,int,void*,void*,...)
I'm trying to pass the dereferenced pointer's memory address and the
address of the location who are in alias set of the pointer.

For this i'm using BitCastInst
  BitCastInst *init1= new
BitCastInst(arg1,PointerType::getInt8PtrTy(Context),"bitcast",li2);

But every time i have a dereferenced pointer inside a for loop I get an
Instruction does not dominate all uses error.
Instruction does not dominate all uses!
  %9 = load i32** %x2, align 4
  %bitcast6 = bitcast i32* %9 to i8*
Instruction does not dominate all uses!
  %bitcast5 = bitcast i32* %7 to i8*
  %newargc7 = call i32 (i32, i32, i32, i8*, i8*, ...)* @profile(i32 1,
i32 4, i32 1, i8* %bitcast2, i8* %bitcast3, i8* %bitcast4, i8* %
bitcast5, i8* %bitcast6)

Can someone please help me ASAP

Hi,

Hi,
I am writing an alias profiler using the points-to relation.
For this I'm inserting a function call of external function with the
following type
profile(int,int,int,void*,void*,...)
I'm trying to pass the dereferenced pointer's memory address and the
address of the location who are in alias set of the pointer.

For this i'm using BitCastInst
  BitCastInst *init1= new
BitCastInst(arg1,PointerType::getInt8PtrTy(Context),"bitcast",li2);

But every time i have a dereferenced pointer inside a for loop I get an
Instruction does not dominate all uses error.
Instruction does not dominate all uses!
   %9 = load i32** %x2, align 4
   %bitcast6 = bitcast i32* %9 to i8*

this means that there is a code path from the start of the function to the
place where %bitcast6 is defined that does not first pass through the place
where %9 is defined. This is not allowed by LLVM (SSA form). Schematically
it might be something like this:

   if (cond)
     %9 = load i32** %x2, align 4
   %bitcast6 = bitcast i32* %9 to i8*

In this example if cond is false then you would get to %bitcast6 without %9
having been defined first.

Ciao, Duncan.