From cc2912ac989c19c2a35b1d13c86ad1eeee6124e3 Mon Sep 17 00:00:00 2001
From: Maria Kotsifakou <kotsifa2@illinois.edu>
Date: Wed, 9 Aug 2017 19:09:55 -0500
Subject: [PATCH] Bug fix: no code generation should be attempted by the X86
 backend for allocation nodes.

---
 llvm/lib/Transforms/DFG2LLVM_X86/DFG2LLVM_X86.cpp | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/llvm/lib/Transforms/DFG2LLVM_X86/DFG2LLVM_X86.cpp b/llvm/lib/Transforms/DFG2LLVM_X86/DFG2LLVM_X86.cpp
index 13eef916e8..9f94bf237d 100644
--- a/llvm/lib/Transforms/DFG2LLVM_X86/DFG2LLVM_X86.cpp
+++ b/llvm/lib/Transforms/DFG2LLVM_X86/DFG2LLVM_X86.cpp
@@ -1659,6 +1659,16 @@ void CGT_X86::codeGen(DFLeafNode* N) {
     return;
   }
 
+  // At this point, the X86 backend does not support code generation for
+  // the case where allocation node is used, so we skip. This means that a
+  // CPU version will not be created, and therefore code generation will
+  // only succeed if another backend (nvptx or spir) has been invoked to
+  // generate a node function for the node including the allocation node.
+  if (N->isAllocationNode()) {
+    DEBUG(errs() << "Skipping allocation node\n");
+    return;
+  }
+
   // Check if clone already exists. If it does, it means we have visited this
   // function before and nothing else needs to be done for this leaf node.
 //  if(N->getGenFunc() != NULL)
-- 
GitLab