[llvm-dev] Instruction does not dominate all uses!

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[llvm-dev] Instruction does not dominate all uses!

Gerolf Hoflehner via llvm-dev

LLVM 3.8.0, Ubuntu 16.04.2, 64 bit is being used to instrument IR.

====================================================

define i32 @bar() #0 {
entry:
  %var = alloca [3 x i32], align 4
  %0 = bitcast [3 x i32]* %var to i8*
  call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* bitcast ([3 x i32]* @bar.var to i8*), i64 12, i32 4, i1 false)
  %arrayidx = getelementptr inbounds [3 x i32], [3 x i32]* %var, i64 0, i64 0
  %1 = load i32, i32* %arrayidx, align 4
  ret i32 %1
}

=====================================================

if (AllocaInst *alloca_inst = dyn_cast<AllocaInst>(&I)) {
                   .
                   .
                   .
                    Value* var_addr = builder.CreateBitCast(alloca_inst, Type::getInt8PtrTy(Ctx));
                   .
                   .
                   .
                }

=====================================================

I am receiving the following error:

Instruction does not dominate all uses!                                                
  %var = alloca [3 x i32], align 4  
  %0 = bitcast [3 x i32]* %var to i8*                

=====================================================

I can't even see any conditional statement in the IR. Can someone please point out what I am missing? 

--

Thanks & Regards,

Dipanjan

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [llvm-dev] Instruction does not dominate all uses!

Gerolf Hoflehner via llvm-dev
On 9 June 2017 at 21:00, Dipanjan Das via llvm-dev
<[hidden email]> wrote:
> Instruction does not dominate all uses!
>   %var = alloca [3 x i32], align 4
>   %0 = bitcast [3 x i32]* %var to i8*

It looks like your IRBuilder may be inserting the instruction in the
wrong place. I'd use the debugger to call Module::dump after that
fault to see where the bitcast really lives. If it's before the alloca
(or even not guaranteed to be afterwards) then that's your problem.

Tim.
_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [llvm-dev] Instruction does not dominate all uses!

Gerolf Hoflehner via llvm-dev


On 9 June 2017 at 21:14, Tim Northover <[hidden email]> wrote:
On 9 June 2017 at 21:00, Dipanjan Das via llvm-dev
<[hidden email]> wrote:
> Instruction does not dominate all uses!
>   %var = alloca [3 x i32], align 4
>   %0 = bitcast [3 x i32]* %var to i8*

It looks like your IRBuilder may be inserting the instruction in the
wrong place.

Indeed. Thank you so much. I was scratching my head all day today. I wish I'd have mailed in the morning, could have saved my day.
 
I'd use the debugger to call Module::dump after that
fault to see where the bitcast really lives. If it's before the alloca
(or even not guaranteed to be afterwards) then that's your problem.

Out of curiosity, do my mean to fire up gdb? Can it call Module:dump() after a breakpoint is hit?
 

Tim.



--

Thanks & Regards,

Dipanjan

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [llvm-dev] Instruction does not dominate all uses!

Gerolf Hoflehner via llvm-dev
I'd use the debugger to call Module::dump after that
fault to see where the bitcast really lives. If it's before the alloca
(or even not guaranteed to be afterwards) then that's your problem.

Out of curiosity, do my mean to fire up gdb? Can it call Module:dump() after a breakpoint is hit?

Usually you can call dump function in a GDB session, just give it a try.

Regards,
chenwj

--
Wei-Ren Chen (陳韋任)
Homepage: https://people.cs.nctu.edu.tw/~chenwj

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Loading...