[PATCH] Assert in PBQP: A conservatively allocatable node should never be spilled.

Jonas Paulsson jonas.paulsson at ericsson.com
Fri Feb 6 04:26:13 PST 2015


I have polished up my patch for the assert regarding conservatively allocatable nodes. I find this assert to be desirable, as there is an implementation error somewhere if any of these nodes are spilled, but that is something that may not be detected, as most often the output is still legal. InlineSpiller only complains if a spilled register is spilled again, for instance.

Can I commit this or do you have any comments / opinion on this?

/Jonas Paulsson


>From 64ecd655faa1a1d133247fefc545472c042e6368 Mon Sep 17 00:00:00 2001
From: Jonas Paulsson <jonas.paulsson at ericsson.com>
Date: Wed, 28 Jan 2015 08:30:35 +0100
Subject: [PATCH] Assert in PBQP: A conservatively allocatable node should
never be spilled.

include/llvm/CodeGen/RegAllocPBQP.h | 16 ++++++++++++++++
1 file changed, 16 insertions(+)

diff --git a/include/llvm/CodeGen/RegAllocPBQP.h b/include/llvm/CodeGen/RegAllocPBQP.h
index cfa6160..140abed8 100644
--- a/include/llvm/CodeGen/RegAllocPBQP.h
+++ b/include/llvm/CodeGen/RegAllocPBQP.h
@@ -308,6 +308,13 @@ public:
     S = backpropagate(G, reduce());
+#ifndef NDEBUG
+    for (auto NId : WasConservativelyAllocables)
+      assert (S.getSelection(NId) != PBQP::RegAlloc::getSpillOptionIdx() &&
+              "A conservatively allocatable node was spilled!");
     return S;
@@ -464,6 +471,9 @@ private:
+#ifndef NDEBUG
+        WasConservativelyAllocables.insert(NId);
       } else if (!NotProvablyAllocatableNodes.empty()) {
         NodeSet::iterator NItr =
@@ -497,6 +507,12 @@ private:
   NodeSet OptimallyReducibleNodes;
   NodeSet ConservativelyAllocatableNodes;
   NodeSet NotProvablyAllocatableNodes;
+#ifndef NDEBUG
+  // A set of nodes to that were conservatively allocatable and are
+  // thus never supposed to be spilled.
+  NodeSet WasConservativelyAllocables;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150206/1d62f3e9/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Assert-in-PBQP-A-conservatively-allocatable-node-sho.patch
Type: application/octet-stream
Size: 1650 bytes
Desc: 0001-Assert-in-PBQP-A-conservatively-allocatable-node-sho.patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150206/1d62f3e9/attachment.obj>

More information about the llvm-commits mailing list