From c6166c6bcaf41acab5f14aa267acec3214b75127 Mon Sep 17 00:00:00 2001 From: Kalle Raiskila Date: Wed, 9 Jun 2010 08:29:41 +0000 Subject: [PATCH] Handle loading from/storing to undef pointers on SPU by inserting a random load/store, rather than crashing llc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105710 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/CellSPU/SPUISelDAGToDAG.cpp | 4 +++- test/CodeGen/CellSPU/loads.ll | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/Target/CellSPU/SPUISelDAGToDAG.cpp b/lib/Target/CellSPU/SPUISelDAGToDAG.cpp index bfb57d36136..f76ad763848 100644 --- a/lib/Target/CellSPU/SPUISelDAGToDAG.cpp +++ b/lib/Target/CellSPU/SPUISelDAGToDAG.cpp @@ -606,7 +606,9 @@ SPUDAGToDAGISel::DFormAddressPredicate(SDNode *Op, SDValue N, SDValue &Base, Base = CurDAG->getTargetConstant(0, N.getValueType()); Index = N; return true; - } else if (Opc == ISD::Register || Opc == ISD::CopyFromReg) { + } else if (Opc == ISD::Register + ||Opc == ISD::CopyFromReg + ||Opc == ISD::UNDEF) { unsigned OpOpc = Op->getOpcode(); if (OpOpc == ISD::STORE || OpOpc == ISD::LOAD) { diff --git a/test/CodeGen/CellSPU/loads.ll b/test/CodeGen/CellSPU/loads.ll index 37c6d4f1517..c46bcd18c15 100644 --- a/test/CodeGen/CellSPU/loads.ll +++ b/test/CodeGen/CellSPU/loads.ll @@ -31,3 +31,8 @@ define <4 x i32> @func() { ret <4 x i32> %rv3 } +define <4 x float> @load_undef(){ + ;CHECK lqd $3, 0($3) + %val = load <4 x float>* undef + ret <4 x float> %val +}