1//===-- RISCVMoveMerger.cpp - RISC-V move merge pass ----------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file contains a pass that performs move related peephole optimizations
10// as Zcmp has specified. This pass should be run after register allocation.
11//
12// This pass also supports Xqccmp, which has identical instructions.
13//
14//===----------------------------------------------------------------------===//
15
16#include "RISCV.h"
17#include "RISCVInstrInfo.h"
18#include "RISCVSubtarget.h"
19#include "llvm/CodeGen/MachineFunctionAnalysisManager.h"
20#include "llvm/CodeGen/MachineFunctionPass.h"
21#include "llvm/CodeGen/MachinePassManager.h"
22#include "llvm/IR/Analysis.h"
23#include "llvm/Pass.h"
24
25using namespace llvm;
26
27#define RISCV_MOVE_MERGE_NAME "RISC-V Zcmp move merging pass"
28
29namespace {
30class RISCVMoveMergeLegacy : public MachineFunctionPass {
31public:
32 static char ID;
33
34 RISCVMoveMergeLegacy() : MachineFunctionPass(ID) {}
35 bool runOnMachineFunction(MachineFunction &Fn) override;
36
37 StringRef getPassName() const override { return RISCV_MOVE_MERGE_NAME; }
38
39 void getAnalysisUsage(AnalysisUsage &AU) const override {
40 AU.setPreservesCFG();
41 MachineFunctionPass::getAnalysisUsage(AU);
42 }
43};
44
45class RISCVMoveMergeImpl {
46 const RISCVSubtarget *ST;
47 const RISCVInstrInfo *TII;
48 const TargetRegisterInfo *TRI;
49
50 // Track which register units have been modified and used.
51 LiveRegUnits ModifiedRegUnits, UsedRegUnits;
52
53 bool isGPRPairCopyCandidate(const DestSourcePair &RegPair, bool EvenRegPair);
54
55 bool isCandidateToMergeMVA01S(const DestSourcePair &RegPair);
56 bool isCandidateToMergeMVSA01(const DestSourcePair &RegPair);
57
58 bool isPLIPairCandidate(const MachineInstr &MI, bool EvenRegPair);
59
60 // Merge the two instructions indicated into a single pair instruction.
61 MachineBasicBlock::iterator
62 mergeGPRPairInsns(MachineBasicBlock::iterator I,
63 MachineBasicBlock::iterator Paired, bool RegPairIsEven);
64 MachineBasicBlock::iterator
65 mergePairedInsns(MachineBasicBlock::iterator I,
66 MachineBasicBlock::iterator Paired, bool MoveFromSToA);
67 MachineBasicBlock::iterator mergePLIPair(MachineBasicBlock::iterator I,
68 MachineBasicBlock::iterator Paired,
69 bool RegPairIsEven);
70
71 MachineBasicBlock::iterator
72 findMatchingGPRPairCopy(MachineBasicBlock::iterator &MBBI, bool EvenRegPair,
73 const DestSourcePair &RegPair);
74 // Look for C.MV instruction that can be combined with
75 // the given instruction into CM.MVA01S or CM.MVSA01. Return the matching
76 // instruction if one exists.
77 MachineBasicBlock::iterator
78 findMatchingSACopy(MachineBasicBlock::iterator &MBBI, bool MoveFromSToA,
79 const DestSourcePair &RegPair);
80 MachineBasicBlock::iterator findMatchingPLI(MachineBasicBlock::iterator &MBBI,
81 bool EvenRegPair);
82 bool mergeMovePairs(MachineBasicBlock &MBB);
83
84public:
85 bool runOnMachineFunction(MachineFunction &MF);
86};
87
88char RISCVMoveMergeLegacy::ID = 0;
89
90} // end of anonymous namespace
91
92INITIALIZE_PASS(RISCVMoveMergeLegacy, "riscv-move-merge", RISCV_MOVE_MERGE_NAME,
93 false, false)
94
95static unsigned getCM_MVOpcode(const RISCVSubtarget &ST, bool MoveFromSToA) {
96 if (ST.hasStdExtZcmp())
97 return MoveFromSToA ? RISCV::CM_MVA01S : RISCV::CM_MVSA01;
98
99 if (ST.hasVendorXqccmp())
100 return MoveFromSToA ? RISCV::QC_CM_MVA01S : RISCV::QC_CM_MVSA01;
101
102 llvm_unreachable("Unhandled subtarget with paired move.");
103}
104
105// Returns 0 if Opc has no paired form.
106static unsigned getPairedPLIOpcode(unsigned Opc) {
107 switch (Opc) {
108 case RISCV::PLI_B:
109 return RISCV::PLI_DB;
110 case RISCV::PLI_H:
111 return RISCV::PLI_DH;
112 case RISCV::PLUI_H:
113 return RISCV::PLUI_DH;
114 default:
115 return 0;
116 }
117}
118
119bool RISCVMoveMergeImpl::isGPRPairCopyCandidate(const DestSourcePair &RegPair,
120 bool EvenRegPair) {
121 Register Destination = RegPair.Destination->getReg();
122 Register Source = RegPair.Source->getReg();
123
124 if (Source == Destination)
125 return false;
126
127 if ((!ST->hasStdExtZdinx() && !ST->hasStdExtP()) || ST->is64Bit())
128 return false;
129
130 unsigned SubIdx = EvenRegPair ? RISCV::sub_gpr_even : RISCV::sub_gpr_odd;
131
132 Register SrcPair =
133 TRI->getMatchingSuperReg(Reg: Source, SubIdx, RC: &RISCV::GPRPairRegClass);
134 Register DestPair =
135 TRI->getMatchingSuperReg(Reg: Destination, SubIdx, RC: &RISCV::GPRPairRegClass);
136
137 return SrcPair.isValid() && DestPair.isValid();
138}
139
140// Check if registers meet CM.MVA01S constraints.
141bool RISCVMoveMergeImpl::isCandidateToMergeMVA01S(
142 const DestSourcePair &RegPair) {
143 Register Destination = RegPair.Destination->getReg();
144 Register Source = RegPair.Source->getReg();
145 // If destination is not a0 or a1.
146 if ((ST->hasStdExtZcmp() || ST->hasVendorXqccmp()) &&
147 (Destination == RISCV::X10 || Destination == RISCV::X11) &&
148 RISCV::GPRS07RegClass.contains(Reg: Source))
149 return true;
150 return false;
151}
152
153// Check if registers meet CM.MVSA01 constraints.
154bool RISCVMoveMergeImpl::isCandidateToMergeMVSA01(
155 const DestSourcePair &RegPair) {
156 Register Destination = RegPair.Destination->getReg();
157 Register Source = RegPair.Source->getReg();
158 // If Source is s0 - s7.
159 if ((ST->hasStdExtZcmp() || ST->hasVendorXqccmp()) &&
160 (Source == RISCV::X10 || Source == RISCV::X11) &&
161 RISCV::GPRS07RegClass.contains(Reg: Destination))
162 return true;
163 return false;
164}
165
166// Check if MI is a single-reg pli/plui whose destination is a half of a
167// GPRPair.
168bool RISCVMoveMergeImpl::isPLIPairCandidate(const MachineInstr &MI,
169 bool EvenRegPair) {
170 if (!ST->hasStdExtP() || ST->is64Bit())
171 return false;
172 if (!getPairedPLIOpcode(Opc: MI.getOpcode()))
173 return false;
174 unsigned SubIdx = EvenRegPair ? RISCV::sub_gpr_even : RISCV::sub_gpr_odd;
175 return TRI
176 ->getMatchingSuperReg(Reg: MI.getOperand(i: 0).getReg(), SubIdx,
177 RC: &RISCV::GPRPairRegClass)
178 .isValid();
179}
180
181MachineBasicBlock::iterator
182RISCVMoveMergeImpl::mergeGPRPairInsns(MachineBasicBlock::iterator I,
183 MachineBasicBlock::iterator Paired,
184 bool RegPairIsEven) {
185 MachineBasicBlock::iterator E = I->getParent()->end();
186 MachineBasicBlock::iterator NextI = next_nodbg(It: I, End: E);
187 DestSourcePair FirstPair = *TII->isCopyInstrImpl(MI: *I);
188 DestSourcePair SecondPair = *TII->isCopyInstrImpl(MI: *Paired);
189
190 if (NextI == Paired)
191 NextI = next_nodbg(It: NextI, End: E);
192 DebugLoc DL = I->getDebugLoc();
193
194 // Make a copy of the second instruction to update the kill
195 // flag.
196 MachineOperand PairedSource = *SecondPair.Source;
197
198 for (auto It = std::next(x: I); It != Paired && PairedSource.isKill(); ++It)
199 if (It->readsRegister(Reg: PairedSource.getReg(), TRI))
200 PairedSource.setIsKill(false);
201
202 unsigned GPRPairIdx =
203 RegPairIsEven ? RISCV::sub_gpr_even : RISCV::sub_gpr_odd;
204 MCRegister SrcReg = TRI->getMatchingSuperReg(
205 Reg: FirstPair.Source->getReg(), SubIdx: GPRPairIdx, RC: &RISCV::GPRPairRegClass);
206 MCRegister DestReg = TRI->getMatchingSuperReg(
207 Reg: FirstPair.Destination->getReg(), SubIdx: GPRPairIdx, RC: &RISCV::GPRPairRegClass);
208 bool KillSrc = PairedSource.isKill() && FirstPair.Source->isKill();
209
210 TII->copyPhysReg(MBB&: *I->getParent(), MBBI: I, DL, DstReg: DestReg, SrcReg, KillSrc);
211
212 I->eraseFromParent();
213 Paired->eraseFromParent();
214 return NextI;
215}
216
217MachineBasicBlock::iterator
218RISCVMoveMergeImpl::mergePairedInsns(MachineBasicBlock::iterator I,
219 MachineBasicBlock::iterator Paired,
220 bool MoveFromSToA) {
221 const MachineOperand *Sreg1, *Sreg2;
222 MachineBasicBlock::iterator E = I->getParent()->end();
223 MachineBasicBlock::iterator NextI = next_nodbg(It: I, End: E);
224 DestSourcePair FirstPair = *TII->isCopyInstrImpl(MI: *I);
225 DestSourcePair PairedRegs = *TII->isCopyInstrImpl(MI: *Paired);
226
227 if (NextI == Paired)
228 NextI = next_nodbg(It: NextI, End: E);
229 DebugLoc DL = I->getDebugLoc();
230
231 // Make a copy so we can update the kill flag in the MoveFromSToA case. The
232 // copied operand needs to be scoped outside the if since we make a pointer
233 // to it.
234 MachineOperand PairedSource = *PairedRegs.Source;
235
236 // The order of S-reg depends on which instruction holds A0, instead of
237 // the order of register pair.
238 // e,g.
239 // mv a1, s1
240 // mv a0, s2 => cm.mva01s s2,s1
241 //
242 // mv a0, s2
243 // mv a1, s1 => cm.mva01s s2,s1
244 unsigned Opcode = getCM_MVOpcode(ST: *ST, MoveFromSToA);
245 if (MoveFromSToA) {
246 // We are moving one of the copies earlier so its kill flag may become
247 // invalid. Clear the copied kill flag if there are any reads of the
248 // register between the new location and the old location.
249 for (auto It = std::next(x: I); It != Paired && PairedSource.isKill(); ++It)
250 if (It->readsRegister(Reg: PairedSource.getReg(), TRI))
251 PairedSource.setIsKill(false);
252
253 Sreg1 = FirstPair.Source;
254 Sreg2 = &PairedSource;
255 if (FirstPair.Destination->getReg() != RISCV::X10)
256 std::swap(a&: Sreg1, b&: Sreg2);
257 } else {
258 Sreg1 = FirstPair.Destination;
259 Sreg2 = PairedRegs.Destination;
260 if (FirstPair.Source->getReg() != RISCV::X10)
261 std::swap(a&: Sreg1, b&: Sreg2);
262 }
263
264 BuildMI(BB&: *I->getParent(), I, MIMD: DL, MCID: TII->get(Opcode)).add(MO: *Sreg1).add(MO: *Sreg2);
265
266 I->eraseFromParent();
267 Paired->eraseFromParent();
268 return NextI;
269}
270
271MachineBasicBlock::iterator
272RISCVMoveMergeImpl::mergePLIPair(MachineBasicBlock::iterator I,
273 MachineBasicBlock::iterator Paired,
274 bool RegPairIsEven) {
275 MachineBasicBlock::iterator E = I->getParent()->end();
276 MachineBasicBlock::iterator NextI = next_nodbg(It: I, End: E);
277
278 if (NextI == Paired)
279 NextI = next_nodbg(It: NextI, End: E);
280 DebugLoc DL = I->getDebugLoc();
281
282 unsigned Opcode = getPairedPLIOpcode(Opc: I->getOpcode());
283 unsigned GPRPairIdx =
284 RegPairIsEven ? RISCV::sub_gpr_even : RISCV::sub_gpr_odd;
285 Register DestReg = TRI->getMatchingSuperReg(
286 Reg: I->getOperand(i: 0).getReg(), SubIdx: GPRPairIdx, RC: &RISCV::GPRPairRegClass);
287
288 BuildMI(BB&: *I->getParent(), I, MIMD: DL, MCID: TII->get(Opcode), DestReg)
289 .addImm(Val: I->getOperand(i: 1).getImm());
290
291 I->eraseFromParent();
292 Paired->eraseFromParent();
293 return NextI;
294}
295
296MachineBasicBlock::iterator
297RISCVMoveMergeImpl::findMatchingGPRPairCopy(MachineBasicBlock::iterator &MBBI,
298 bool EvenRegPair,
299 const DestSourcePair &RegPair) {
300 MachineBasicBlock::iterator E = MBBI->getParent()->end();
301 ModifiedRegUnits.clear();
302 UsedRegUnits.clear();
303 unsigned RegPairIdx = EvenRegPair ? RISCV::sub_gpr_even : RISCV::sub_gpr_odd;
304 unsigned SecondPairIdx =
305 !EvenRegPair ? RISCV::sub_gpr_even : RISCV::sub_gpr_odd;
306
307 // Get the expected source/destination registers of the matching lane.
308 Register SrcGPRPair = TRI->getMatchingSuperReg(
309 Reg: RegPair.Source->getReg(), SubIdx: RegPairIdx, RC: &RISCV::GPRPairRegClass);
310 Register DestGPRPair = TRI->getMatchingSuperReg(
311 Reg: RegPair.Destination->getReg(), SubIdx: RegPairIdx, RC: &RISCV::GPRPairRegClass);
312
313 if (!SrcGPRPair.isValid() || !DestGPRPair.isValid())
314 return E;
315
316 Register ExpectedSourceReg = TRI->getSubReg(Reg: SrcGPRPair, Idx: SecondPairIdx);
317 Register ExpectedDestReg = TRI->getSubReg(Reg: DestGPRPair, Idx: SecondPairIdx);
318
319 if (!ExpectedSourceReg.isValid() || !ExpectedDestReg.isValid())
320 return E;
321
322 for (MachineBasicBlock::iterator I = next_nodbg(It: MBBI, End: E); I != E;
323 I = next_nodbg(It: I, End: E)) {
324
325 MachineInstr &MI = *I;
326
327 if (auto SecondPair = TII->isCopyInstrImpl(MI)) {
328 Register SourceReg = SecondPair->Source->getReg();
329 Register DestReg = SecondPair->Destination->getReg();
330
331 if (RegPair.Destination->getReg() == DestReg ||
332 RegPair.Source->getReg() == SourceReg)
333 return E;
334
335 // Check if the second pair's registers match the other lane of the
336 // GPRPairs.
337 if (SourceReg == ExpectedSourceReg && DestReg == ExpectedDestReg)
338 return I;
339 }
340 // Update modified / used register units.
341 LiveRegUnits::accumulateUsedDefed(MI, ModifiedRegUnits, UsedRegUnits, TRI);
342 // Once expected lane registers are clobbered/read in-between, we can stop
343 // scanning since the pair cannot be legally merged anymore.
344 if (!ModifiedRegUnits.available(Reg: ExpectedDestReg) ||
345 !UsedRegUnits.available(Reg: ExpectedDestReg) ||
346 !ModifiedRegUnits.available(Reg: ExpectedSourceReg))
347 return E;
348 }
349 return E;
350}
351
352MachineBasicBlock::iterator
353RISCVMoveMergeImpl::findMatchingSACopy(MachineBasicBlock::iterator &MBBI,
354 bool MoveFromSToA,
355 const DestSourcePair &RegPair) {
356 MachineBasicBlock::iterator E = MBBI->getParent()->end();
357
358 // Track which register units have been modified and used between the first
359 // insn and the second insn.
360 ModifiedRegUnits.clear();
361 UsedRegUnits.clear();
362
363 for (MachineBasicBlock::iterator I = next_nodbg(It: MBBI, End: E); I != E;
364 I = next_nodbg(It: I, End: E)) {
365
366 MachineInstr &MI = *I;
367
368 if (auto SecondPair = TII->isCopyInstrImpl(MI)) {
369 Register SourceReg = SecondPair->Source->getReg();
370 Register DestReg = SecondPair->Destination->getReg();
371
372 bool IsCandidate = MoveFromSToA ? isCandidateToMergeMVA01S(RegPair: *SecondPair)
373 : isCandidateToMergeMVSA01(RegPair: *SecondPair);
374 if (IsCandidate) {
375 // Second destination must be different.
376 if (RegPair.Destination->getReg() == DestReg)
377 return E;
378
379 // For AtoS the source must also be different.
380 if (!MoveFromSToA && RegPair.Source->getReg() == SourceReg)
381 return E;
382
383 // If paired destination register was modified or used, the source reg
384 // was modified, there is no possibility of finding matching
385 // instruction so exit early.
386 if (!ModifiedRegUnits.available(Reg: DestReg) ||
387 !UsedRegUnits.available(Reg: DestReg) ||
388 !ModifiedRegUnits.available(Reg: SourceReg))
389 return E;
390
391 return I;
392 }
393 }
394 // Update modified / used register units.
395 LiveRegUnits::accumulateUsedDefed(MI, ModifiedRegUnits, UsedRegUnits, TRI);
396 }
397 return E;
398}
399
400// Look for a same-opcode pli/plui writing the other lane of the same GPRPair
401// with the same immediate. Return the matching instruction if one exists.
402MachineBasicBlock::iterator
403RISCVMoveMergeImpl::findMatchingPLI(MachineBasicBlock::iterator &MBBI,
404 bool EvenRegPair) {
405 MachineBasicBlock::iterator E = MBBI->getParent()->end();
406 ModifiedRegUnits.clear();
407 UsedRegUnits.clear();
408 unsigned Opc = MBBI->getOpcode();
409 Register FirstDestReg = MBBI->getOperand(i: 0).getReg();
410 int64_t FirstImm = MBBI->getOperand(i: 1).getImm();
411 unsigned RegPairIdx = EvenRegPair ? RISCV::sub_gpr_even : RISCV::sub_gpr_odd;
412 unsigned SecondPairIdx =
413 !EvenRegPair ? RISCV::sub_gpr_even : RISCV::sub_gpr_odd;
414
415 // Get the expected destination register of the matching lane.
416 Register DestGPRPair = TRI->getMatchingSuperReg(Reg: FirstDestReg, SubIdx: RegPairIdx,
417 RC: &RISCV::GPRPairRegClass);
418 assert(DestGPRPair.isValid());
419 Register ExpectedDestReg = TRI->getSubReg(Reg: DestGPRPair, Idx: SecondPairIdx);
420 assert(ExpectedDestReg.isValid());
421
422 for (MachineBasicBlock::iterator I = next_nodbg(It: MBBI, End: E); I != E;
423 I = next_nodbg(It: I, End: E)) {
424
425 MachineInstr &MI = *I;
426
427 if (MI.getOpcode() == Opc) {
428 Register DestReg = MI.getOperand(i: 0).getReg();
429 int64_t Imm = MI.getOperand(i: 1).getImm();
430
431 if (FirstDestReg == DestReg)
432 return E;
433
434 // Check if the second PLI matches the other lane and immediate.
435 if (DestReg == ExpectedDestReg && Imm == FirstImm)
436 return I;
437 }
438 // Update modified / used register units.
439 LiveRegUnits::accumulateUsedDefed(MI, ModifiedRegUnits, UsedRegUnits, TRI);
440 // Once the expected lane register is clobbered/read in-between, we can
441 // stop scanning since the pair cannot be legally merged anymore.
442 if (!ModifiedRegUnits.available(Reg: ExpectedDestReg) ||
443 !UsedRegUnits.available(Reg: ExpectedDestReg))
444 return E;
445 }
446 return E;
447}
448
449// Finds instructions, which could be represented as C.MV instructions and
450// merged into CM.MVA01S or CM.MVSA01.
451bool RISCVMoveMergeImpl::mergeMovePairs(MachineBasicBlock &MBB) {
452 bool Modified = false;
453
454 for (MachineBasicBlock::iterator MBBI = MBB.begin(), E = MBB.end();
455 MBBI != E;) {
456 // Try merging a pair of single-reg PLI/PLUI into a paired form.
457 bool IsPLIEven = isPLIPairCandidate(MI: *MBBI, /*EvenRegPair=*/true);
458 bool IsPLIOdd = isPLIPairCandidate(MI: *MBBI, /*EvenRegPair=*/false);
459 if (IsPLIEven != IsPLIOdd) {
460 MachineBasicBlock::iterator Paired = findMatchingPLI(MBBI, EvenRegPair: IsPLIEven);
461 if (Paired != E) {
462 MBBI = mergePLIPair(I: MBBI, Paired, RegPairIsEven: IsPLIEven);
463 Modified = true;
464 continue;
465 }
466 }
467
468 // Check if the instruction can be compressed to C.MV instruction. If it
469 // can, return Dest/Src register pair.
470 auto RegPair = TII->isCopyInstrImpl(MI: *MBBI);
471 if (RegPair.has_value()) {
472 bool MoveFromSToA = isCandidateToMergeMVA01S(RegPair: *RegPair);
473 bool MoveFromAToS = isCandidateToMergeMVSA01(RegPair: *RegPair);
474 bool IsEven = isGPRPairCopyCandidate(RegPair: *RegPair, /*EvenRegPair=*/true);
475 bool IsOdd = isGPRPairCopyCandidate(RegPair: *RegPair, /*EvenRegPair=*/false);
476 if (!MoveFromSToA && !MoveFromAToS && !IsEven && !IsOdd) {
477 ++MBBI;
478 continue;
479 }
480
481 MachineBasicBlock::iterator Paired = E;
482 if (MoveFromSToA || MoveFromAToS) {
483 Paired = findMatchingSACopy(MBBI, MoveFromSToA, RegPair: *RegPair);
484 if (Paired != E) {
485 MBBI = mergePairedInsns(I: MBBI, Paired, MoveFromSToA);
486 Modified = true;
487 continue;
488 }
489 }
490 if (IsEven != IsOdd) {
491 Paired = findMatchingGPRPairCopy(MBBI, EvenRegPair: IsEven, RegPair: *RegPair);
492 if (Paired != E) {
493 MBBI = mergeGPRPairInsns(I: MBBI, Paired, RegPairIsEven: IsEven);
494 Modified = true;
495 continue;
496 }
497 }
498 }
499 ++MBBI;
500 }
501 return Modified;
502}
503
504bool RISCVMoveMergeImpl::runOnMachineFunction(MachineFunction &MF) {
505 ST = &MF.getSubtarget<RISCVSubtarget>();
506 bool HasGPRPairCopy =
507 !ST->is64Bit() && (ST->hasStdExtZdinx() || ST->hasStdExtP());
508 if (!ST->hasStdExtZcmp() && !ST->hasVendorXqccmp() && !HasGPRPairCopy)
509 return false;
510
511 TII = ST->getInstrInfo();
512 TRI = ST->getRegisterInfo();
513 // Resize the modified and used register unit trackers. We do this once
514 // per function and then clear the register units each time we optimize a
515 // move.
516 ModifiedRegUnits.init(TRI: *TRI);
517 UsedRegUnits.init(TRI: *TRI);
518 bool Modified = false;
519 for (auto &MBB : MF)
520 Modified |= mergeMovePairs(MBB);
521 return Modified;
522}
523
524/// Returns an instance of the move merge pass.
525FunctionPass *llvm::createRISCVMoveMergeLegacyPass() {
526 return new RISCVMoveMergeLegacy();
527}
528
529bool RISCVMoveMergeLegacy::runOnMachineFunction(MachineFunction &MF) {
530 if (skipFunction(F: MF.getFunction()))
531 return false;
532 RISCVMoveMergeImpl Impl;
533 return Impl.runOnMachineFunction(MF);
534}
535
536PreservedAnalyses
537RISCVMoveMergePass::run(MachineFunction &MF,
538 MachineFunctionAnalysisManager &MFAM) {
539 RISCVMoveMergeImpl Impl;
540 return Impl.runOnMachineFunction(MF)
541 ? getMachineFunctionPassPreservedAnalyses()
542 .preserveSet<CFGAnalyses>()
543 : PreservedAnalyses::all();
544}
545