[PATCH] D22216: [ARM] Prefer indirect calls in minsize mode

Chad Rosier via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 13 06:52:01 PDT 2016


mcrosier accepted this revision.
mcrosier added a comment.
This revision is now accepted and ready to land.

LGTM.


================
Comment at: lib/Target/ARM/ARMISelLowering.cpp:1852
@@ -1851,24 +1851,3 @@
   } else if (isa<GlobalAddressSDNode>(Callee)) {
-    isDirect = true;
-    bool isDef = GV->isStrongDefinitionForLinker();
-
-    // ARM call to a local ARM function is predicable.
-    isLocalARMFunc = !Subtarget->isThumb() && (isDef || !ARMInterworking);
-    // tBX takes a register source operand.
-    if (isStub && Subtarget->isThumb1Only() && !Subtarget->hasV5TOps()) {
-      assert(Subtarget->isTargetMachO() && "WrapperPIC use on non-MachO?");
-      Callee = DAG.getNode(
-          ARMISD::WrapperPIC, dl, PtrVt,
-          DAG.getTargetGlobalAddress(GV, dl, PtrVt, 0, ARMII::MO_NONLAZY));
-      Callee = DAG.getLoad(PtrVt, dl, DAG.getEntryNode(), Callee,
-                           MachinePointerInfo::getGOT(DAG.getMachineFunction()),
-                           false, false, true, 0);
-    } else if (Subtarget->isTargetCOFF()) {
-      assert(Subtarget->isTargetWindows() &&
-             "Windows is the only supported COFF target");
-      unsigned TargetFlags = GV->hasDLLImportStorageClass()
-                                 ? ARMII::MO_DLLIMPORT
-                                 : ARMII::MO_NO_FLAG;
-      Callee =
-          DAG.getTargetGlobalAddress(GV, dl, PtrVt, /*Offset=*/0, TargetFlags);
-      if (GV->hasDLLImportStorageClass())
+    // If we're optimizing for minimum size and the function is called many
+    // times in this block, we can improve codesize by calling indirectly
----------------
many times -> three or more times


Repository:
  rL LLVM

http://reviews.llvm.org/D22216





More information about the llvm-commits mailing list