[PATCH] D50582: ValueTracking: Handle more instructions in isKnownNeverNaN

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 12 14:47:15 PDT 2018


spatel added inline comments.


================
Comment at: lib/Analysis/ValueTracking.cpp:2921-2923
   // TODO: Handle instructions and potentially recurse like other 'isKnown'
   // functions. For example, the result of sitofp is never NaN.
 
----------------
Remove stale comment.


================
Comment at: lib/Analysis/ValueTracking.cpp:2933-2937
+    case Instruction::FAdd:
+    case Instruction::FMul:
+    case Instruction::FSub: {
+      return isKnownNeverNaN(Inst->getOperand(0), TLI, Depth + 1) &&
+             isKnownNeverNaN(Inst->getOperand(1), TLI, Depth + 1);
----------------
Why are these not the same as fdiv/frem? I think we need to account for inf math that produces nan with these operators:
inf + -inf = nan
inf - inf = nan
0.0 * inf = nan



https://reviews.llvm.org/D50582





More information about the llvm-commits mailing list