[LLVMdev] Intrinsic cannot use illegal type

Christian Sayer Christian.Sayer at dibcom.fr
Wed Mar 4 05:15:16 PST 2009


Duncan,
thanks for your hints. Truncating a legal type was actually
a nice remedy for the intrinsic - and the truncate gets eliminated
by instcombine anyway.
As of the second point, I have been disturbing myself by some
setOperationAction disorder...

Best regards,
Christian

 --
  Christian SAYER


> -----Original Message-----
> From: Duncan Sands [mailto:baldrick at free.fr]
> Sent: Tuesday, March 03, 2009 10:40 AM
> To: llvmdev at cs.uiuc.edu
> Cc: Christian Sayer
> Subject: Re: [LLVMdev] Intrinsic cannot use illegal type
>
> Hi Christian,
>
> > I use a target specific Intrinsic that returns an illegal type.
> > The idea is that this returned value shall be eliminated when the
> > Intrinsic node is lowered to a target node.
> > I realize that this is a rather late stage, since (at least)
> > SelectionDAGLowering::visitTargetIntrinsic() requires legal types,
> > and type legalization in general is also done before ISelLowering.
>
> no, type legalization is done after everything has been lowered to
> SelectionDAG nodes.  I'm not sure why visitTargetIntrinsic insists
> that types must be legal.  If there is an illegal type there then
> the type legalizer will complain later because it doesn't know how
> to legalize it, that's all.  However the type legalizer (I'm talking
> LLVM 2.5 here) allows targets to custom lower operations with illegal
> types via hooks like ReplaceNodeResults.  So if you got rid of the
> assertion in visitTargetIntrinsic and added some custom lowering
> logic, then hopefully everything will work.
>
> > The background is that the intrinsic returns a boolean value which
> > is evaluated by a branch instruction of a (special) loop.
>
> Why not have it return the boolean value in a legal type (eg: i32) and
> follow it up with a truncate to turn it into an i1 for the benefit of
> the branch?  That way you won't have to do any mucking around with the
> type legalizer at all!
>
> > The branch targets of this kind of loop are actually
> controlled and generated by  hardware. So in the end the
> intrinsic should become the branch instruction and the
> original branch should disappear.
> >
> > Is there a way to make this intrinsic go through as it is
> until instruction lowering, and to avoid type legalization on it?
>
> See above.
>
> Ciao,
>
> Duncan.
>

CONFIDENTIAL NOTICE: The contents of this message, including any attachments, are confidential and are intended solely for the use of the person or entity to whom the message was addressed. If you are not the intended recipient of this message, please be advised that any dissemination, distribution, or use of the contents of this message is strictly prohibited. If you received this message in error, please notify the sender. Please also permanently delete all copies of the original message and any attached documentation. Thank you.




More information about the llvm-dev mailing list