Rearrange code so that llvm-upgrade doesn't break the optimization this