[LLVMdev] LLVM Instruction to ICmpInst conversion

Krzysztof Parzyszek kparzysz at codeaurora.org
Thu Jan 10 07:02:55 PST 2013

On 1/10/2013 7:29 AM, Alexandru Ionut Diaconescu wrote:
> I cannot do something like
> ICmpInst** II1 = dyn_cast<ICmpInst*>(I1);
> (a kind of instanceOf() from Java), having casting compilation problems.

You can do
ICmpInst *II1 = dyn_cast<ICmpInst>(I1);

The "dyn_cast" is a local (to LLVM) template that handles the type 
casting.  It will return 0 if the cast was invalid, so you may need to 
check the return value.


Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
hosted by The Linux Foundation

More information about the llvm-dev mailing list