[PATCH] D60021: InstSimplify: Fold round intrinsics from sitofp

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 2 05:51:35 PDT 2019


spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.

LGTM - see inline comment (would be good to include something like that in the commit message too, so people not following this review see the explanation that we discussed here).



================
Comment at: lib/Analysis/InstructionSimplify.cpp:4710-4711
+  case Intrinsic::rint: {
+    // floor (sitofp x) -> sitofp x
+    // floor (uitofp x) -> uitofp x
+    if (match(Op0, m_SIToFP(m_Value())) || match(Op0, m_UIToFP(m_Value())))
----------------
It would be nice to have a comment here summarizing why this is legal, so something like

```
 // Converting from int always results in a finite integral number or
 // infinity. For either of those inputs, these rounding functions 
 // always return the same value, so the rounding can be eliminated. 
```


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60021/new/

https://reviews.llvm.org/D60021





More information about the llvm-commits mailing list