[LLVMdev] isa<UnaryInstruction> borked in 2.1

Chris Lattner sabre at nondot.org
Fri Dec 7 20:38:57 PST 2007

On Dec 7, 2007, at 9:44 AM, ST wrote:

> Hi
> I just had some code which filtered via isa<UnaryInstruction>.  
> Strangely
> enough not only the instructions which inherited UnaryInstructions  
> but also:
> GetElemPtrInst, SwitchInst , xor, shl
> where true on isa<UnaryInstruction>. While the first two seem to be  
> at least
> semantically ok the latter seem somehow wrong?

Yeah, that's really wrong.

> I didn't find the place where the isa_impl templates where resolved  
> to the
> real thing, so i didn't dare to file a bug report... but i would  
> happy if
> somebody could tell me... and yes i have looked at Casting.h.

This is implemented with the 'classof' method on the class.  Since it  
isn't implemented for UnaryInstruction, it is accepting anything that  
isa<Instruction>, which is very very wrong.

Thanks for pointing this out, please try this patch:


More information about the llvm-dev mailing list