OSDN Git Service

[Constants] add identity constants for fadd/fmul
authorSanjay Patel <spatel@rotateright.com>
Tue, 3 Jul 2018 17:12:59 +0000 (17:12 +0000)
committerSanjay Patel <spatel@rotateright.com>
Tue, 3 Jul 2018 17:12:59 +0000 (17:12 +0000)
commitd841b7b37d2b7df86f4c575a0bd1b255e9285e80
treeae5169ec0c0c1840491885d4777e99e50f61c9b8
parentef3144ea3854b53983f5c0effabf873fb89cff1d
[Constants] add identity constants for fadd/fmul

As the test diffs show, the current users of getBinOpIdentity()
are InstCombine and Reassociate. SLP vectorizer is a candidate
for using this functionality too (D28907).

The InstCombine shuffle improvements are part of the planned
enhancements noted in D48830.

InstCombine actually has several other uses of getBinOpIdentity()
via SimplifyUsingDistributiveLaws(), but we don't call that for
any FP ops. Fixing that might be another part of removing the
custom reassociation in InstCombine that is only done for fadd+fmul.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336215 91177308-0d34-0410-b5e6-96231b3b80d8
lib/IR/Constants.cpp
test/Transforms/InstCombine/shuffle_select.ll
test/Transforms/Reassociate/binop-identity.ll
test/Transforms/Reassociate/reassoc-intermediate-fnegs.ll