diff options
author | Sanjay Patel <spatel@rotateright.com> | 2016-01-11 22:50:36 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2016-01-11 22:50:36 +0000 |
commit | 6c1ddbb7b6ee3788419878fc7ab49fd30124b57b (patch) | |
tree | de4bdf3219a55ccf2614a6e7072d029604369368 /llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp | |
parent | 38c202e97e51de7d4f2b523e15fa56c8c1a494cd (diff) | |
download | bcm5719-llvm-6c1ddbb7b6ee3788419878fc7ab49fd30124b57b.tar.gz bcm5719-llvm-6c1ddbb7b6ee3788419878fc7ab49fd30124b57b.zip |
[LibCallSimplifier] don't allow sqrt transform unless all ops are unsafe
Fix the FIXME added with:
http://reviews.llvm.org/rL257400
llvm-svn: 257404
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp index ed7ad7a6d2d..ef700499ef2 100644 --- a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp @@ -1422,10 +1422,10 @@ Value *LibCallSimplifier::optimizeSqrt(CallInst *CI, IRBuilder<> &B) { // variations of this pattern because instcombine's visitFMUL and/or the // reassociation pass should give us this form. Value *OtherMul0, *OtherMul1; - // FIXME: This multiply must be unsafe to allow this transform. if (match(Op0, m_FMul(m_Value(OtherMul0), m_Value(OtherMul1)))) { // Pattern: sqrt((x * y) * z) - if (OtherMul0 == OtherMul1) { + if (OtherMul0 == OtherMul1 && + cast<Instruction>(Op0)->hasUnsafeAlgebra()) { // Matched: sqrt((x * x) * z) RepeatOp = OtherMul0; OtherOp = Op1; |