[PATCH] D44909: [DAGCombine] (float)((int) f) --> ftrunc (PR36617)

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 12 09:52:26 PDT 2018


efriedma added a comment.

> Or, in portable C, you can do a range check: `if (x <= INT_MAX && x >= INT_MIN && (double)(int)x == x)`.

Sorry, the bounds on this aren't precisely correct; you want something more like `if (x < INT_MAX+1LL && x >= INT_MIN-1LL && (double)(int)x == x)`.  And note this depends on the fact that `INT_MIN-1LL` can be exactly represented as a double.


Repository:
  rL LLVM

https://reviews.llvm.org/D44909





More information about the llvm-commits mailing list