<div dir="ltr">Dear All,<div><br></div><div>The <span class="" id=":2a4.1" tabindex="-1" style="">InstCombine</span> pass performs the following transformation.</div><div><br></div><div> Z / (X / Y) => (Y * Z) / X<br></div><div><br></div><div>This is performed only when operand Op1 ( (X/Y) in this case) has only one use in future. The code snippet is shown below.</div><div><br></div><div> if (match(Op1, m_<span class="" id=":2a4.2" tabindex="-1" style="">OneUse</span>(m_<span class="" id=":2a4.3" tabindex="-1" style="">FDiv</span>(m_Value(X), m_Value(Y)))) &&<br> (!<span class="" id=":2a4.4" tabindex="-1" style="">isa</span><Constant>(Y) || !<span class="" id=":2a4.5" tabindex="-1" style="">isa</span><Constant>(Op0))) {<br> // Z / (X / Y) => (Y * Z) / X<br> Value *<span class="" id=":2a4.6" tabindex="-1" style="">YZ</span> = Builder.<span class="" id=":2a4.7" tabindex="-1" style="">CreateFMulFMF</span>(Y, Op0, &I);<br> return <span class="" id=":2a4.8" tabindex="-1" style="">BinaryOperator</span>::<span class="" id=":2a4.9" tabindex="-1" style="">CreateFDivFMF</span>(<span class="" id=":2a4.10" tabindex="-1" style="">YZ</span>, X, &I);<br> }</div><div><br></div><div>It would be great if someone explains if there is any issue (correctness/performance-wise) if we avoid the m_<span class="" id=":2a4.11" tabindex="-1" style="">OueUse</span> check. What if we perform the transformation even if there are multiple uses?</div><div><br></div><div>There are similar transformations which perform the
m_<span class="" id=":2a4.12" tabindex="-1" style="">OueUse</span> check. We may avoid those too if there is no particular reason for the check.</div><div><br></div><div>Regards,<br><div><div dir="ltr" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>------------------------------</div><div><span class="" id=":2a4.13" tabindex="-1" style="">Raghesh</span> <span class="" id=":2a4.14" tabindex="-1" style="">Aloor</span></div><div><span class="" id=":2a4.15" tabindex="-1" style="">AMD</span> India Pvt. Ltd.</div><div><span class="" id=":2a4.16" tabindex="-1" style="">Bengaluru</span>.</div><div>------------------------------</div></div></div></div></div></div></div></div></div></div>