Make sure SEXTLOAD of the specific type is supported on the target.
llvm-svn: 35289
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index df951a5..569b1a9 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -2272,9 +2272,13 @@
MVT::ValueType VT = N->getValueType(0);
MVT::ValueType EVT = N->getValueType(0);
+ // Special case: SIGN_EXTEND_INREG is basically truncating to EVT then
+ // extended to VT.
if (Opc == ISD::SIGN_EXTEND_INREG) {
ExtType = ISD::SEXTLOAD;
EVT = cast<VTSDNode>(N->getOperand(1))->getVT();
+ if (AfterLegalize && !TLI.isLoadXLegal(ISD::SEXTLOAD, EVT))
+ return SDOperand();
}
unsigned EVTBits = MVT::getSizeInBits(EVT);