[PATCH] D101124: [X86][AMX][NFC] Avoid assert for the same immidiate value

Pengfei Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 22 21:17:21 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rG53673fd1bf6f: [X86][AMX][NFC] Avoid assert for the same immidiate value (authored by pengfei).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101124/new/

https://reviews.llvm.org/D101124

Files:
  llvm/lib/Target/X86/X86TileConfig.cpp


Index: llvm/lib/Target/X86/X86TileConfig.cpp
===================================================================
--- llvm/lib/Target/X86/X86TileConfig.cpp
+++ llvm/lib/Target/X86/X86TileConfig.cpp
@@ -150,19 +150,23 @@
       // ... (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 {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101124.339865.patch
Type: text/x-patch
Size: 1471 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210423/2db34a94/attachment.bin>


More information about the llvm-commits mailing list