Skip to content

Commit a6be267

Browse files
committed
[GlobalISel] Make more use of replaceSingleDefInstWithReg. NFC.
1 parent 0ac42fd commit a6be267

File tree

2 files changed

+2
-18
lines changed

2 files changed

+2
-18
lines changed

llvm/include/llvm/Target/GlobalISel/Combine.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ def anyext_trunc_fold: GICombineRule <
424424
(defs root:$root, anyext_trunc_fold_matchinfo:$matchinfo),
425425
(match (wip_match_opcode G_ANYEXT):$root,
426426
[{ return Helper.matchCombineAnyExtTrunc(*${root}, ${matchinfo}); }]),
427-
(apply [{ return Helper.applyCombineAnyExtTrunc(*${root}, ${matchinfo}); }])
427+
(apply [{ return Helper.replaceSingleDefInstWithReg(*${root}, ${matchinfo}); }])
428428
>;
429429

430430
// Fold ([asz]ext ([asz]ext x)) -> ([asz]ext x).
@@ -468,7 +468,7 @@ def fabs_fabs_fold: GICombineRule<
468468
(defs root:$root, fabs_fabs_fold_matchinfo:$matchinfo),
469469
(match (wip_match_opcode G_FABS):$root,
470470
[{ return Helper.matchCombineFAbsOfFAbs(*${root}, ${matchinfo}); }]),
471-
(apply [{ return Helper.applyCombineFAbsOfFAbs(*${root}, ${matchinfo}); }])
471+
(apply [{ return Helper.replaceSingleDefInstWithReg(*${root}, ${matchinfo}); }])
472472
>;
473473

474474
// Fold (unmerge cst) -> cst1, cst2, ...

llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2295,14 +2295,6 @@ bool CombinerHelper::matchCombineAnyExtTrunc(MachineInstr &MI, Register &Reg) {
22952295
m_GTrunc(m_all_of(m_Reg(Reg), m_SpecificType(DstTy))));
22962296
}
22972297

2298-
bool CombinerHelper::applyCombineAnyExtTrunc(MachineInstr &MI, Register &Reg) {
2299-
assert(MI.getOpcode() == TargetOpcode::G_ANYEXT && "Expected a G_ANYEXT");
2300-
Register DstReg = MI.getOperand(0).getReg();
2301-
MI.eraseFromParent();
2302-
replaceRegWith(MRI, DstReg, Reg);
2303-
return true;
2304-
}
2305-
23062298
bool CombinerHelper::matchCombineExtOfExt(
23072299
MachineInstr &MI, std::tuple<Register, unsigned> &MatchInfo) {
23082300
assert((MI.getOpcode() == TargetOpcode::G_ANYEXT ||
@@ -2384,14 +2376,6 @@ bool CombinerHelper::matchCombineFAbsOfFAbs(MachineInstr &MI, Register &Src) {
23842376
return mi_match(Src, MRI, m_GFabs(m_Reg(AbsSrc)));
23852377
}
23862378

2387-
bool CombinerHelper::applyCombineFAbsOfFAbs(MachineInstr &MI, Register &Src) {
2388-
assert(MI.getOpcode() == TargetOpcode::G_FABS && "Expected a G_FABS");
2389-
Register Dst = MI.getOperand(0).getReg();
2390-
MI.eraseFromParent();
2391-
replaceRegWith(MRI, Dst, Src);
2392-
return true;
2393-
}
2394-
23952379
bool CombinerHelper::matchCombineTruncOfExt(
23962380
MachineInstr &MI, std::pair<Register, unsigned> &MatchInfo) {
23972381
assert(MI.getOpcode() == TargetOpcode::G_TRUNC && "Expected a G_TRUNC");

0 commit comments

Comments
 (0)