diff options
Diffstat (limited to 'llvm/lib/Target/X86/X86ISelLowering.cpp')
| -rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 12 | 
1 files changed, 9 insertions, 3 deletions
| diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 370ecefd273..3cab44b0ac1 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -4941,8 +4941,9 @@ bool X86TargetLowering::isCheapToSpeculateCtlz() const {    return Subtarget.hasLZCNT();  } -bool X86TargetLowering::isLoadBitCastBeneficial(EVT LoadVT, -                                                EVT BitcastVT) const { +bool X86TargetLowering::isLoadBitCastBeneficial(EVT LoadVT, EVT BitcastVT, +                                                const SelectionDAG &DAG, +                                                const MachineMemOperand &MMO) const {    if (!Subtarget.hasAVX512() && !LoadVT.isVector() && BitcastVT.isVector() &&        BitcastVT.getVectorElementType() == MVT::i1)      return false; @@ -4950,7 +4951,12 @@ bool X86TargetLowering::isLoadBitCastBeneficial(EVT LoadVT,    if (!Subtarget.hasDQI() && BitcastVT == MVT::v8i1 && LoadVT == MVT::i8)      return false; -  return TargetLowering::isLoadBitCastBeneficial(LoadVT, BitcastVT); +  // If both types are legal vectors, it's always ok to convert them. +  if (LoadVT.isVector() && BitcastVT.isVector() && +      isTypeLegal(LoadVT) && isTypeLegal(BitcastVT)) +    return true; + +  return TargetLowering::isLoadBitCastBeneficial(LoadVT, BitcastVT, DAG, MMO);  }  bool X86TargetLowering::canMergeStoresTo(unsigned AddressSpace, EVT MemVT, | 

