From: Jakob Stoklund Olesen Date: Sun, 29 Jan 2012 01:29:25 +0000 (+0000) Subject: Avoid creating BitVector temporaries. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=685c23e75842e64145fe319efd792abe72a827dd;p=oota-llvm.git Avoid creating BitVector temporaries. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149188 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/RegisterScavenging.cpp b/lib/CodeGen/RegisterScavenging.cpp index 16c5898e168..7620cbbc42d 100644 --- a/lib/CodeGen/RegisterScavenging.cpp +++ b/lib/CodeGen/RegisterScavenging.cpp @@ -234,10 +234,10 @@ void RegScavenger::forward() { } void RegScavenger::getRegsUsed(BitVector &used, bool includeReserved) { - if (includeReserved) - used = ~RegsAvailable; - else - used = ~RegsAvailable & ~ReservedRegs; + used = RegsAvailable; + if (!includeReserved) + used |= ReservedRegs; + used.flip(); } unsigned RegScavenger::FindUnusedReg(const TargetRegisterClass *RC) const { @@ -352,9 +352,9 @@ unsigned RegScavenger::scavengeRegister(const TargetRegisterClass *RC, // RegsAvailable, as RegsAvailable does not take aliases into account. // That's what getRegsAvailable() is for. BitVector Available = getRegsAvailable(RC); - - if ((Candidates & Available).any()) - Candidates &= Available; + Available &= Candidates; + if (Available.any()) + Candidates = Available; // Find the register whose use is furthest away. MachineBasicBlock::iterator UseMI;