<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Hi Owen,</div><div><br></div>New patch attached.<div><br></div><div>The new patch now check if a bitcast is expected to be expensive or not. I.e., it adds in canMergeExpensiveCrossRegisterBankCopy the following check:</div><div><div>    // At this point, we know that we perform a cross-register-bank copy.</div><div>    // Check if it is expensive.</div><div>    const TargetRegisterInfo *TRI = TLI.getTargetMachine().getRegisterInfo();</div><div>    // Assume bitcasts are cheap, unless both register classes do not</div><div>    // explicitly share a common sub class.</div><div>    if (!TRI || TRI->getCommonSubClass(ArgRC, ResRC))</div><div>      return false;</div><div><br></div><div>Instead of doing this, I can add a target hook that tells how expensive it is (or is it expensive) to bitcast from both register classes.</div><div>I did not go into that direction, because I was afraid that we will push for more cost modeling in target lowering if we do that. Indeed, if we do give a cost, instead of the proposed heuristic or instead of a "is expensive” target hook, we will have to add the cost of loads so that the cost model makes sense.</div><div><br></div><div>Anyway, does the cost model make more sense with the modification and my previous explanations?</div><div><br></div><div>Like I said to Chandler, I am fine with changing the cost model, but other than providing more accurate numbers via more target hooks, I did not find anything that meaningful.</div><div>Do you have any suggestions on that side?</div><div><br></div><div>Thanks!</div><div apple-content-edited="true"><div style="orphans: 2; text-align: -webkit-auto; widows: 2; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">-Quentin</div><div style="orphans: 2; text-align: -webkit-auto; widows: 2; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"></div></div></div></body></html>