[PATCH] SelectionDAG: mimic InstCombine when comparing to undef

hfinkel at anl.gov hfinkel at anl.gov
Thu Feb 12 21:25:53 PST 2015


> I haven't put a test yet, and it breaks the validation, but before fixing this I seek opinion on NaN handling here. InstCombine does not care and I don't really see why the same IR would be handled differently in the DAG than in InstCombine.


I don't know either, but that sounds wrong. This depends on the predicate, I think, for fcmp, but NaN != NaN (or anything else), and so we can't arbitrarily fold fcmp pred x, undef to true unless we know that x cannot be NaN (or we're generically allowing unsafe floating-point transformations).


REPOSITORY
  rL LLVM

================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1924
@@ +1923,3 @@
+  // Do the same here
+  if (N1 == N2 || N1.getOpcode() == ISD::UNDEF || N1.getOpcode() == ISD::UNDEF)
+    return getConstant(isTrueWhenEqual(Cond), VT);
----------------
Is the third check supposed to be N2?

http://reviews.llvm.org/D7602

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list