[PATCH] D107883: [DAGCombiner] Teach isKnownToBeAPowerOfTwo handle SPLAT_VECTOR.

Fraser Cormack via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 12 01:56:20 PDT 2021


frasercrmck added a comment.

Now that the scope of this has increased, I think we should try and add scalable-vector tests for all of the DAGCombines which use `isKnownToBeAPowerOfTwo`.



================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:3654
+      return C->getAPIntValue().zextOrTrunc(BitWidth).isPowerOf2();
+  return false;
+
----------------
This `return false` isn't doing the right thing and is skipping the `computeKnownBits` stuff below. I'm surprised the tests are still passing! Are we missing coverage?

I think this should simply be `if (C->getAPIntValue().zextOrTrunc(BitWidth).isPowerOf2()) return true`, allowing it to fall through to the next checks.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107883/new/

https://reviews.llvm.org/D107883



More information about the llvm-commits mailing list