[PATCH] D159198: [DAG] Fold (shl (ext (add x, c1)), c2) -> (add (shl (ext x), c2), c1 << c2)

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 30 19:27:42 PDT 2023


goldstein.w.n added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:9930-9931
 
+  // fold (shl (sext (add_nsw x, c1)), c2) -> (add (shl (sext x), c2), c1 << c2)
+  // fold (shl (zext (add_nuw x, c1)), c2) -> (add (shl (zext x), c2), c1 << c2)
+  if ((N0.getOpcode() == ISD::SIGN_EXTEND ||
----------------
pengfei wrote:
> Do we need to consider the possibility of overflow when `c1 << c2`?
Shouldnt need to, the proof stands even with


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159198



More information about the llvm-commits mailing list