[llvm] [GlobalISel] Migrate remaining generic wip_match_opcode combines to MIR-pattern. (PR #222851)
Yaxun Liu via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 11 07:16:29 PDT 2026
================
@@ -619,15 +655,26 @@ def select_constant_cmp_true : GICombineRule<
(apply (GIReplaceReg $dst, $tval))
>;
-def select_constant_cmp_general: GICombineRule<
- (defs root:$root, unsigned_matchinfo:$matchinfo),
+def select_constant_cmp_general_false: GICombineRule<
+ (defs root:$dst),
(match (G_SELECT $dst, $cond, $tval, $fval):$root,
- [{ return Helper.matchConstantSelectCmp(*${root}, ${matchinfo}); }]),
- (apply [{ Helper.replaceSingleDefInstWithOperand(*${root}, ${matchinfo}); }])
->;
+ [{
+ auto C = isConstantOrConstantSplatVector(${cond}.getReg(), MRI);
+ return C && C->isZero();
+ }]),
+ (apply (COPY $dst, $fval))>;
----------------
yxsamliu wrote:
The old combine replaced the destination directly. Could these two rules use `GIReplaceReg` instead of creating a `COPY`, like the nearby constant-select rules?
https://github.com/llvm/llvm-project/pull/222851
More information about the llvm-commits
mailing list