From 5fc742d5b2b647b3dce2c9ba943a2499d980c347 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Mon, 19 Jan 2009 18:31:51 +0000 Subject: [PATCH] Handle ISD::DECLARE with PIC relocation model. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62516 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/PowerPC/PPCISelDAGToDAG.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/Target/PowerPC/PPCISelDAGToDAG.cpp b/lib/Target/PowerPC/PPCISelDAGToDAG.cpp index 276abe77bf3..c43acdb5c2e 100644 --- a/lib/Target/PowerPC/PPCISelDAGToDAG.cpp +++ b/lib/Target/PowerPC/PPCISelDAGToDAG.cpp @@ -1107,10 +1107,21 @@ SDNode *PPCDAGToDAGISel::Select(SDValue Op) { FrameIndexSDNode *FINode = dyn_cast(N1); if (!FINode) break; - if (N2.getOpcode() == ISD::ADD && - N2.getOperand(0).getOpcode() == PPCISD::Hi && - N2.getOperand(1).getOpcode() == PPCISD::Lo) - N2 = N2.getOperand(0).getOperand(0); + if (N2.getOpcode() == ISD::ADD) { + if (N2.getOperand(0).getOpcode() == ISD::ADD && + N2.getOperand(0).getOperand(0).getOpcode() == PPCISD::GlobalBaseReg && + N2.getOperand(0).getOperand(1).getOpcode() == PPCISD::Hi && + N2.getOperand(1).getOpcode() == PPCISD::Lo) + N2 = N2.getOperand(0).getOperand(1).getOperand(0); + else if (N2.getOperand(0).getOpcode() == ISD::ADD && + N2.getOperand(0).getOperand(0).getOpcode() == PPCISD::GlobalBaseReg && + N2.getOperand(0).getOperand(1).getOpcode() == PPCISD::Lo && + N2.getOperand(1).getOpcode() == PPCISD::Hi) + N2 = N2.getOperand(0).getOperand(1).getOperand(0); + else if (N2.getOperand(0).getOpcode() == PPCISD::Hi && + N2.getOperand(1).getOpcode() == PPCISD::Lo) + N2 = N2.getOperand(0).getOperand(0); + } if (!isa(N2)) break; int FI = cast(N1)->getIndex();