From f69adfb87f9924c6a1920cff95ace3df17623356 Mon Sep 17 00:00:00 2001 From: "Wang, Pengfei" Date: Wed, 28 Apr 2021 15:56:17 +0800 Subject: [PATCH] [X86][AMX][NFC] Add more comments and remove unnecessary check found by Clocwork --- llvm/lib/Target/X86/X86PreTileConfig.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Target/X86/X86PreTileConfig.cpp b/llvm/lib/Target/X86/X86PreTileConfig.cpp index 9164dfd..2b3a7ac 100644 --- a/llvm/lib/Target/X86/X86PreTileConfig.cpp +++ b/llvm/lib/Target/X86/X86PreTileConfig.cpp @@ -71,9 +71,13 @@ struct MIRef { } bool operator!=(const MIRef &RHS) const { return !(*this == RHS); } bool operator<(const MIRef &RHS) const { + // Comparison between different BBs happens when inserting a MIRef into set. + // So we compare MBB first to make the insertion happy. return MBB < RHS.MBB || (MBB == RHS.MBB && Pos < RHS.Pos); } bool operator>(const MIRef &RHS) const { + // Comparison between different BBs happens when inserting a MIRef into set. + // So we compare MBB first to make the insertion happy. return MBB > RHS.MBB || (MBB == RHS.MBB && Pos > RHS.Pos); } }; @@ -205,8 +209,9 @@ void X86PreTileConfig::collectShapeInfo(MachineInstr &MI) { while (!WorkList.empty()) { Register R = WorkList.pop_back_val(); MachineInstr *DefMI = MRI->getVRegDef(R); + assert(DefMI && "R must has one define instruction"); MachineBasicBlock *DefMBB = DefMI->getParent(); - if (!DefMI || DefMI->isMoveImmediate() || !DefVisited.insert(DefMI).second) + if (DefMI->isMoveImmediate() || !DefVisited.insert(DefMI).second) continue; if (DefMI->isPHI()) { for (unsigned I = 1; I < DefMI->getNumOperands(); I += 2) -- 2.7.4