@@ -293,29 +293,30 @@ bool X86PreTileConfig::runOnMachineFunction(MachineFunction &MF) {
293
293
SmallVector<MachineBasicBlock *, 8 > CfgLiveInBBs;
294
294
for (auto &MBB : MF) {
295
295
size_t Pos = 0 ;
296
+ auto &Info = BBVisitedInfo[&MBB];
296
297
for (auto &MI : MBB) {
297
298
++Pos;
298
299
if (isAMXInstruction (MI)) {
299
300
// If there's call before the AMX, we need to reload tile config.
300
- if (BBVisitedInfo[&MBB] .LastCall )
301
- CfgNeedInsert.insert (BBVisitedInfo[&MBB] .LastCall );
301
+ if (Info .LastCall )
302
+ CfgNeedInsert.insert (Info .LastCall );
302
303
else // Otherwise, we need tile config to live in this BB.
303
- BBVisitedInfo[&MBB] .NeedTileCfgLiveIn = true ;
304
+ Info .NeedTileCfgLiveIn = true ;
304
305
// Always record the first AMX in case there's shape def after it.
305
- if (!BBVisitedInfo[&MBB] .FirstAMX )
306
- BBVisitedInfo[&MBB] .FirstAMX = MIRef (&MI, &MBB, Pos);
306
+ if (!Info .FirstAMX )
307
+ Info .FirstAMX = MIRef (&MI, &MBB, Pos);
307
308
} else if (MI.isCall () && isDestructiveCall (MI, AMXRegs)) {
308
309
// Record the call only if the callee clobbers all AMX registers.
309
- BBVisitedInfo[&MBB] .LastCall = MIRef (&MI, &MBB, Pos);
310
+ Info .LastCall = MIRef (&MI, &MBB, Pos);
310
311
}
311
312
}
312
- if (BBVisitedInfo[&MBB] .NeedTileCfgLiveIn ) {
313
+ if (Info .NeedTileCfgLiveIn ) {
313
314
if (&MBB == &MF.front ())
314
315
CfgNeedInsert.insert (MIRef (&MBB));
315
316
else
316
317
CfgLiveInBBs.push_back (&MBB);
317
318
}
318
- if (BBVisitedInfo[&MBB] .FirstAMX || BBVisitedInfo[&MBB] .HasAMXRegLiveIn )
319
+ if (Info .FirstAMX || Info .HasAMXRegLiveIn )
319
320
for (auto *Succ : MBB.successors ())
320
321
if (!isLoopBackEdge (Succ, &MBB))
321
322
BBVisitedInfo[Succ].HasAMXRegLiveIn = true ;
@@ -325,10 +326,11 @@ bool X86PreTileConfig::runOnMachineFunction(MachineFunction &MF) {
325
326
while (!CfgLiveInBBs.empty ()) {
326
327
MachineBasicBlock *MBB = CfgLiveInBBs.pop_back_val ();
327
328
for (auto *Pred : MBB->predecessors ()) {
329
+ auto &Info = BBVisitedInfo[Pred];
328
330
if (BBVisitedInfo[Pred].LastCall ) {
329
- CfgNeedInsert.insert (BBVisitedInfo[Pred] .LastCall );
330
- } else if (!BBVisitedInfo[Pred] .NeedTileCfgLiveIn ) {
331
- BBVisitedInfo[Pred] .NeedTileCfgLiveIn = true ;
331
+ CfgNeedInsert.insert (Info .LastCall );
332
+ } else if (!Info .NeedTileCfgLiveIn ) {
333
+ Info .NeedTileCfgLiveIn = true ;
332
334
if (Pred == &MF.front ())
333
335
CfgNeedInsert.insert (MIRef (Pred));
334
336
else
@@ -344,16 +346,16 @@ bool X86PreTileConfig::runOnMachineFunction(MachineFunction &MF) {
344
346
// Avoid to insert ldtilecfg before any shape defs.
345
347
SmallVector<MachineBasicBlock *, 8 > WorkList;
346
348
for (auto &I : ShapeBBs) {
349
+ auto &Info = BBVisitedInfo[I.first ];
347
350
// TODO: We can hoist shapes across BBs here.
348
- if (BBVisitedInfo[I. first ] .HasAMXRegLiveIn ) {
351
+ if (Info .HasAMXRegLiveIn ) {
349
352
// We are not able to config tile registers since the shape to config
350
353
// is not defined yet. Emit error message and continue. The function
351
354
// would not config tile registers.
352
355
emitErrorMsg (MF);
353
356
return false ;
354
357
}
355
- if (BBVisitedInfo[I.first ].FirstAMX &&
356
- BBVisitedInfo[I.first ].FirstAMX < I.second .back () &&
358
+ if (Info.FirstAMX && Info.FirstAMX < I.second .back () &&
357
359
!hoistShapesInBB (I.first , I.second )) {
358
360
emitErrorMsg (MF);
359
361
return false ;
@@ -363,8 +365,9 @@ bool X86PreTileConfig::runOnMachineFunction(MachineFunction &MF) {
363
365
while (!WorkList.empty ()) {
364
366
MachineBasicBlock *MBB = WorkList.pop_back_val ();
365
367
for (auto *Pred : MBB->predecessors ()) {
366
- if (!BBVisitedInfo[Pred].TileCfgForbidden && !isLoopBackEdge (MBB, Pred)) {
367
- BBVisitedInfo[Pred].TileCfgForbidden = true ;
368
+ auto &Info = BBVisitedInfo[Pred];
369
+ if (!Info.TileCfgForbidden && !isLoopBackEdge (MBB, Pred)) {
370
+ Info.TileCfgForbidden = true ;
368
371
WorkList.push_back (Pred);
369
372
}
370
373
}
0 commit comments