Missing Opportunity in Machine-CSE

Hi,

I find a case that Machine-CSE could but does not perform the optimization

bb.1

%24 = MOVi32imm 1

%23 = COPY %24

bb.3

%38 = MOVi32imm 1

%37 = COPY %38

bb.5

%7 = PHI %23, %bb.1, %37, %bb.3, …

The second MOVi32imm instruction could be eliminated by the CSE, but two COPYs in bb.1 and bb.3 prevent the problem. CSE thinks extending %24 to %37 increases the register pressure. Machine-CSE already supports TrivialCopyPropagation. It seems running this propogation before machine-cse can simply fix this problem. Is there any other advice?

Best,

Haicheng