* sparse-llvm failure when comparing pointers
@ 2017-03-13 23:47 Dibyendu Majumdar
2017-03-19 15:33 ` Luc Van Oostenryck
0 siblings, 1 reply; 2+ messages in thread
From: Dibyendu Majumdar @ 2017-03-13 23:47 UTC (permalink / raw)
To: Linux-Sparse
Pointer comparions are failing LLVM validation if they are not the
same type. One way to resolve this is to cast the pointer to integer
before comparing. I am trying out following approach. In
output_op_compare(), I separated out the pointer case as follows:
switch (LLVMGetTypeKind(LLVMTypeOf(lhs))) {
case LLVMPointerTypeKind: {
lhs = LLVMBuildPtrToInt(fn->builder, lhs,
LLVMIntType(C->target->bits_in_pointer), "");
if (LLVMGetTypeKind(LLVMTypeOf(rhs)) == LLVMPointerTypeKind) {
rhs = LLVMBuildPtrToInt(fn->builder, rhs,
LLVMIntType(C->target->bits_in_pointer), "");
}
LLVMIntPredicate op = translate_op(insn->opcode);
target = LLVMBuildICmp(fn->builder, op, lhs, rhs, target_name);
break;
}
case LLVMIntegerTypeKind: {
LLVMIntPredicate op = translate_op(insn->opcode);
target = LLVMBuildICmp(fn->builder, op, lhs, rhs, target_name);
break;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: sparse-llvm failure when comparing pointers
2017-03-13 23:47 sparse-llvm failure when comparing pointers Dibyendu Majumdar
@ 2017-03-19 15:33 ` Luc Van Oostenryck
0 siblings, 0 replies; 2+ messages in thread
From: Luc Van Oostenryck @ 2017-03-19 15:33 UTC (permalink / raw)
To: Dibyendu Majumdar; +Cc: Linux-Sparse
On Mon, Mar 13, 2017 at 11:47:04PM +0000, Dibyendu Majumdar wrote:
> Pointer comparions are failing LLVM validation if they are not the
> same type. One way to resolve this is to cast the pointer to integer
> before comparing. I am trying out following approach. In
> output_op_compare(), I separated out the pointer case as follows:
This is fixed in the llvm-fixes-v3 serie I submitted yesterday.
-- Luc
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-03-19 15:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-13 23:47 sparse-llvm failure when comparing pointers Dibyendu Majumdar
2017-03-19 15:33 ` Luc Van Oostenryck
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.