[PATCH] D51942: [InstCombine] Fold (C/x)>0 into x>0 if possible

Martin Elshuber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 27 06:36:56 PDT 2018


marels updated this revision to Diff 167307.
marels added a comment.

Fixed according to comments from @spatel

1. Adjusted introduction comment. I left a short proof there, because i think it is necessary to show why the preconditions are required.
2. Fixed autos
3. Fixed Tests
4. Changed commit message to:

  [InstCombine] Without infinites, fold (C / X) < 0.0 --> (X < 0)

  When C is not zero and infinites are not allowed (C / X) > 0 is a sign test. Depending on the sign of C, the predicate must be swapped.

  E.g.: foo(double X) { if ((-2.0 / X) <= 0) ... } => foo(double X) { if (X >= 0) ... }


https://reviews.llvm.org/D51942

Files:
  lib/Transforms/InstCombine/InstCombineCompares.cpp
  lib/Transforms/InstCombine/InstCombineInternal.h
  test/Transforms/InstCombine/fcmp.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51942.167307.patch
Type: text/x-patch
Size: 6667 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180927/5ed762b8/attachment.bin>


More information about the llvm-commits mailing list