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

Kevin B. Smith via llvm-commits llvm-commits at lists.llvm.org
Thu May 5 15:37:51 PDT 2016


kbsmith1 added a comment.

Did you add tests to check that lt/gt conditions don't get transformed?


================
Comment at: lib/CodeGen/SelectionDAG/TargetLowering.cpp:1336
@@ +1335,3 @@
+  // x86 or 'rlwinm' on PPC).
+  assert(!valueHasExactlyOneBitSet(Y, DAG) &&
+         "Expected a value with one bit set to already be transformed");
----------------
Although this might be your expectation, I don't think it should be an assertion.  I think it should be
if (!valueHasExactlyOneBitSet(Y, DAG))
  return SDVALUE();

Using an assertion could cause a compiler internal error during a compilation.  There is a safe and correct return by using SDValue(), and this code shouldn't really need to know whether the transform for bit test should happen before or after it.


http://reviews.llvm.org/D19087





More information about the llvm-commits mailing list