isa<UnaryInstruction> borked in 2.1

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?

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.

Thanks
ST

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:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071203/056054.html

-Chris

Hi

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.

Well, probably i should have looked into the header files too...

Thanks for pointing this out, please try this patch:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071203/056054
.html

Wow, that was quick. It seems to work at a first glance. I will produce some
noise if i find some problems with this patch.

Thanks
ST