Skip to content

Commit

Permalink
[X86][AMX][NFC] Avoid assert for the same immidiate value
Browse files Browse the repository at this point in the history
The previous condition in the assert was over strict. We ought to allow
the same immidiate value being loaded more than once. The intention for
the assert is to check the same AMX register uses multiple different
immidiate shapes. So this fix supposes to be NFC.

Reviewed By: LuoYuanke

Differential Revision: https://reviews.llvm.org/D101124
  • Loading branch information
phoebewang committed Apr 23, 2021
1 parent 9011856 commit 53673fd
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions llvm/lib/Target/X86/X86TileConfig.cpp
Expand Up @@ -150,19 +150,23 @@ bool X86TileConfig::runOnMachineFunction(MachineFunction &MF) {
// ... (sequence continues)
// 55 tile7.rows Tile 7 rows.
// 56-63 reserved, must be zero
int ImmCount = 0;
(void)ImmCount;
int64_t Imm = INT64_MAX;
int Offset = IsRow ? 48 + I : 16 + I * 2;
for (auto &DefMI : MRI.def_instructions(R)) {
MachineBasicBlock &MBB = *DefMI.getParent();
if (DefMI.isMoveImmediate()) {
// FIXME: We should handle this case in future.
assert(++ImmCount == 1 && "Cannot initialize with different shapes");
if (Imm != INT64_MAX) {
// FIXME: We should handle this case in future.
assert(Imm == DefMI.getOperand(1).getImm() &&
"Cannot initialize with different shapes");
continue;
}
Imm = DefMI.getOperand(1).getImm();
NewMI = addFrameReference(
BuildMI(MF.front(), ++ConstMI->getIterator(), DL,
TII->get(IsRow ? X86::MOV8mi : X86::MOV16mi)),
SS, Offset)
.addImm(DefMI.getOperand(1).getImm());
.addImm(Imm);
ConstMI = NewMI;
LIS.InsertMachineInstrInMaps(*NewMI);
} else {
Expand Down

0 comments on commit 53673fd

Please sign in to comment.