@@ -1306,7 +1306,8 @@ bool RISCVVLOptimizer::isCandidate(const MachineInstr &MI) const {
1306
1306
// TODO: Use a better approach than a white-list, such as adding
1307
1307
// properties to instructions using something like TSFlags.
1308
1308
if (!isSupportedInstr (MI)) {
1309
- LLVM_DEBUG (dbgs () << " Not a candidate due to unsupported instruction\n " );
1309
+ LLVM_DEBUG (dbgs () << " Not a candidate due to unsupported instruction: "
1310
+ << MI);
1310
1311
return false ;
1311
1312
}
1312
1313
@@ -1328,14 +1329,14 @@ RISCVVLOptimizer::getMinimumVLForUser(const MachineOperand &UserOp) const {
1328
1329
const MCInstrDesc &Desc = UserMI.getDesc ();
1329
1330
1330
1331
if (!RISCVII::hasVLOp (Desc.TSFlags ) || !RISCVII::hasSEWOp (Desc.TSFlags )) {
1331
- LLVM_DEBUG (dbgs () << " Abort due to lack of VL, assume that"
1332
+ LLVM_DEBUG (dbgs () << " Abort due to lack of VL, assume that"
1332
1333
" use VLMAX\n " );
1333
1334
return std::nullopt;
1334
1335
}
1335
1336
1336
1337
if (RISCVII::readsPastVL (
1337
1338
TII->get (RISCV::getRVVMCOpcode (UserMI.getOpcode ())).TSFlags )) {
1338
- LLVM_DEBUG (dbgs () << " Abort because used by unsafe instruction\n " );
1339
+ LLVM_DEBUG (dbgs () << " Abort because used by unsafe instruction\n " );
1339
1340
return std::nullopt;
1340
1341
}
1341
1342
@@ -1352,7 +1353,7 @@ RISCVVLOptimizer::getMinimumVLForUser(const MachineOperand &UserOp) const {
1352
1353
RISCVII::isFirstDefTiedToFirstUse (UserMI.getDesc ()));
1353
1354
auto DemandedVL = DemandedVLs.lookup (&UserMI);
1354
1355
if (!DemandedVL || !RISCV::isVLKnownLE (*DemandedVL, VLOp)) {
1355
- LLVM_DEBUG (dbgs () << " Abort because user is passthru in "
1356
+ LLVM_DEBUG (dbgs () << " Abort because user is passthru in "
1356
1357
" instruction with demanded tail\n " );
1357
1358
return std::nullopt;
1358
1359
}
@@ -1449,7 +1450,7 @@ RISCVVLOptimizer::checkUsers(const MachineInstr &MI) const {
1449
1450
}
1450
1451
1451
1452
bool RISCVVLOptimizer::tryReduceVL (MachineInstr &MI) const {
1452
- LLVM_DEBUG (dbgs () << " Trying to reduce VL for " << MI << " \n " );
1453
+ LLVM_DEBUG (dbgs () << " Trying to reduce VL for " << MI);
1453
1454
1454
1455
unsigned VLOpNum = RISCVII::getVLOpNum (MI.getDesc ());
1455
1456
MachineOperand &VLOp = MI.getOperand (VLOpNum);
@@ -1469,13 +1470,13 @@ bool RISCVVLOptimizer::tryReduceVL(MachineInstr &MI) const {
1469
1470
" Expected VL to be an Imm or virtual Reg" );
1470
1471
1471
1472
if (!RISCV::isVLKnownLE (*CommonVL, VLOp)) {
1472
- LLVM_DEBUG (dbgs () << " Abort due to CommonVL not <= VLOp.\n " );
1473
+ LLVM_DEBUG (dbgs () << " Abort due to CommonVL not <= VLOp.\n " );
1473
1474
return false ;
1474
1475
}
1475
1476
1476
1477
if (CommonVL->isIdenticalTo (VLOp)) {
1477
1478
LLVM_DEBUG (
1478
- dbgs () << " Abort due to CommonVL == VLOp, no point in reducing.\n " );
1479
+ dbgs () << " Abort due to CommonVL == VLOp, no point in reducing.\n " );
1479
1480
return false ;
1480
1481
}
1481
1482
@@ -1486,8 +1487,10 @@ bool RISCVVLOptimizer::tryReduceVL(MachineInstr &MI) const {
1486
1487
return true ;
1487
1488
}
1488
1489
const MachineInstr *VLMI = MRI->getVRegDef (CommonVL->getReg ());
1489
- if (!MDT->dominates (VLMI, &MI))
1490
+ if (!MDT->dominates (VLMI, &MI)) {
1491
+ LLVM_DEBUG (dbgs () << " Abort due to VL not dominating.\n " );
1490
1492
return false ;
1493
+ }
1491
1494
LLVM_DEBUG (
1492
1495
dbgs () << " Reduce VL from " << VLOp << " to "
1493
1496
<< printReg (CommonVL->getReg (), MRI->getTargetRegisterInfo ())
0 commit comments