<s>
A	O
Load-Hit-Store	B-Operating_System
,	O
sometimes	O
abbreviated	O
as	O
LHS	O
,	O
is	O
a	O
data	O
dependency	O
in	O
a	O
CPU	B-Device
in	O
which	O
a	O
memory	B-Architecture
location	O
that	O
has	O
just	O
been	O
the	O
target	O
of	O
a	O
store	O
operation	O
is	O
loaded	O
from	O
.	O
</s>
<s>
The	O
CPU	B-Device
may	O
then	O
need	O
to	O
wait	O
until	O
the	O
store	O
finishes	O
,	O
so	O
that	O
the	O
correct	O
value	O
can	O
be	O
retrieved	O
.	O
</s>
<s>
a	O
L1	O
cache	O
roundtrip	O
,	O
during	O
which	O
most	O
or	O
all	O
of	O
the	O
pipeline	B-General_Concept
will	O
be	O
stalled	O
,	O
causing	O
a	O
significant	O
decrease	O
in	O
performance	O
.	O
</s>
<s>
Here	O
,	O
the	O
language	O
rules	O
do	O
not	O
allow	O
the	O
compiler	B-Language
to	O
assume	O
that	O
the	O
pointers	O
a	O
and	O
b	O
refer	O
to	O
different	O
memory	B-Architecture
locations	O
.	O
</s>
<s>
Therefore	O
,	O
it	O
cannot	O
,	O
in	O
general	O
,	O
keep	O
the	O
stored	O
values	O
in	O
a	O
register	O
for	O
the	O
final	O
addition	O
(	O
or	O
,	O
in	O
this	O
simple	O
example	O
,	O
precalculate	O
the	O
return	O
value	O
to	O
12	O
)	O
,	O
but	O
instead	O
has	O
to	O
emit	O
code	O
that	O
reloads	O
at	O
least	O
the	O
value	O
from	O
the	O
first	O
memory	B-Architecture
location	O
,	O
*	O
a	O
.	O
</s>
<s>
The	O
only	O
realistic	O
alternatives	O
are	O
a	O
test-and-branch	B-General_Concept
to	O
see	O
whether	O
a	O
and	O
b	O
are	O
equal	O
,	O
in	O
which	O
case	O
the	O
correct	O
return	O
value	O
is	O
14	O
,	O
but	O
this	O
adds	O
significant	O
overhead	O
if	O
the	O
pointers	O
are	O
not	O
equal	O
,	O
and	O
optimizations	O
enabled	O
by	O
function	O
inlining	O
.	O
</s>
<s>
Now	O
if	O
a	O
call	O
to	O
slow	O
is	O
made	O
with	O
the	O
same	O
address	O
for	O
a	O
and	O
b	O
,	O
there	O
is	O
a	O
data	O
dependency	O
between	O
the	O
memory	B-Architecture
stores	O
and	O
the	O
memory	B-Architecture
load(s )	O
in	O
the	O
final	O
statement	O
of	O
slow	O
.	O
</s>
<s>
Some	O
CPU	B-Device
designs	O
(	O
like	O
general	O
purpose	O
processors	O
for	O
desktop	O
or	O
notebook	O
computers	O
)	O
dedicate	O
a	O
significant	O
amount	O
of	O
die	O
space	O
to	O
complex	O
store-to-load	O
forwarding	O
,	O
which	O
,	O
under	O
suitable	O
circumstances	O
such	O
as	O
native	O
alignment	B-Application
of	O
the	O
operands	O
,	O
can	O
avert	O
having	O
to	O
wait	O
for	O
the	O
cache	O
roundtrip	O
.	O
</s>
<s>
Other	O
CPUs	B-Device
(	O
e.g.	O
</s>
<s>
for	O
embedded	O
devices	O
or	O
video	B-Device
game	I-Device
consoles	I-Device
)	O
may	O
use	O
a	O
less	O
elaborate	O
or	O
even	O
minimalistic	O
approach	O
,	O
and	O
rely	O
on	O
the	O
software	O
developer	O
to	O
avoid	O
frequent	O
load-hit-stores	B-Operating_System
in	O
performance-critical	O
code	O
,	O
or	O
remove	O
them	O
during	O
performance	O
optimization	O
.	O
</s>
<s>
In	O
the	O
minimalistic	O
approach	O
,	O
a	O
store-to-load	O
dependency	O
forces	O
a	O
flush	O
of	O
the	O
store	O
buffers	O
and	O
stalling	O
the	O
pipeline	B-General_Concept
.	O
</s>
