File tree Expand file tree Collapse file tree 2 files changed +8
-37
lines changed
test/CodeGen/AArch64/GlobalISel Expand file tree Collapse file tree 2 files changed +8
-37
lines changed Original file line number Diff line number Diff line change @@ -6273,15 +6273,14 @@ bool CombinerHelper::matchShiftsTooBig(MachineInstr &MI) {
6273
6273
bool CombinerHelper::matchCommuteConstantToRHS (MachineInstr &MI) {
6274
6274
Register LHS = MI.getOperand (1 ).getReg ();
6275
6275
Register RHS = MI.getOperand (2 ).getReg ();
6276
- if (!getIConstantVRegVal (LHS, MRI)) {
6277
- // Skip commuting if LHS is not a constant. But, LHS may be a
6278
- // G_CONSTANT_FOLD_BARRIER. If so we commute as long as we don't already
6279
- // have a constant on the RHS.
6280
- if (MRI.getVRegDef (LHS)->getOpcode () !=
6281
- TargetOpcode::G_CONSTANT_FOLD_BARRIER)
6282
- return false ;
6283
- }
6284
- // Commute as long as RHS is not a constant or G_CONSTANT_FOLD_BARRIER.
6276
+ auto *LHSDef = MRI.getVRegDef (LHS);
6277
+ if (getIConstantVRegVal (LHS, MRI).has_value ())
6278
+ return true ;
6279
+
6280
+ // LHS may be a G_CONSTANT_FOLD_BARRIER. If so we commute
6281
+ // as long as we don't already have a constant on the RHS.
6282
+ if (LHSDef->getOpcode () != TargetOpcode::G_CONSTANT_FOLD_BARRIER)
6283
+ return false ;
6285
6284
return MRI.getVRegDef (RHS)->getOpcode () !=
6286
6285
TargetOpcode::G_CONSTANT_FOLD_BARRIER &&
6287
6286
!getIConstantVRegVal (RHS, MRI);
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments