How would the LHS be fixed in this code?
First, where does the LHS occur? I’m guessing it’s in the else if by reading s.r a second time.
From what I’ve been reading about LHS I believe that adding a local would fix it:
float radius = s.r;
if( d <= -radius )
...
else if( d >= radius)
...
But since <= is a function what prevents <= or any other function that takes the local as a reference from modifying it?
It doesn’t, look at the next slide. It causes a pipeline flush. There’s also a good chance there will be a branch misprediction.