[InstCombine] canonicalize -0.0 to +0.0 in fcmp
authorSanjay Patel <spatel@rotateright.com>
Mon, 5 Nov 2018 17:26:42 +0000 (17:26 +0000)
committerSanjay Patel <spatel@rotateright.com>
Mon, 5 Nov 2018 17:26:42 +0000 (17:26 +0000)
commitc26fd1e77258d2a1ebeff25638636291ac64671a
treea83e71fd2c85d27a7e54095d1922ca8e8f08b944
parentc50240dac133451b3eae5b89cecca4c1c4af9fd4
[InstCombine] canonicalize -0.0 to +0.0 in fcmp

As stated in IEEE-754 and discussed in:
https://bugs.llvm.org/show_bug.cgi?id=38086
...the sign of zero does not affect any FP compare predicate.

Known regressions were fixed with:
rL346097 (D54001)
rL346143

The transform will help reduce pattern-matching complexity to solve:
https://bugs.llvm.org/show_bug.cgi?id=39475
...as well as improve CSE and codegen (a zero constant is almost always
easier to produce than 0x80..00).

llvm-svn: 346147
llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
llvm/test/Transforms/InstCombine/fcmp-special.ll
llvm/test/Transforms/InstCombine/fcmp.ll
llvm/test/Transforms/InstCombine/minmax-fp.ll
llvm/test/Transforms/InstCombine/select-binop-cmp.ll