[llvm] 151e244 - [X86][AMX][NFC] Make comparison operators to be complete

via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 23 02:39:09 PDT 2021


Author: Wang, Pengfei
Date: 2021-04-23T17:38:54+08:00
New Revision: 151e244fe687901e69e4a3c569ef3bb252b7e4fc

URL: https://github.com/llvm/llvm-project/commit/151e244fe687901e69e4a3c569ef3bb252b7e4fc
DIFF: https://github.com/llvm/llvm-project/commit/151e244fe687901e69e4a3c569ef3bb252b7e4fc.diff

LOG: [X86][AMX][NFC] Make comparison operators to be complete

The previous D101039 didn't fix the SmallSet insertion issue, due to we
always return false for the comparison between 2 different nonnull BBs.
This patch makes the the comparison to be complete by comparing `MBB`
first, so that we can always get the invariant order by a single
operator.

Added: 
    

Modified: 
    llvm/lib/Target/X86/X86PreTileConfig.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/X86/X86PreTileConfig.cpp b/llvm/lib/Target/X86/X86PreTileConfig.cpp
index 48d68d72efe6..a5057d093f6c 100644
--- a/llvm/lib/Target/X86/X86PreTileConfig.cpp
+++ b/llvm/lib/Target/X86/X86PreTileConfig.cpp
@@ -71,10 +71,10 @@ struct MIRef {
   }
   bool operator!=(const MIRef &RHS) const { return !(*this == RHS); }
   bool operator<(const MIRef &RHS) const {
-    return (!MBB && RHS.MBB) || (MBB == RHS.MBB && Pos < RHS.Pos);
+    return MBB < RHS.MBB || (MBB == RHS.MBB && Pos < RHS.Pos);
   }
   bool operator>(const MIRef &RHS) const {
-    return (!RHS.MBB && MBB) || (MBB == RHS.MBB && Pos > RHS.Pos);
+    return MBB > RHS.MBB || (MBB == RHS.MBB && Pos > RHS.Pos);
   }
 };
 


        


More information about the llvm-commits mailing list