<div dir="ltr">On 25 March 2013 16:20, Stepan Dyatkovskiy <span dir="ltr"><<a href="mailto:stpworld@narod.ru" target="_blank">stpworld@narod.ru</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hello Jiangning,<br>
The main reason I did it, is that we need to analyze contents of MemOps *each time* we modify it: we need to prevent more than one "load" operations into the same place.<br></blockquote><div><br></div><div style>
Hi Stepan,</div><div style><br></div><div style>I like the idea of inspecting it on every load, but the current patch is very inefficient.</div><div style><br></div><div style>On:<br></div><div style><br></div><div>+    SmallVector<unsigned, 4> getElementaries(unsigned Reg) {<br>
</div><div><br></div><div style>You create the small vector on *every* call. This is really bad. And then you iterate and compare every register of the new operations with every register of every other operation so far. That's far from optimal. This is why STL sorts and creates new sets, etc.</div>
<div style><br></div><div style>If I get correctly you don't need a list of memory ops and their respective registers, but the opposite, since you're looking for registers, not memory ops.</div><div style><br></div>
<div style>So, instead of keeping a list of operations and querying their registers *every single time*, you can keep a list of registers "in use" with a pointer to a small vector with the memory operations that use that register.</div>
<div style><br></div><div style>That will give you near constant time query over all registers in use and you'll only have to gather the registers (via getElementaries) once per operation.</div><div style><br></div><div style>
The rest looks ok, the encapsulation of MemOps into MemOpsTrckr seems to work (wrt push_back/insert).</div><div style><br></div><div style>Would also be good to have the IR in the PR bug as a test, just to make sure the objective was met and to have a history on what this patch is fixing.</div>
<div style><br></div><div style>Thanks,</div><div style>--renato</div></div></div></div>