[llvm] [GlobalISel] Insert bitcast instead of register replacement when types don't match. (PR #177397)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 28 06:52:30 PST 2026
================
@@ -851,10 +851,58 @@ def unmerge_merge : GICombineRule<
// Fold merge(unmerge).
def merge_unmerge : GICombineRule<
- (defs root:$d, register_matchinfo:$matchinfo),
- (match (wip_match_opcode G_MERGE_VALUES):$d,
- [{ return Helper.matchCombineMergeUnmerge(*${d}, ${matchinfo}); }]),
- (apply [{ Helper.replaceSingleDefInstWithReg(*${d}, ${matchinfo}); }])
+ (defs root:$dst, register_matchinfo:$src),
+ (match (G_MERGE_VALUES $dst, GIVariadic<1>:$merge_srcs):$merge,
+ [{
+ assert(!${merge_srcs}.empty() && "GIVariadic<1> should guarantee non-empty.");
----------------
arsenm wrote:
I hope the machine verifier also disallows this
https://github.com/llvm/llvm-project/pull/177397
More information about the llvm-commits
mailing list