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

Fraser Cormack via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 13 01:47:46 PDT 2021


frasercrmck added a comment.

Perhaps some extra tests for `mul`s by other powers of two?

Are you able to get tests for the `(mulhu x, (1 << c)) -> x >> (bitwidth - c)` combine? In my experience `mulhu` can be tricky to source. Maybe D49248 <https://reviews.llvm.org/D49248> contains some hints.



================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:3650
 
+  // Is the operand of a splat vector constant powers of two?
+  if (Val.getOpcode() == ISD::SPLAT_VECTOR)
----------------
nit: `constant powers` -> `a constant power`


================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:3656
+
+
   // More could be done here, though the above checks are enough
----------------
Clang-format's correct; please remove this extra empty line.


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