Use isa<> and cast<> instead of definition().

No functionality change intended.