From: Rafael Espindola Date: Thu, 16 Jun 2016 15:31:06 +0000 (+0000) Subject: Refactor duplicated code. NFC. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bb6bdeccf19610377dd9f101f617efeb8308dd37;p=llvm Refactor duplicated code. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272903 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/ARM/ARMISelLowering.cpp b/lib/Target/ARM/ARMISelLowering.cpp index 021c870c624..4ef14ade068 100644 --- a/lib/Target/ARM/ARMISelLowering.cpp +++ b/lib/Target/ARM/ARMISelLowering.cpp @@ -1798,6 +1798,9 @@ ARMTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI, const TargetMachine &TM = getTargetMachine(); Reloc::Model RM = TM.getRelocationModel(); + const GlobalValue *GV = nullptr; + if (GlobalAddressSDNode *G = dyn_cast(Callee)) + GV = G->getGlobal(); bool isARMFunc = false; bool isLocalARMFunc = false; @@ -1811,8 +1814,7 @@ ARMTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI, // Handle a global address or an external symbol. If it's not one of // those, the target's already in a register, so we don't need to do // anything extra. - if (GlobalAddressSDNode *G = dyn_cast(Callee)) { - const GlobalValue *GV = G->getGlobal(); + if (isa(Callee)) { // Create a constant pool entry for the callee address unsigned ARMPCLabelIndex = AFI->createPICLabelUId(); ARMConstantPoolValue *CPV = @@ -1841,8 +1843,7 @@ ARMTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI, MachinePointerInfo::getConstantPool(DAG.getMachineFunction()), false, false, false, 0); } - } else if (GlobalAddressSDNode *G = dyn_cast(Callee)) { - const GlobalValue *GV = G->getGlobal(); + } else if (isa(Callee)) { isDirect = true; bool isDef = GV->isStrongDefinitionForLinker(); const Triple &TargetTriple = TM.getTargetTriple();