Does OpenCL compiler attempts to conduct private variables optimization?

Lets say there are two private variables A and B. A is used only in lines 3-9 and B only in lines 10-23, so there is no overlapping. This means that compiler can use only A without declaring B and allocating it extra memory, by simply substituting B with A.

Is there such thing? (if yes - what about loops?)...

Thank you!