To optimize this:
m(Object o) {
if (o == null) {
} else {
}
}
C2 uses branch profiling. If the object is never null, profiling tells it that one branch is always taken and it's not compiled. If m() is called from many places branch profiling can be polluted and C2 may not be able to optimize one of the branch out.
Several type profiling points also record whether they see a null object or not so in the example above some method that calls m() may have profile data that indicate whether o is null or not and that can be used to overcome branch profile pollution in m(). To achieve this, we need type speculation to take advantage of the part of the profile data that tells whether a null was seen.