<div dir="ltr">Any test coverage?</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 28, 2015 at 3:50 PM, Manuel Jacob <span dir="ltr"><<a href="mailto:me@manueljacob.de" target="_blank">me@manueljacob.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: mjacob<br>
Date: Wed Jan 28 17:50:40 2015<br>
New Revision: 227397<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=227397&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=227397&view=rev</a><br>
Log:<br>
Add nullptr checks for TargetSelectionDAGInfo in SelectionDAG.<br>
<br>
TSI is not guaranteed be non-null in SelectionDAG.<br>
<br>
Modified:<br>
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp<br>
<br>
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=227397&r1=227396&r2=227397&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=227397&r1=227396&r2=227397&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Jan 28 17:50:40 2015<br>
@@ -4272,11 +4272,13 @@ SDValue SelectionDAG::getMemcpy(SDValue<br>
<br>
   // Then check to see if we should lower the memcpy with target-specific<br>
   // code. If the target chooses to do this, this is the next best.<br>
-  SDValue Result =<br>
-      TSI->EmitTargetCodeForMemcpy(*this, dl, Chain, Dst, Src, Size, Align,<br>
-                                   isVol, AlwaysInline, DstPtrInfo, SrcPtrInfo);<br>
-  if (Result.getNode())<br>
-    return Result;<br>
+  if (TSI) {<br>
+    SDValue Result = TSI->EmitTargetCodeForMemcpy(<br>
+        *this, dl, Chain, Dst, Src, Size, Align, isVol, AlwaysInline,<br>
+        DstPtrInfo, SrcPtrInfo);<br>
+    if (Result.getNode())<br>
+      return Result;<br>
+  }<br>
<br>
   // If we really need inline code and the target declined to provide it,<br>
   // use a (potentially long) sequence of loads and stores.<br>
@@ -4338,10 +4340,12 @@ SDValue SelectionDAG::getMemmove(SDValue<br>
<br>
   // Then check to see if we should lower the memmove with target-specific<br>
   // code. If the target chooses to do this, this is the next best.<br>
-  SDValue Result = TSI->EmitTargetCodeForMemmove(<br>
-      *this, dl, Chain, Dst, Src, Size, Align, isVol, DstPtrInfo, SrcPtrInfo);<br>
-  if (Result.getNode())<br>
-    return Result;<br>
+  if (TSI) {<br>
+    SDValue Result = TSI->EmitTargetCodeForMemmove(<br>
+        *this, dl, Chain, Dst, Src, Size, Align, isVol, DstPtrInfo, SrcPtrInfo);<br>
+    if (Result.getNode())<br>
+      return Result;<br>
+  }<br>
<br>
   // FIXME: If the memmove is volatile, lowering it to plain libc memmove may<br>
   // not be safe.  See memcpy above for more details.<br>
@@ -4390,10 +4394,12 @@ SDValue SelectionDAG::getMemset(SDValue<br>
<br>
   // Then check to see if we should lower the memset with target-specific<br>
   // code. If the target chooses to do this, this is the next best.<br>
-  SDValue Result = TSI->EmitTargetCodeForMemset(*this, dl, Chain, Dst, Src,<br>
-                                                Size, Align, isVol, DstPtrInfo);<br>
-  if (Result.getNode())<br>
-    return Result;<br>
+  if (TSI) {<br>
+    SDValue Result = TSI->EmitTargetCodeForMemset(<br>
+        *this, dl, Chain, Dst, Src, Size, Align, isVol, DstPtrInfo);<br>
+    if (Result.getNode())<br>
+      return Result;<br>
+  }<br>
<br>
   // Emit a library call.<br>
   Type *IntPtrTy = TLI->getDataLayout()->getIntPtrType(*getContext());<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>