[all-commits] [llvm/llvm-project] 32c999: [InstCombine] Fix errno bug in pow expansion to sqrt
Hubert Tong via All-commits
all-commits at lists.llvm.org
Tue Sep 22 16:00:11 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 32c9991dab5cb1454959561c77f9d0089d981429
https://github.com/llvm/llvm-project/commit/32c9991dab5cb1454959561c77f9d0089d981429
Author: Hubert Tong <hubert.reinterpretcast at gmail.com>
Date: 2020-09-22 (Tue, 22 Sep 2020)
Changed paths:
M llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
M llvm/test/Transforms/InstCombine/pow-1.ll
M llvm/test/Transforms/InstCombine/pow-sqrt.ll
M llvm/test/Transforms/InstCombine/win-math.ll
Log Message:
-----------
[InstCombine] Fix errno bug in pow expansion to sqrt
A conversion from `pow` to `sqrt` shall not call an `errno`-setting
`sqrt` with -//infinity//: the `sqrt` will set `EDOM` where the `pow`
call need not.
This patch avoids the erroneous (pun not intended) transformation by
applying the restrictions discussed in the thread for
https://lists.llvm.org/pipermail/llvm-dev/2020-September/145051.html.
The existing tests are updated (depending on emphasis in the checks for
library calls, avoidance of overlap, and overall coverage):
- to add `ninf`, retaining the intended library call,
- to use the intrinsic, retaining the use of `select`, or
- to expect the replacement to not occur.
The following is tested:
- The pow intrinsic folds to a `select` instruction to
handle -//infinity//.
- The pow library call folds, with `ninf`, to `sqrt` without the
`select` instruction associated with handling -//infinity//.
- The pow library call does not fold to `sqrt` without `ninf`.
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D87877
Commit: a60852e9d692e3c38d9b58b7ec1679e07af2b8f7
https://github.com/llvm/llvm-project/commit/a60852e9d692e3c38d9b58b7ec1679e07af2b8f7
Author: Hubert Tong <hubert.reinterpretcast at gmail.com>
Date: 2020-09-22 (Tue, 22 Sep 2020)
Changed paths:
M llvm/test/Transforms/InstCombine/pow-sqrt.ll
Log Message:
-----------
[InstCombine][NFC][tests] Add ninf base value case to pow-sqrt.ll
Compare: https://github.com/llvm/llvm-project/compare/d6ac649ccda2...a60852e9d692
More information about the All-commits
mailing list