[PATCH] D29587: [DAGCombiner] mulhi + 1 never overflow.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 6 12:19:31 PST 2017


efriedma added a comment.

Is it possible to write a testcase which isn't quite so big?



================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:2779
+  // mulhi + 1 never overflow
+  if (N0.getOpcode() == ISD::UMUL_LOHI &&
+      (~N1Zero & 0x01) == ~N1Zero)
----------------
Missing a check for which result you're using from the UMUL_LOHI.  (I think this transform is only valid for the high result.)


================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:2780
+  if (N0.getOpcode() == ISD::UMUL_LOHI &&
+      (~N1Zero & 0x01) == ~N1Zero)
+    return OFK_Never;
----------------
Could you just write this as "~N1Zero == 1"?


https://reviews.llvm.org/D29587





More information about the llvm-commits mailing list