I would start by adding TODO_verify_ssa to pass_iv_optimize in ree-ssa-loop.c to catch it earlier, That produces exactly the same error.