<br>
<div>Hello. :)</div><div><br></div><div>I've met a problem that eliminates a live code in code generation phase.</div><div><br></div><div>The initially generated code is shown as follows (as a pseudo code):</div><div>
( Before pseudo-code expansion. )</div><div><br></div><div>----------</div><div>loop:</div><div>  :</div><div>  :</div><div>  set P0 <- xxx ( P0: a physical register for a parameter of function F )</div><div>  set P1 <- yyy ( P1: a physical register for a parameter of function F )</div>
<div>  SELECT_CC z1, z2, z3, ...</div><div>      ( <- I don't know why this is scheduled at this time,</div><div>            however it is independent from function F )</div><div>  call F</div><div>  :</div><div>  :</div>
<div>----------</div><div><br></div><div>After that, pseudo code expansion stage expands SELECT_CC by slicing the machine basic clock.</div><div><br></div><div><div>----------</div><div>loop:</div><div>  :</div><div>  :</div>
<div>  set P0 <- xxx ( P0: a physical register for a parameter of function F )</div><div>  set P1 <- yyy ( P1: a physical register for a parameter of function F )</div><div>  :</div><div>  branch_cond B2, B3</div><div>
B2:</div><div>  mov v1, v2, v3</div><div>B3:</div><div>  call F</div><div>  :</div><div>  :</div><div>----------</div></div><div><br></div><div>At first,</div><div>the dead code elimination stage misthinks P0 and P1 is not alive</div>
<div>since the live variable analysis (actually it seems as a live physical register analysis)</div><div>in DCE stage is somewhat wrong (to my thinking).</div><div>Therefore, set Px statements are all eliminated.</div><div>
Then I modified the DCE code to keep the live physical register information in each MBB.</div><div>But they are eliminated in some other optimization stage.</div><div><br></div><div>To my thinking, the initial placement of SELECT_CC seems wrong.</div>
<div>I tried to dig in SelectionDAG directory, I could find any clue.</div><div><br></div><div>How can I avoid this situation ?</div><div>Anyone can give me a hint ?</div><div><br></div><div><br></div><div>Thank you.</div>
<div>Have a nice day!</div><div><br></div><div><br></div><div><br></div><div>Regards,</div><div>Hae-woo Park</div><div><br></div><div><br></div>