[llvm] [GlobalISel] Fold instructions with fully-known bits to a constant. (PR #224254)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 21 03:32:52 PDT 2026


================
@@ -1005,6 +1005,14 @@ def overlapping_and: GICombineRule <
   (apply [{ Helper.applyBuildFn(*${root}, ${info}); }])
 >;
 
+// Fold a fully-known result to its constant (SelectionDAG's SimplifyDemandedBits
+// "all bits known -> constant" shortcut).
+def known_bits_to_constant : GICombineRule<
+  (defs root:$root, apint_matchinfo:$matchinfo),
+  (match (wip_match_opcode G_AND, G_OR, G_ZEXT, G_SEXT, G_TRUNC):$root,
----------------
arsenm wrote:

Shouldn't introduce new uses of wip_match_opcode

https://github.com/llvm/llvm-project/pull/224254


More information about the llvm-commits mailing list