R600: Fix crashes when an illegal type load or store is not handled.

I don't think anything hits this now, but will be exposed in future
patches.

llvm-svn: 212197
diff --git a/llvm/lib/Target/R600/AMDGPUISelLowering.cpp b/llvm/lib/Target/R600/AMDGPUISelLowering.cpp
index 9258e15..64636de 100644
--- a/llvm/lib/Target/R600/AMDGPUISelLowering.cpp
+++ b/llvm/lib/Target/R600/AMDGPUISelLowering.cpp
@@ -556,6 +556,9 @@
     return;
   case ISD::LOAD: {
     SDNode *Node = LowerLOAD(SDValue(N, 0), DAG).getNode();
+    if (!Node)
+      return;
+
     Results.push_back(SDValue(Node, 0));
     Results.push_back(SDValue(Node, 1));
     // XXX: LLVM seems not to replace Chain Value inside CustomWidenLowerNode
@@ -564,8 +567,9 @@
     return;
   }
   case ISD::STORE: {
-    SDNode *Node = LowerSTORE(SDValue(N, 0), DAG).getNode();
-    Results.push_back(SDValue(Node, 0));
+    SDValue Lowered = LowerSTORE(SDValue(N, 0), DAG);
+    if (Lowered.getNode())
+      Results.push_back(Lowered);
     return;
   }
   default: