diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-03-03 05:18:19 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-03-03 05:18:19 +0000 |
commit | a97ff8a027259b1b9e4dbdb5b6f01cc2195a6948 (patch) | |
tree | f4daea01d38e23fa6b8996bcf546bc05365cc204 /include | |
parent | acf9f48c5e5fa2ce381d566aefc6285653ab2b5c (diff) | |
download | external_llvm-a97ff8a027259b1b9e4dbdb5b6f01cc2195a6948.zip external_llvm-a97ff8a027259b1b9e4dbdb5b6f01cc2195a6948.tar.gz external_llvm-a97ff8a027259b1b9e4dbdb5b6f01cc2195a6948.tar.bz2 |
Avoid comparing invalid slot indexes, and assert that it doesn't happen.
The SlotIndex created by the default construction does not represent a position
in the function, and it doesn't make sense to compare it to other indexes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126924 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/CodeGen/SlotIndexes.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/llvm/CodeGen/SlotIndexes.h b/include/llvm/CodeGen/SlotIndexes.h index 8d3b1c0..153e520 100644 --- a/include/llvm/CodeGen/SlotIndexes.h +++ b/include/llvm/CodeGen/SlotIndexes.h @@ -135,6 +135,7 @@ namespace llvm { } IndexListEntry& entry() const { + assert(isValid() && "Attempt to compare reserved index."); return *lie.getPointer(); } @@ -530,7 +531,7 @@ namespace llvm { /// 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.entry().getInstr(); + return index.isValid() ? index.entry().getInstr() : 0; } /// Returns the next non-null index. |