[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)
commit8307bc407b55300393d402162bad90c487766f1f
tree9660e5ebc96f79f51a76a7428662b3ceb514ed01
parent2c38b7fd8b334995036ce3ec3e38c177e171affc
[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.

llvm-svn: 336215
llvm/lib/IR/Constants.cpp
llvm/test/Transforms/InstCombine/shuffle_select.ll
llvm/test/Transforms/Reassociate/binop-identity.ll
llvm/test/Transforms/Reassociate/reassoc-intermediate-fnegs.ll