@@ -176,25 +176,20 @@ RISCVMoveMerge::findMatchingInst(MachineBasicBlock::iterator &MBBI,
176
176
Register SourceReg = SecondPair->Source ->getReg ();
177
177
Register DestReg = SecondPair->Destination ->getReg ();
178
178
179
- if (MoveFromSToA && isCandidateToMergeMVA01S (*SecondPair)) {
180
- // If register pair is valid and destination registers are different.
181
- if ((RegPair.Destination ->getReg () == DestReg))
179
+ bool IsCandidate = MoveFromSToA ? isCandidateToMergeMVA01S (*SecondPair)
180
+ : isCandidateToMergeMVSA01 (*SecondPair);
181
+ if (IsCandidate) {
182
+ // Second destination must be different.
183
+ if (RegPair.Destination ->getReg () == DestReg)
182
184
return E;
183
185
184
- // If paired destination register was modified or used, the source reg
185
- // was modified, there is no possibility of finding matching
186
- // instruction so exit early.
187
- if (!ModifiedRegUnits.available (DestReg) ||
188
- !UsedRegUnits.available (DestReg) ||
189
- !ModifiedRegUnits.available (SourceReg))
190
- return E;
191
-
192
- return I;
193
- } else if (!MoveFromSToA && isCandidateToMergeMVSA01 (*SecondPair)) {
194
- if ((RegPair.Source ->getReg () == SourceReg) ||
195
- (RegPair.Destination ->getReg () == DestReg))
186
+ // For AtoS the source must also be different.
187
+ if (!MoveFromSToA && RegPair.Source ->getReg () == SourceReg)
196
188
return E;
197
189
190
+ // If paired destination register was modified or used, the source reg
191
+ // was modified, there is no possibility of finding matching
192
+ // instruction so exit early.
198
193
if (!ModifiedRegUnits.available (DestReg) ||
199
194
!UsedRegUnits.available (DestReg) ||
200
195
!ModifiedRegUnits.available (SourceReg))
0 commit comments