[llvm] r272903 - Refactor duplicated code. NFC.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 16 08:31:06 PDT 2016
Author: rafael
Date: Thu Jun 16 10:31:06 2016
New Revision: 272903
URL: http://llvm.org/viewvc/llvm-project?rev=272903&view=rev
Log:
Refactor duplicated code. NFC.
Modified:
llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=272903&r1=272902&r2=272903&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Thu Jun 16 10:31:06 2016
@@ -1798,6 +1798,9 @@ ARMTargetLowering::LowerCall(TargetLower
const TargetMachine &TM = getTargetMachine();
Reloc::Model RM = TM.getRelocationModel();
+ const GlobalValue *GV = nullptr;
+ if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee))
+ GV = G->getGlobal();
bool isARMFunc = false;
bool isLocalARMFunc = false;
@@ -1811,8 +1814,7 @@ ARMTargetLowering::LowerCall(TargetLower
// 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<GlobalAddressSDNode>(Callee)) {
- const GlobalValue *GV = G->getGlobal();
+ if (isa<GlobalAddressSDNode>(Callee)) {
// Create a constant pool entry for the callee address
unsigned ARMPCLabelIndex = AFI->createPICLabelUId();
ARMConstantPoolValue *CPV =
@@ -1841,8 +1843,7 @@ ARMTargetLowering::LowerCall(TargetLower
MachinePointerInfo::getConstantPool(DAG.getMachineFunction()), false,
false, false, 0);
}
- } else if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee)) {
- const GlobalValue *GV = G->getGlobal();
+ } else if (isa<GlobalAddressSDNode>(Callee)) {
isDirect = true;
bool isDef = GV->isStrongDefinitionForLinker();
const Triple &TargetTriple = TM.getTargetTriple();
More information about the llvm-commits
mailing list