This is an archive of the discontinued LLVM Phabricator instance.

[LibCallSimplifier] don't get fooled by a fake sqrt()
ClosedPublic

Authored by spatel on Jan 14 2016, 10:10 AM.

Details

Summary

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.

Diff Detail

Repository
rL LLVM

Event Timeline

spatel updated this revision to Diff 44898.Jan 14 2016, 10:10 AM
spatel retitled this revision from to [LibCallSimplifier] don't get fooled by a fake sqrt().
spatel updated this object.
spatel added reviewers: joerg, majnemer, davide.
spatel added a subscriber: llvm-commits.
This revision was automatically updated to reflect the committed changes.