From: Chris Lattner Date: Thu, 12 Feb 2009 17:38:23 +0000 (+0000) Subject: fix PR3538 for ARM. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8c4d1b2bcfa63d064a7bcbd9cd23ebe3b282f853;p=oota-llvm.git fix PR3538 for ARM. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64384 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/ARM/ARMISelDAGToDAG.cpp b/lib/Target/ARM/ARMISelDAGToDAG.cpp index f45accc4f3e..d48b32af613 100644 --- a/lib/Target/ARM/ARMISelDAGToDAG.cpp +++ b/lib/Target/ARM/ARMISelDAGToDAG.cpp @@ -837,13 +837,18 @@ SDNode *ARMDAGToDAGISel::Select(SDValue Op) { SDValue N1 = Op.getOperand(1); SDValue N2 = Op.getOperand(2); FrameIndexSDNode *FINode = dyn_cast(N1); - if (!FINode) - break; + // FIXME: handle VLAs. + if (!FINode) { + ReplaceUses(Op.getValue(0), Chain); + return NULL; + } if (N2.getOpcode() == ARMISD::PIC_ADD && isa(N2.getOperand(0))) N2 = N2.getOperand(0); LoadSDNode *Ld = dyn_cast(N2); - if (!Ld) - break; + if (!Ld) { + ReplaceUses(Op.getValue(0), Chain); + return NULL; + } SDValue BasePtr = Ld->getBasePtr(); assert(BasePtr.getOpcode() == ARMISD::Wrapper && isa(BasePtr.getOperand(0)) && @@ -855,15 +860,17 @@ SDNode *ARMDAGToDAGISel::Select(SDValue Op) { GV = ACPV->getGV(); } else GV = dyn_cast(CP->getConstVal()); - if (GV) { - SDValue Tmp1 = CurDAG->getTargetFrameIndex(FINode->getIndex(), - TLI.getPointerTy()); - SDValue Tmp2 = CurDAG->getTargetGlobalAddress(GV, TLI.getPointerTy()); - SDValue Ops[] = { Tmp1, Tmp2, Chain }; - return CurDAG->getTargetNode(TargetInstrInfo::DECLARE, dl, - MVT::Other, Ops, 3); + if (!GV) { + ReplaceUses(Op.getValue(0), Chain); + return NULL; } - break; + + SDValue Tmp1 = CurDAG->getTargetFrameIndex(FINode->getIndex(), + TLI.getPointerTy()); + SDValue Tmp2 = CurDAG->getTargetGlobalAddress(GV, TLI.getPointerTy()); + SDValue Ops[] = { Tmp1, Tmp2, Chain }; + return CurDAG->getTargetNode(TargetInstrInfo::DECLARE, dl, + MVT::Other, Ops, 3); } }