06.08.2013 Views

Threads in the new ISO C Standard from 2011

Threads in the new ISO C Standard from 2011

Threads in the new ISO C Standard from 2011

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Constant Propagation Example 2(3)<br />

There is now no dependence between <strong>the</strong> two statements!<br />

i = atomic_load(q, memory_order_consume);<br />

a = *b;<br />

Without a dependence <strong>the</strong> reads are not ordered.<br />

This is not what <strong>the</strong> programmer expected!!!<br />

Therefore, optimiz<strong>in</strong>g C compilers must analyse all dependences<br />

before any code transformation and preserve <strong>the</strong>m.<br />

What does ”preserve” mean, <strong>the</strong>n?<br />

Jonas Skeppstedt (js@cs.lth.se) Lecture 6 2013 43 / 70

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!