[PATCH] D129290: [DAG] SimplifyDemandedBits - fold AND(INSERT_SUBVECTOR(C,X,I),M) -> INSERT_SUBVECTOR(AND(C,M),X,I)

Amaury SECHET via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 8 05:34:43 PDT 2022


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

This seems like a good transform. I have a bit of a concern, but it doesn't seems to materialize any problem in the test suite so, while worth keeping in mind, it doesn't look like it is worth blocking this for.



================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1366
+    // AND(INSERT_SUBVECTOR(C,X,I),M) -> INSERT_SUBVECTOR(AND(C,M),X,I)
+    // iff AND(X,M) == X (for DemandedBits).
+    if (Op0.getOpcode() == ISD::INSERT_SUBVECTOR &&
----------------
This sound like a reasonable transform, however, that might push an and in the middle of an `INSERT_SUBVECTOR` chain. Won't that be a problem?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129290



More information about the llvm-commits mailing list