<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi,<div><br></div><div>Here is the new patch.</div><div>The optimization is now done as part of DAG combine.</div><div><br></div><div>The patch looks pretty much the same as its InstCombine counter part (SDNode, instead of Instruction) except that it introduces a new profitability model.</div><div>Hence, when the transformation was done as InstCombine the idea  was to perform cannonicalization. Now, this is an optimization.</div><div><br></div><div>For this purpose, the patch introduces a cost model (represented by the helper class LoadedSlice::Cost), which accounts for the instructions that are saved by slicing a load compared to the original big load.</div><div>It also introduces a new target hook, to query about load pairing capabilities (type and required alignment).</div><div>Basically, this cost model counts how many truncates, shifts, etc, are saved with slicing compared to the number of introduced loads.</div><div>It takes advantages of information like isTruncateFree, etc.</div><div><br></div><div>Currently the cost model is used in a very specific case: only two slices that are next to each other in memory.</div><div>This limitation can be lifted as soon as we consider the cost model mature enough and when machine passes that deal with load pairing manage to handle more slices.</div><div><br></div><div>Thanks for your reviews!</div><div><br></div><div>-Quentin</div><div></div></body></html>