[llvm] a12e747 - [SlotIndexes] Simplify getInstructionFromIndex. NFCI.

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 11 08:39:22 PDT 2023


Author: Jay Foad
Date: 2023-10-11T16:38:59+01:00
New Revision: a12e747c4c6d333eb8739cd43f12acdeecd47d5c

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

LOG: [SlotIndexes] Simplify getInstructionFromIndex. NFCI.

This method should never be called on an invalid index.

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 828165c8b887b34..72f4a6876b6cb14 100644
--- a/llvm/include/llvm/CodeGen/SlotIndexes.h
+++ b/llvm/include/llvm/CodeGen/SlotIndexes.h
@@ -387,7 +387,7 @@ class raw_ostream;
     /// Returns the instruction for the given index, or null if the given
     /// index has no instruction associated with it.
     MachineInstr* getInstructionFromIndex(SlotIndex index) const {
-      return index.isValid() ? index.listEntry()->getInstr() : nullptr;
+      return index.listEntry()->getInstr();
     }
 
     /// Returns the next non-null index, if one exists.


        


More information about the llvm-commits mailing list