3 ms·
The only forbidden optimization I could come up with is: x = load-relaxed(a) ... f(x) cannot be turned into x0 = load-relaxed(a) ...
by CodesInChaos 7y ago
The only forbidden optimization I could come up with is:
x = load-relaxed(a)
...
f(x)
cannot be turned into
x0 = load-relaxed(a)
...
x1 = load-relaxed(a)
f(x1)
while this would be possible with normal memory access.
so under register pressure the compiler would be required to spill something onto the stack instead of just reloading `x` from the original location.
- carllerche 7y agoLast time I spoke about this topic w/ the rust compiler devs, they mentioned there were some LLVM "bugs" with regards to optimizations and Relaxed, as in LLVM is too conservative.