[PATCH] D11008: CodeGenPrepare: add target hook to enable address sinking using GEPs

escha escha at apple.com
Tue Jul 7 11:32:30 PDT 2015


escha added reviewers: resistor, echristo, arsenm.
escha added a subscriber: llvm-commits.

Split from my previous review and turned into a TLI option.

Repository:
  rL LLVM

http://reviews.llvm.org/D11008

Files:
  include/llvm/Target/TargetLowering.h
  lib/CodeGen/CodeGenPrepare.cpp

Index: include/llvm/Target/TargetLowering.h
===================================================================
--- include/llvm/Target/TargetLowering.h
+++ include/llvm/Target/TargetLowering.h
@@ -1695,6 +1695,12 @@
     return false;
   }
 
+  /// Return true if CodeGenPrepare should sink addresses using GetElementPtr
+  /// instructions.
+  virtual bool shouldSinkAddressUsingGEP() const {
+    return false;
+  }
+
   //===--------------------------------------------------------------------===//
   // Runtime Library hooks
   //
Index: lib/CodeGen/CodeGenPrepare.cpp
===================================================================
--- lib/CodeGen/CodeGenPrepare.cpp
+++ lib/CodeGen/CodeGenPrepare.cpp
@@ -3316,7 +3328,7 @@
                  << *MemoryInst << "\n");
     if (SunkAddr->getType() != Addr->getType())
       SunkAddr = Builder.CreateBitCast(SunkAddr, Addr->getType());
-  } else if (AddrSinkUsingGEPs ||
+  } else if (AddrSinkUsingGEPs || TLI->shouldSinkAddressUsingGEP() ||
              (!AddrSinkUsingGEPs.getNumOccurrences() && TM &&
               TM->getSubtargetImpl(*MemoryInst->getParent()->getParent())
                   ->useAA())) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11008.29198.patch
Type: text/x-patch
Size: 1172 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150707/e99572a8/attachment.bin>


More information about the llvm-commits mailing list