[llvm] 53673fd - [X86][AMX][NFC] Avoid assert for the same immidiate value
via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 22 21:17:13 PDT 2021
Author: Wang, Pengfei
Date: 2021-04-23T12:17:00+08:00
New Revision: 53673fd1bf6f2dd94d8bb6ced49cc54ec5fc866b
URL: https://github.com/llvm/llvm-project/commit/53673fd1bf6f2dd94d8bb6ced49cc54ec5fc866b
DIFF: https://github.com/llvm/llvm-project/commit/53673fd1bf6f2dd94d8bb6ced49cc54ec5fc866b.diff
LOG: [X86][AMX][NFC] Avoid assert for the same immidiate value
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
Added:
Modified:
llvm/lib/Target/X86/X86TileConfig.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86TileConfig.cpp b/llvm/lib/Target/X86/X86TileConfig.cpp
index d5e6e33e4ace..de4b847c0cd6 100644
--- a/llvm/lib/Target/X86/X86TileConfig.cpp
+++ b/llvm/lib/Target/X86/X86TileConfig.cpp
@@ -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
diff erent shapes");
+ if (Imm != INT64_MAX) {
+ // FIXME: We should handle this case in future.
+ assert(Imm == DefMI.getOperand(1).getImm() &&
+ "Cannot initialize with
diff erent 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 {
More information about the llvm-commits
mailing list