[llvm] b15b846 - [SlotIndexes] Simplify SlotIndex() and isSameInstr(). NFC.

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 11 07:45:02 PDT 2023


Author: Jay Foad
Date: 2023-10-11T15:41:36+01:00
New Revision: b15b84610f631371f71243f72a29a02abedc481a

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

LOG: [SlotIndexes] Simplify SlotIndex() and isSameInstr(). NFC.

Avoid using lie.getPointer() directly when there are helper methods we
can use.

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/SlotIndexes.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/SlotIndexes.h b/llvm/include/llvm/CodeGen/SlotIndexes.h
index 1a8d117322fcc6e..1517d33e65a3801 100644
--- a/llvm/include/llvm/CodeGen/SlotIndexes.h
+++ b/llvm/include/llvm/CodeGen/SlotIndexes.h
@@ -125,8 +125,7 @@ class raw_ostream;
 
     // Construct a new slot index from the given one, and set the slot.
     SlotIndex(const SlotIndex &li, Slot s) : lie(li.listEntry(), unsigned(s)) {
-      assert(lie.getPointer() != nullptr &&
-             "Attempt to construct index with 0 pointer.");
+      assert(isValid() && "Attempt to construct index with 0 pointer.");
     }
 
     /// Returns true if this is a valid index. Invalid indices do
@@ -178,7 +177,7 @@ class raw_ostream;
 
     /// isSameInstr - Return true if A and B refer to the same instruction.
     static bool isSameInstr(SlotIndex A, SlotIndex B) {
-      return A.lie.getPointer() == B.lie.getPointer();
+      return A.listEntry() == B.listEntry();
     }
 
     /// isEarlierInstr - Return true if A refers to an instruction earlier than


        


More information about the llvm-commits mailing list