[InstCombine] allow sin/cos transforms with 'reassoc'
authorSanjay Patel <spatel@rotateright.com>
Thu, 15 Feb 2018 15:07:12 +0000 (15:07 +0000)
committerSanjay Patel <spatel@rotateright.com>
Thu, 15 Feb 2018 15:07:12 +0000 (15:07 +0000)
commit339b4d338da3d76a064d6c4263c5791b3dd68fcb
tree64b7a78f84fd5d44ae3fd7e63e33becd399f3e8d
parent62b0c5bb880754230440dcdfcf193aa6aa217b8a
[InstCombine] allow sin/cos transforms with 'reassoc'

The variable name 'AllowReassociate' is a lie at this point because
it's set to 'isFast()' which is more than the 'reassoc' FMF after
rL317488.

In D41286, we showed that this transform may be valid even with strict
math by brute force checking every 32-bit float result.

There's a potential problem here because we're replacing with a tan()
libcall rather than a hypothetical LLVM tan intrinsic. So we might
set errno when we should be guaranteed not to do that. But that's
independent of this change.

llvm-svn: 325247
llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
llvm/test/Transforms/InstCombine/fdiv-cos-sin.ll
llvm/test/Transforms/InstCombine/fdiv-sin-cos.ll