Fix a bug in the code which custom-lowers truncating stores in LegalizeDAG.
authorAkira Hatanaka <ahatanaka@mips.com>
Sat, 2 Jun 2012 01:10:34 +0000 (01:10 +0000)
committerAkira Hatanaka <ahatanaka@mips.com>
Sat, 2 Jun 2012 01:10:34 +0000 (01:10 +0000)
Check that the SDValue TargetLowering::LowerOperation returns is not null
before replacing the original node with the returned node.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157873 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

index 7ba744252798fa4920ecea4cce3789503f456923..c2972b051f7b59395ba7e1771385e11c675c0fb4 100644 (file)
@@ -1312,8 +1312,9 @@ void SelectionDAGLegalize::LegalizeOp(SDNode *Node) {
           }
           break;
         case TargetLowering::Custom:
-          ReplaceNode(SDValue(Node, 0),
-                      TLI.LowerOperation(SDValue(Node, 0), DAG));
+          Tmp1 = TLI.LowerOperation(SDValue(Node, 0), DAG);
+          if (Tmp1.getNode())
+            ReplaceNode(SDValue(Node, 0), Tmp1);
           break;
         case TargetLowering::Expand:
           assert(!StVT.isVector() &&