From: Jakob Stoklund Olesen Date: Tue, 19 Feb 2013 18:41:01 +0000 (+0000) Subject: Assert that the target provided hints are in the allocation order. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=da5f1ed6406442735fbb4421f8a22bc8a41d4c57;p=oota-llvm.git Assert that the target provided hints are in the allocation order. Target implementations of getRegAllocationHints() should use the provided allocation order, and they can never return hints outside the order. This is already documented in TargetRegisterInfo.h. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175540 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/AllocationOrder.cpp b/lib/CodeGen/AllocationOrder.cpp index 1d09d20f031..3fa1f8ff206 100644 --- a/lib/CodeGen/AllocationOrder.cpp +++ b/lib/CodeGen/AllocationOrder.cpp @@ -44,4 +44,9 @@ AllocationOrder::AllocationOrder(unsigned VirtReg, dbgs() << '\n'; } }); +#ifndef NDEBUG + for (unsigned I = 0, E = Hints.size(); I != E; ++I) + assert(std::find(Order.begin(), Order.end(), Hints[I]) != Order.end() && + "Target hint is outside allocation order."); +#endif }