X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FTarget%2FPowerPC%2FPPCISelLowering.cpp;h=d196c10fae772d8a83a299261e43376973703088;hb=2823b3e70ee7a5ed7482c45c503659a16a879a61;hp=30525cffd067ea00f694f98850fa15518159caf1;hpb=85fd97dc8810ac16197594304f9f985a13466d19;p=oota-llvm.git diff --git a/lib/Target/PowerPC/PPCISelLowering.cpp b/lib/Target/PowerPC/PPCISelLowering.cpp index 30525cffd06..d196c10fae7 100644 --- a/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/lib/Target/PowerPC/PPCISelLowering.cpp @@ -691,6 +691,11 @@ PPCTargetLowering::LowerCallTo(SDOperand Chain, RetVals.push_back(ActualRetTyVT); RetVals.push_back(MVT::Other); + // If the callee is a GlobalAddress node (quite common, every direct call is) + // turn it into a TargetGlobalAddress node so that legalize doesn't hack it. + if (GlobalAddressSDNode *G = dyn_cast(Callee)) + Callee = DAG.getTargetGlobalAddress(G->getGlobal(), MVT::i32); + SDOperand TheCall = SDOperand(DAG.getCall(RetVals, Chain, Callee, args_to_use), 0); Chain = TheCall.getValue(RetTyVT != MVT::isVoid);