From 3336b1f06b68f3cb9e9c9601b3139160d82f84d8 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 26 Nov 2008 05:50:31 +0000 Subject: [PATCH] LiveRanges are represented as half-open ranges. Fix the findLiveInMBBs code and the LiveInterval.h top-level comment and accordingly. This fixes blocks having spurious live-in registers in boundary cases. llvm-svn: 60092 --- llvm/include/llvm/CodeGen/LiveInterval.h | 2 +- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/include/llvm/CodeGen/LiveInterval.h b/llvm/include/llvm/CodeGen/LiveInterval.h index 024ca92af9f7..7ef24897d4be 100644 --- a/llvm/include/llvm/CodeGen/LiveInterval.h +++ b/llvm/include/llvm/CodeGen/LiveInterval.h @@ -9,7 +9,7 @@ // // This file implements the LiveRange and LiveInterval classes. Given some // numbering of each the machine instructions an interval [i, j) is said to be a -// live interval for register v if there is no instruction with number j' > j +// live interval for register v if there is no instruction with number j' >= j // such that v is live at j' and there is no instruction with number i' < i such // that v is live at i'. In this implementation intervals can have holes, // i.e. an interval might look like [1,20), [50,65), [1000,1001). Each diff --git a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp index 2a979e19eb56..1de31b9da2cf 100644 --- a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp +++ b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp @@ -750,7 +750,7 @@ bool LiveIntervals::findLiveInMBBs(unsigned Start, unsigned End, bool ResVal = false; while (I != Idx2MBBMap.end()) { - if (I->first > End) + if (I->first >= End) break; MBBs.push_back(I->second); ResVal = true;