diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index cd2a1eb4b61a..6d8e0de1e847 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -641,14 +641,18 @@ namespace { // Classify the origin of a stored value. enum class StoreSource { Unknown, Constant, Extract, Load }; StoreSource getStoreSource(SDValue StoreVal) { - if (isa(StoreVal) || isa(StoreVal)) + switch (StoreVal.getOpcode()) { + case ISD::Constant: + case ISD::ConstantFP: return StoreSource::Constant; - if (StoreVal.getOpcode() == ISD::EXTRACT_VECTOR_ELT || - StoreVal.getOpcode() == ISD::EXTRACT_SUBVECTOR) + case ISD::EXTRACT_VECTOR_ELT: + case ISD::EXTRACT_SUBVECTOR: return StoreSource::Extract; - if (isa(StoreVal)) + case ISD::LOAD: return StoreSource::Load; - return StoreSource::Unknown; + default: + return StoreSource::Unknown; + } } /// This is a helper function for visitMUL to check the profitability