I would like to transform X/Y -> X*1/Y.  Specifically, I would like to convert:<br><br>define void @t1a(double %a, double %b, double %d) {<br>entry:<br>  %div = fdiv fast double %a, %d<br>  %div1 = fdiv fast double %b, %d<br>
  %call = tail call i32 @foo(double %div, double %div1)<br>  ret void<br>}<br><br>to:<br><br>define void @t1b(double %a, double %b, double %d) {<br>entry:<br>  %div = fdiv fast double 1.000000e+00, %d<br>  %mul = fmul fast double %div, %a<br>
  %mul1 = fmul fast double %div, %b<br>  %call = tail call i32 @foo(double %mul, double %mul1)<br>  ret void<br>}<br><br>Is such a transformation best done as a (target-specific) DAG combine?<br><br>A similar instcombine already exists for the X/C->X*1/C case (see the CvtFDivConstToReciprocal function in InstCombineMlDivRem.cpp), but I don't believe the above can be done as an instcombine as it creates a new instruction (in addition to replacing the original).  Also, I only want to perform the transformation if there are multiple uses of 1/Y (like in my test case).  Otherwise, the transformation replaces a fdiv with a fdiv+fmul pair, which I doubt would be profitable.<br>
<br>FWIW, I'm also pretty sure this combine requires -fast-math.<br><br>Can someone point me in the right direction?<br><br> Thanks,<br>  Chad<br>