diff options
Diffstat (limited to 'contrib/llvm/lib/CodeGen')
4 files changed, 22 insertions, 10 deletions
| diff --git a/contrib/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/contrib/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index 8cabad4ad312..154f81f2622d 100644 --- a/contrib/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/contrib/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -1836,7 +1836,10 @@ TypeIndex CodeViewDebug::lowerTypeMemberFunction(const DISubroutineType *Ty,    unsigned Index = 0;    SmallVector<TypeIndex, 8> ArgTypeIndices; -  TypeIndex ReturnTypeIndex = getTypeIndex(ReturnAndArgs[Index++]); +  TypeIndex ReturnTypeIndex = TypeIndex::Void(); +  if (ReturnAndArgs.size() > Index) { +    ReturnTypeIndex = getTypeIndex(ReturnAndArgs[Index++]); +  }    // If the first argument is a pointer type and this isn't a static method,    // treat it as the special 'this' parameter, which is encoded separately from diff --git a/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 1de2ffb6cfa1..18c5fe27b1a8 100644 --- a/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1956,8 +1956,10 @@ void DebugLocEntry::finalize(const AsmPrinter &AP,  void DwarfDebug::emitDebugLocEntryLocation(const DebugLocStream::Entry &Entry) {    // Emit the size.    Asm->OutStreamer->AddComment("Loc expr size"); -  Asm->emitInt16(DebugLocs.getBytes(Entry).size()); - +  if (getDwarfVersion() >= 5) +    Asm->EmitULEB128(DebugLocs.getBytes(Entry).size()); +  else +    Asm->emitInt16(DebugLocs.getBytes(Entry).size());    // Emit the entry.    APByteStreamer Streamer(*Asm);    emitDebugLocEntry(Streamer, Entry); diff --git a/contrib/llvm/lib/CodeGen/MachineInstr.cpp b/contrib/llvm/lib/CodeGen/MachineInstr.cpp index 764a84c7e132..dc1ad953e71d 100644 --- a/contrib/llvm/lib/CodeGen/MachineInstr.cpp +++ b/contrib/llvm/lib/CodeGen/MachineInstr.cpp @@ -225,12 +225,13 @@ void MachineInstr::addOperand(MachineFunction &MF, const MachineOperand &Op) {    }  #ifndef NDEBUG -  bool isMetaDataOp = Op.getType() == MachineOperand::MO_Metadata; +  bool isDebugOp = Op.getType() == MachineOperand::MO_Metadata || +                   Op.getType() == MachineOperand::MO_MCSymbol;    // OpNo now points as the desired insertion point.  Unless this is a variadic    // instruction, only implicit regs are allowed beyond MCID->getNumOperands().    // RegMask operands go between the explicit and implicit operands.    assert((isImpReg || Op.isRegMask() || MCID->isVariadic() || -          OpNo < MCID->getNumOperands() || isMetaDataOp) && +          OpNo < MCID->getNumOperands() || isDebugOp) &&           "Trying to add an operand to a machine instr that is already done!");  #endif diff --git a/contrib/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/contrib/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index ff5505c97721..6af01423ca10 100644 --- a/contrib/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/contrib/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -16214,23 +16214,29 @@ static SDValue reduceBuildVecToShuffleWithZero(SDNode *BV, SelectionDAG &DAG) {    // The build vector contains some number of undef elements and exactly    // one other element. That other element must be a zero-extended scalar    // extracted from a vector at a constant index to turn this into a shuffle. +  // Also, require that the build vector does not implicitly truncate/extend +  // its elements.    // TODO: This could be enhanced to allow ANY_EXTEND as well as ZERO_EXTEND. +  EVT VT = BV->getValueType(0);    SDValue Zext = BV->getOperand(ZextElt);    if (Zext.getOpcode() != ISD::ZERO_EXTEND || !Zext.hasOneUse() ||        Zext.getOperand(0).getOpcode() != ISD::EXTRACT_VECTOR_ELT || -      !isa<ConstantSDNode>(Zext.getOperand(0).getOperand(1))) +      !isa<ConstantSDNode>(Zext.getOperand(0).getOperand(1)) || +      Zext.getValueSizeInBits() != VT.getScalarSizeInBits())      return SDValue(); -  // The zero-extend must be a multiple of the source size. +  // The zero-extend must be a multiple of the source size, and we must be +  // building a vector of the same size as the source of the extract element.    SDValue Extract = Zext.getOperand(0);    unsigned DestSize = Zext.getValueSizeInBits();    unsigned SrcSize = Extract.getValueSizeInBits(); -  if (DestSize % SrcSize != 0) +  if (DestSize % SrcSize != 0 || +      Extract.getOperand(0).getValueSizeInBits() != VT.getSizeInBits())      return SDValue();    // Create a shuffle mask that will combine the extracted element with zeros    // and undefs. -  int ZextRatio =  DestSize / SrcSize; +  int ZextRatio = DestSize / SrcSize;    int NumMaskElts = NumBVOps * ZextRatio;    SmallVector<int, 32> ShufMask(NumMaskElts, -1);    for (int i = 0; i != NumMaskElts; ++i) { @@ -16260,7 +16266,7 @@ static SDValue reduceBuildVecToShuffleWithZero(SDNode *BV, SelectionDAG &DAG) {    SDValue ZeroVec = DAG.getConstant(0, DL, VecVT);    SDValue Shuf = DAG.getVectorShuffle(VecVT, DL, Extract.getOperand(0), ZeroVec,                                        ShufMask); -  return DAG.getBitcast(BV->getValueType(0), Shuf); +  return DAG.getBitcast(VT, Shuf);  }  // Check to see if this is a BUILD_VECTOR of a bunch of EXTRACT_VECTOR_ELT | 
