I'm sure somebody will correct me if I'm wrong....
Before starting a CPL you have to demonstrate the required knowledge, which you achieve by passing the CPL or ATPL theory exams. If you do the CPL theory then before doing the IR you have to pass another set of exams. However the ATPL theory covers both CPL and IR. You don't have a choice about wether to do the theory before or after the CPL. You need the theory first.
D