The test case will crash without this patch because the subsequent call to hasUnsafeAlgebra() assumes that the call instruction is an FPMathOperator (ie, returns an FP type).
This part of the function signature check was omitted for the sqrt() case, but seems to be in place for all other transforms.
Before:
http://reviews.llvm.org/rL257400
...I think we would have needlessly continued execution in optimizeSqrt(), but the bug was harmless because we'd eventually fail some other check and return without damage.
If this is a sufficient fix for the problem, I will push to get it included in the 3.8 branch.