[PATCH] D19087: [x86] prefer comparisons against zero for and+cmp sequences

Kevin B. Smith via llvm-commits llvm-commits at lists.llvm.org
Fri May 6 09:09:21 PDT 2016


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

In http://reviews.llvm.org/D19087#423496, @spatel wrote:

> In http://reviews.llvm.org/D19087#422972, @kbsmith1 wrote:
>
> > Did you add tests to check that lt/gt conditions don't get transformed?
>
>
> Oops - let me add those and update the patch. The EQ/NE check is hopefully more obvious in the code now.


Thank you for adding those tests now, and yes the EQ/NE check was much more obvious when I read it this time.  Thank you.


================
Comment at: lib/CodeGen/SelectionDAG/TargetLowering.cpp:1336
@@ +1335,3 @@
+  auto *YConst = dyn_cast<ConstantSDNode>(Y);
+  if (YConst && YConst->isNullValue())
+    return SDValue();
----------------
I agree with your reasoning on breaking it out into this separate function.  I think that greatly enhanced the readability.  Thank you also for changing this to not be an assertion.  I think that makes the code less fragile for the future.


http://reviews.llvm.org/D19087





More information about the llvm-commits mailing list