[LLVMdev] Possible LiveInterval Bug
Evan Cheng
evan.cheng at apple.com
Wed Jan 30 00:02:26 PST 2008
AFAIK std::upper_bound() would not return end(), right?
Evan
On Jan 29, 2008, at 3:08 PM, David Greene wrote:
> I just ran into a problem here. I'm in SimpleRegisterCoalescing at
> the point
> where EXTRACT_SUBREG coalescing updates live ranges of aliased
> registers (around line 473 of SimpleRegisterCoalescing.cpp).
>
> There's a call to MergeValueInAsValue at line 50.
> MergeValueInAsValue has
> this code:
>
> void LiveInterval::MergeValueInAsValue(const LiveInterval &RHS,
> const VNInfo *RHSValNo, VNInfo
> *LHSValNo)
> {
> SmallVector<VNInfo*, 4> ReplacedValNos;
> iterator IP = begin();
> for (const_iterator I = RHS.begin(), E = RHS.end(); I != E; ++I) {
> if (I->valno != RHSValNo)
> continue;
> unsigned Start = I->start, End = I->end;
> IP = std::upper_bound(IP, end(), Start);
> // If the start of this range overlaps with an existing
> liverange, trim
> it.
> if (IP != begin() && IP[-1].end > Start) {
> if (IP->valno != LHSValNo) {
> ReplacedValNos.push_back(IP->valno);
>
> What happens if IP == end()? We're pushing bogus information onto
> ReplacedvalNos (IP->valno is not valid).
>
> Is this a bug or should IP never be end() at this point? If the
> latter is
> true then I've got a bug somewhere else I need to hunt down.
>
> -Dave
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
More information about the llvm-dev
mailing list