Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • Correct me if I am wrong, but a typical CPU like Intel Core i5 has about 1.5K to use as cache for micro-instructions (the instructions that are lower-level than machine/assembly instructions). The cache is about 6Kb in size. So even the case you mentioned above when pointer alias is hard to prove, the CPU will still be able to figure out the same mem address and optimize to use registers. Of course, if the variables are too far apart in the code, the micro-instruction cache will not be enough. But then I doubt that, human can see a potential optimization that is more than 300 lines apart. Commented Aug 7, 2014 at 13:52
  • I suspect it will turn into a successful load from cache in that case, which still isn't the same as direct access to the register file. And a function call which is semantically guaranteed not to write to an argument (which probably should be marked const, but isn't) can easily be both too big for that icache, and trivial for a programmer to reason about. Commented Aug 7, 2014 at 13:57
  • You might be right, this might be loaded only from cache. I am reading more into this, it has been a while. Wikipage seems to contain lot of info that I have misread. Commented Aug 7, 2014 at 19:16