[PATCH] D61544: Add FNeg IR constant folding
Cameron McInally via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 3 17:07:48 PDT 2019
cameron.mcinally created this revision.
cameron.mcinally added reviewers: spatel, arsenm, kpn, andrew.w.kaylor.
Herald added subscribers: llvm-commits, hiraditya, wdng.
Herald added a project: LLVM.
Here's another subset of D61419 <https://reviews.llvm.org/D61419>. This patch contains the FNeg IR constant folding changes and some code in Analysis so that InstCombine can make use of it.
There are only two folds being performed right now:
fneg undef -> undef
fneg C -> -C
New tests for those 2 folds have been added to the existing InstCombine fneg.ll tests (which are all fsub(-0.0, X) tests right now).
In addition to the new tests, there are quite a few existing tests in place that used to operate on fsub(-0.0, X), so coverage is pretty good. If you'd like to convince yourself of this, you can comment out the call to `ConstantFoldUnaryInstruction(...)` in `lib/IR/Constants.cpp`.
Repository:
rL LLVM
https://reviews.llvm.org/D61544
Files:
llvm/include/llvm/Analysis/ConstantFolding.h
llvm/lib/Analysis/ConstantFolding.cpp
llvm/lib/IR/ConstantFold.cpp
llvm/lib/IR/ConstantFold.h
llvm/lib/IR/Constants.cpp
llvm/test/Transforms/InstCombine/fneg.ll
llvm/test/Transforms/InstCombine/fsub.ll
llvm/test/Transforms/InstCombine/inselt-binop.ll
llvm/test/Transforms/Reassociate/crash2.ll
llvm/unittests/IR/ConstantsTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61544.198112.patch
Type: text/x-patch
Size: 12777 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190504/914b0e35/attachment.bin>
More information about the llvm-commits
mailing list