Reapply my if-conversion cleanup from svn r106939 with fixes.