@@ -293,29 +293,30 @@ bool X86PreTileConfig::runOnMachineFunction(MachineFunction &MF) {
293293 SmallVector<MachineBasicBlock *, 8 > CfgLiveInBBs;
294294 for (auto &MBB : MF) {
295295 size_t Pos = 0 ;
296+ auto &Info = BBVisitedInfo[&MBB];
296297 for (auto &MI : MBB) {
297298 ++Pos;
298299 if (isAMXInstruction (MI)) {
299300 // 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 );
302303 else // Otherwise, we need tile config to live in this BB.
303- BBVisitedInfo[&MBB] .NeedTileCfgLiveIn = true ;
304+ Info .NeedTileCfgLiveIn = true ;
304305 // 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);
307308 } else if (MI.isCall () && isDestructiveCall (MI, AMXRegs)) {
308309 // 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);
310311 }
311312 }
312- if (BBVisitedInfo[&MBB] .NeedTileCfgLiveIn ) {
313+ if (Info .NeedTileCfgLiveIn ) {
313314 if (&MBB == &MF.front ())
314315 CfgNeedInsert.insert (MIRef (&MBB));
315316 else
316317 CfgLiveInBBs.push_back (&MBB);
317318 }
318- if (BBVisitedInfo[&MBB] .FirstAMX || BBVisitedInfo[&MBB] .HasAMXRegLiveIn )
319+ if (Info .FirstAMX || Info .HasAMXRegLiveIn )
319320 for (auto *Succ : MBB.successors ())
320321 if (!isLoopBackEdge (Succ, &MBB))
321322 BBVisitedInfo[Succ].HasAMXRegLiveIn = true ;
@@ -325,10 +326,11 @@ bool X86PreTileConfig::runOnMachineFunction(MachineFunction &MF) {
325326 while (!CfgLiveInBBs.empty ()) {
326327 MachineBasicBlock *MBB = CfgLiveInBBs.pop_back_val ();
327328 for (auto *Pred : MBB->predecessors ()) {
329+ auto &Info = BBVisitedInfo[Pred];
328330 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 ;
332334 if (Pred == &MF.front ())
333335 CfgNeedInsert.insert (MIRef (Pred));
334336 else
@@ -344,16 +346,16 @@ bool X86PreTileConfig::runOnMachineFunction(MachineFunction &MF) {
344346 // Avoid to insert ldtilecfg before any shape defs.
345347 SmallVector<MachineBasicBlock *, 8 > WorkList;
346348 for (auto &I : ShapeBBs) {
349+ auto &Info = BBVisitedInfo[I.first ];
347350 // TODO: We can hoist shapes across BBs here.
348- if (BBVisitedInfo[I. first ] .HasAMXRegLiveIn ) {
351+ if (Info .HasAMXRegLiveIn ) {
349352 // We are not able to config tile registers since the shape to config
350353 // is not defined yet. Emit error message and continue. The function
351354 // would not config tile registers.
352355 emitErrorMsg (MF);
353356 return false ;
354357 }
355- if (BBVisitedInfo[I.first ].FirstAMX &&
356- BBVisitedInfo[I.first ].FirstAMX < I.second .back () &&
358+ if (Info.FirstAMX && Info.FirstAMX < I.second .back () &&
357359 !hoistShapesInBB (I.first , I.second )) {
358360 emitErrorMsg (MF);
359361 return false ;
@@ -363,8 +365,9 @@ bool X86PreTileConfig::runOnMachineFunction(MachineFunction &MF) {
363365 while (!WorkList.empty ()) {
364366 MachineBasicBlock *MBB = WorkList.pop_back_val ();
365367 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 ;
368371 WorkList.push_back (Pred);
369372 }
370373 }
0 commit comments