dyn_cast<> will return NULL if i is not an AllocationInst object.
--Vikram http://www.cs.uiuc.edu/~vadve