Null check before isa<>
Null check before dyn_cast<>
Code quality improvements
Use dyn_cast_or_null
Merge pull request #70 from lqi/isa-dyn_cast-null-check

Use dyn_cast_or_null API, and complement null check for isa<> and dyn_cast<>