Add target hook for whether it is profitable to reduce load widths
[oota-llvm.git] / lib / CodeGen / SelectionDAG / DAGCombiner.cpp
index 38a06618a8c38bd3a09b062ec7f10bcd6fa1a32f..ed3d06cc9208885f654dd1ab8d898a77ca1277b2 100644 (file)
@@ -6036,6 +6036,9 @@ SDValue DAGCombiner::ReduceLoadWidth(SDNode *N) {
       LN0->getMemoryVT().getSizeInBits() < ExtVT.getSizeInBits() + ShAmt)
     return SDValue();
 
+  if (!TLI.shouldReduceLoadWidth(LN0, ExtType, ExtVT))
+    return SDValue();
+
   EVT PtrType = N0.getOperand(1).getValueType();
 
   if (PtrType == MVT::Untyped || PtrType.isExtended())