From: Justin Holewinski Date: Thu, 5 Dec 2013 12:58:00 +0000 (+0000) Subject: [NVPTX] Fix off-by-one error when creating the VT list for an SDNode X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=7add5421a686877e0aa87616b92b1f5a85c6feee;p=oota-llvm.git [NVPTX] Fix off-by-one error when creating the VT list for an SDNode git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196503 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp b/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp index 4b8b306a705..fc0c84d205b 100644 --- a/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp +++ b/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp @@ -2014,7 +2014,7 @@ SDNode *NVPTXDAGToDAGISel::SelectLoadParam(SDNode *Node) { VTs = CurDAG->getVTList(EltVT, EltVT, MVT::Other, MVT::Glue); } else { EVT EVTs[] = { EltVT, EltVT, EltVT, EltVT, MVT::Other, MVT::Glue }; - VTs = CurDAG->getVTList(&EVTs[0], 5); + VTs = CurDAG->getVTList(&EVTs[0], array_lengthof(EVTs)); } unsigned OffsetVal = cast(Offset)->getZExtValue(); diff --git a/test/CodeGen/NVPTX/ldparam-v4.ll b/test/CodeGen/NVPTX/ldparam-v4.ll new file mode 100644 index 00000000000..ec306aafe85 --- /dev/null +++ b/test/CodeGen/NVPTX/ldparam-v4.ll @@ -0,0 +1,10 @@ +; RUN: llc < %s -march=nvptx -mcpu=sm_20 | FileCheck %s + +declare <4 x float> @bar() + +define void @foo(<4 x float>* %ptr) { +; CHECK: ld.param.v4.f32 + %val = tail call <4 x float> @bar() + store <4 x float> %val, <4 x float>* %ptr + ret void +}