Add target hook for whether it is profitable to reduce load widths
[oota-llvm.git] / include / llvm / Target / TargetLowering.h
index c0f2395eca67a656ad56706dd9084fa8c019f463..17cfe9d913becf63ea2959942fe1ee273492406b 100644 (file)
@@ -753,6 +753,16 @@ public:
   /// reduce runtime.
   virtual bool ShouldShrinkFPConstant(EVT) const { return true; }
 
+  // Return true if it is profitable to reduce the given load node to a smaller
+  // type.
+  //
+  // e.g. (i16 (trunc (i32 (load x))) -> i16 load x should be performed
+  virtual bool shouldReduceLoadWidth(SDNode *Load,
+                                     ISD::LoadExtType ExtTy,
+                                     EVT NewVT) const {
+    return true;
+  }
+
   /// When splitting a value of the specified type into parts, does the Lo
   /// or Hi part come first?  This usually follows the endianness, except
   /// for ppcf128, where the Hi part always comes first.