Eliminate a function call in some circumstances