[llvm] [GISel] Combine out-of-range shifts with value to 0 or -1 (PR #123510)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 20 02:28:07 PST 2025


================
@@ -306,11 +306,18 @@ def ptr_add_immed_chain : GICombineRule<
          [{ return Helper.matchPtrAddImmedChain(*${d}, ${matchinfo}); }]),
   (apply [{ Helper.applyPtrAddImmedChain(*${d}, ${matchinfo}); }])>;
 
+def shift_result_matchdata : GIDefMatchData<"std::optional<int64_t>">;
 def shifts_too_big : GICombineRule<
-  (defs root:$root),
+  (defs root:$root, shift_result_matchdata:$matchinfo),
   (match (wip_match_opcode G_SHL, G_ASHR, G_LSHR):$root,
----------------
lialan wrote:

Done.

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


More information about the llvm-commits mailing list