1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

Simplify creation of a bunch of ArrayRefs by using None, makeArrayRef or just letting them be implicitly created.

llvm-svn: 216525
This commit is contained in:
Craig Topper 2014-08-27 05:25:25 +00:00
parent d133367f2d
commit 43cee2f5fc
40 changed files with 102 additions and 131 deletions

View File

@ -99,7 +99,7 @@ public:
// implicit conversion operator to ArrayRef. // implicit conversion operator to ArrayRef.
operator ArrayRef<EltTy>() const { operator ArrayRef<EltTy>() const {
if (Val.isNull()) if (Val.isNull())
return ArrayRef<EltTy>(); return None;
if (Val.template is<EltTy>()) if (Val.template is<EltTy>())
return *Val.getAddrOfPtr1(); return *Val.getAddrOfPtr1();
return *Val.template get<VecTy*>(); return *Val.template get<VecTy*>();

View File

@ -105,7 +105,7 @@ template <typename ResultT, typename ArgT,
ResultT (*Func)(ArrayRef<const ArgT *>)> ResultT (*Func)(ArrayRef<const ArgT *>)>
struct VariadicFunction { struct VariadicFunction {
ResultT operator()() const { ResultT operator()() const {
return Func(ArrayRef<const ArgT *>()); return Func(None);
} }
#define LLVM_DEFINE_OVERLOAD(N) \ #define LLVM_DEFINE_OVERLOAD(N) \
@ -152,7 +152,7 @@ template <typename ResultT, typename Param0T, typename ArgT,
ResultT (*Func)(Param0T, ArrayRef<const ArgT *>)> ResultT (*Func)(Param0T, ArrayRef<const ArgT *>)>
struct VariadicFunction1 { struct VariadicFunction1 {
ResultT operator()(Param0T P0) const { ResultT operator()(Param0T P0) const {
return Func(P0, ArrayRef<const ArgT *>()); return Func(P0, None);
} }
#define LLVM_DEFINE_OVERLOAD(N) \ #define LLVM_DEFINE_OVERLOAD(N) \
@ -199,7 +199,7 @@ template <typename ResultT, typename Param0T, typename Param1T, typename ArgT,
ResultT (*Func)(Param0T, Param1T, ArrayRef<const ArgT *>)> ResultT (*Func)(Param0T, Param1T, ArrayRef<const ArgT *>)>
struct VariadicFunction2 { struct VariadicFunction2 {
ResultT operator()(Param0T P0, Param1T P1) const { ResultT operator()(Param0T P0, Param1T P1) const {
return Func(P0, P1, ArrayRef<const ArgT *>()); return Func(P0, P1, None);
} }
#define LLVM_DEFINE_OVERLOAD(N) \ #define LLVM_DEFINE_OVERLOAD(N) \
@ -248,7 +248,7 @@ template <typename ResultT, typename Param0T, typename Param1T,
ResultT (*Func)(Param0T, Param1T, Param2T, ArrayRef<const ArgT *>)> ResultT (*Func)(Param0T, Param1T, Param2T, ArrayRef<const ArgT *>)>
struct VariadicFunction3 { struct VariadicFunction3 {
ResultT operator()(Param0T P0, Param1T P1, Param2T P2) const { ResultT operator()(Param0T P0, Param1T P1, Param2T P2) const {
return Func(P0, P1, P2, ArrayRef<const ArgT *>()); return Func(P0, P1, P2, None);
} }
#define LLVM_DEFINE_OVERLOAD(N) \ #define LLVM_DEFINE_OVERLOAD(N) \

View File

@ -587,8 +587,7 @@ public:
InvokeInst *CreateInvoke(Value *Callee, BasicBlock *NormalDest, InvokeInst *CreateInvoke(Value *Callee, BasicBlock *NormalDest,
BasicBlock *UnwindDest, const Twine &Name = "") { BasicBlock *UnwindDest, const Twine &Name = "") {
return Insert(InvokeInst::Create(Callee, NormalDest, UnwindDest, return Insert(InvokeInst::Create(Callee, NormalDest, UnwindDest, None),
ArrayRef<Value *>()),
Name); Name);
} }
InvokeInst *CreateInvoke(Value *Callee, BasicBlock *NormalDest, InvokeInst *CreateInvoke(Value *Callee, BasicBlock *NormalDest,

View File

@ -185,7 +185,7 @@ public:
/// convenience method for passes to do so. /// convenience method for passes to do so.
void dropUnknownMetadata(ArrayRef<unsigned> KnownIDs); void dropUnknownMetadata(ArrayRef<unsigned> KnownIDs);
void dropUnknownMetadata() { void dropUnknownMetadata() {
return dropUnknownMetadata(ArrayRef<unsigned>()); return dropUnknownMetadata(None);
} }
void dropUnknownMetadata(unsigned ID1) { void dropUnknownMetadata(unsigned ID1) {
return dropUnknownMetadata(makeArrayRef(ID1)); return dropUnknownMetadata(makeArrayRef(ID1));

View File

@ -540,7 +540,7 @@ ELFFile<ELFT>::getSectionContents(const Elf_Shdr *Sec) const {
if (Sec->sh_offset + Sec->sh_size > Buf.size()) if (Sec->sh_offset + Sec->sh_size > Buf.size())
return object_error::parse_failed; return object_error::parse_failed;
const uint8_t *Start = base() + Sec->sh_offset; const uint8_t *Start = base() + Sec->sh_offset;
return ArrayRef<uint8_t>(Start, Sec->sh_size); return makeArrayRef(Start, Sec->sh_size);
} }
template <class ELFT> template <class ELFT>

View File

@ -350,7 +350,7 @@ struct ExceptionDataRecord {
ArrayRef<support::ulittle32_t> EpilogueScopes() const { ArrayRef<support::ulittle32_t> EpilogueScopes() const {
assert(E() == 0 && "epilogue scopes are only present when the E bit is 0"); assert(E() == 0 && "epilogue scopes are only present when the E bit is 0");
size_t Offset = HeaderWords(*this); size_t Offset = HeaderWords(*this);
return ArrayRef<support::ulittle32_t>(&Data[Offset], EpilogueCount()); return makeArrayRef(&Data[Offset], EpilogueCount());
} }
ArrayRef<support::ulittle8_t> UnwindByteCode() const { ArrayRef<support::ulittle8_t> UnwindByteCode() const {
@ -358,8 +358,7 @@ struct ExceptionDataRecord {
+ (E() ? 0 : EpilogueCount()); + (E() ? 0 : EpilogueCount());
const support::ulittle8_t *ByteCode = const support::ulittle8_t *ByteCode =
reinterpret_cast<const support::ulittle8_t *>(&Data[Offset]); reinterpret_cast<const support::ulittle8_t *>(&Data[Offset]);
return ArrayRef<support::ulittle8_t>(ByteCode, return makeArrayRef(ByteCode, CodeWords() * sizeof(uint32_t));
CodeWords() * sizeof(uint32_t));
} }
uint32_t ExceptionHandlerRVA() const { uint32_t ExceptionHandlerRVA() const {

View File

@ -135,8 +135,7 @@ MachineTraceMetrics::getProcResourceCycles(unsigned MBBNum) const {
"getResources() must be called before getProcResourceCycles()"); "getResources() must be called before getProcResourceCycles()");
unsigned PRKinds = SchedModel.getNumProcResourceKinds(); unsigned PRKinds = SchedModel.getNumProcResourceKinds();
assert((MBBNum+1) * PRKinds <= ProcResourceCycles.size()); assert((MBBNum+1) * PRKinds <= ProcResourceCycles.size());
return ArrayRef<unsigned>(ProcResourceCycles.data() + MBBNum * PRKinds, return makeArrayRef(ProcResourceCycles.data() + MBBNum * PRKinds, PRKinds);
PRKinds);
} }
@ -256,8 +255,7 @@ MachineTraceMetrics::Ensemble::
getProcResourceDepths(unsigned MBBNum) const { getProcResourceDepths(unsigned MBBNum) const {
unsigned PRKinds = MTM.SchedModel.getNumProcResourceKinds(); unsigned PRKinds = MTM.SchedModel.getNumProcResourceKinds();
assert((MBBNum+1) * PRKinds <= ProcResourceDepths.size()); assert((MBBNum+1) * PRKinds <= ProcResourceDepths.size());
return ArrayRef<unsigned>(ProcResourceDepths.data() + MBBNum * PRKinds, return makeArrayRef(ProcResourceDepths.data() + MBBNum * PRKinds, PRKinds);
PRKinds);
} }
/// Get an array of processor resource heights for MBB. Indexed by processor /// Get an array of processor resource heights for MBB. Indexed by processor
@ -270,8 +268,7 @@ MachineTraceMetrics::Ensemble::
getProcResourceHeights(unsigned MBBNum) const { getProcResourceHeights(unsigned MBBNum) const {
unsigned PRKinds = MTM.SchedModel.getNumProcResourceKinds(); unsigned PRKinds = MTM.SchedModel.getNumProcResourceKinds();
assert((MBBNum+1) * PRKinds <= ProcResourceHeights.size()); assert((MBBNum+1) * PRKinds <= ProcResourceHeights.size());
return ArrayRef<unsigned>(ProcResourceHeights.data() + MBBNum * PRKinds, return makeArrayRef(ProcResourceHeights.data() + MBBNum * PRKinds, PRKinds);
PRKinds);
} }
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//

View File

@ -967,14 +967,12 @@ void RAGreedy::addThroughConstraints(InterferenceCache::Cursor Intf,
BCS[B].Exit = SpillPlacement::PrefSpill; BCS[B].Exit = SpillPlacement::PrefSpill;
if (++B == GroupSize) { if (++B == GroupSize) {
ArrayRef<SpillPlacement::BlockConstraint> Array(BCS, B); SpillPlacer->addConstraints(makeArrayRef(BCS, B));
SpillPlacer->addConstraints(Array);
B = 0; B = 0;
} }
} }
ArrayRef<SpillPlacement::BlockConstraint> Array(BCS, B); SpillPlacer->addConstraints(makeArrayRef(BCS, B));
SpillPlacer->addConstraints(Array);
SpillPlacer->addLinks(makeArrayRef(TBS, T)); SpillPlacer->addLinks(makeArrayRef(TBS, T));
} }
@ -1013,7 +1011,7 @@ void RAGreedy::growRegion(GlobalSplitCandidate &Cand) {
// Compute through constraints from the interference, or assume that all // Compute through constraints from the interference, or assume that all
// through blocks prefer spilling when forming compact regions. // through blocks prefer spilling when forming compact regions.
ArrayRef<unsigned> NewBlocks = makeArrayRef(ActiveBlocks).slice(AddedTo); auto NewBlocks = makeArrayRef(ActiveBlocks).slice(AddedTo);
if (Cand.PhysReg) if (Cand.PhysReg)
addThroughConstraints(Cand.Intf, NewBlocks); addThroughConstraints(Cand.Intf, NewBlocks);
else else

View File

@ -2368,8 +2368,7 @@ SDValue DAGCombiner::SimplifyNodeWithTwoResults(SDNode *N, unsigned LoOp,
if (!HiExists && if (!HiExists &&
(!LegalOperations || (!LegalOperations ||
TLI.isOperationLegalOrCustom(LoOp, N->getValueType(0)))) { TLI.isOperationLegalOrCustom(LoOp, N->getValueType(0)))) {
SDValue Res = DAG.getNode(LoOp, SDLoc(N), N->getValueType(0), SDValue Res = DAG.getNode(LoOp, SDLoc(N), N->getValueType(0), N->ops());
ArrayRef<SDUse>(N->op_begin(), N->op_end()));
return CombineTo(N, Res, Res); return CombineTo(N, Res, Res);
} }
@ -2378,8 +2377,7 @@ SDValue DAGCombiner::SimplifyNodeWithTwoResults(SDNode *N, unsigned LoOp,
if (!LoExists && if (!LoExists &&
(!LegalOperations || (!LegalOperations ||
TLI.isOperationLegal(HiOp, N->getValueType(1)))) { TLI.isOperationLegal(HiOp, N->getValueType(1)))) {
SDValue Res = DAG.getNode(HiOp, SDLoc(N), N->getValueType(1), SDValue Res = DAG.getNode(HiOp, SDLoc(N), N->getValueType(1), N->ops());
ArrayRef<SDUse>(N->op_begin(), N->op_end()));
return CombineTo(N, Res, Res); return CombineTo(N, Res, Res);
} }
@ -2389,8 +2387,7 @@ SDValue DAGCombiner::SimplifyNodeWithTwoResults(SDNode *N, unsigned LoOp,
// If the two computed results can be simplified separately, separate them. // If the two computed results can be simplified separately, separate them.
if (LoExists) { if (LoExists) {
SDValue Lo = DAG.getNode(LoOp, SDLoc(N), N->getValueType(0), SDValue Lo = DAG.getNode(LoOp, SDLoc(N), N->getValueType(0), N->ops());
ArrayRef<SDUse>(N->op_begin(), N->op_end()));
AddToWorklist(Lo.getNode()); AddToWorklist(Lo.getNode());
SDValue LoOpt = combine(Lo.getNode()); SDValue LoOpt = combine(Lo.getNode());
if (LoOpt.getNode() && LoOpt.getNode() != Lo.getNode() && if (LoOpt.getNode() && LoOpt.getNode() != Lo.getNode() &&
@ -2400,8 +2397,7 @@ SDValue DAGCombiner::SimplifyNodeWithTwoResults(SDNode *N, unsigned LoOp,
} }
if (HiExists) { if (HiExists) {
SDValue Hi = DAG.getNode(HiOp, SDLoc(N), N->getValueType(1), SDValue Hi = DAG.getNode(HiOp, SDLoc(N), N->getValueType(1), N->ops());
ArrayRef<SDUse>(N->op_begin(), N->op_end()));
AddToWorklist(Hi.getNode()); AddToWorklist(Hi.getNode());
SDValue HiOpt = combine(Hi.getNode()); SDValue HiOpt = combine(Hi.getNode());
if (HiOpt.getNode() && HiOpt != Hi && if (HiOpt.getNode() && HiOpt != Hi &&

View File

@ -5102,7 +5102,7 @@ SDValue SelectionDAG::getNode(unsigned Opcode, SDLoc DL, SDVTList VTList,
} }
SDValue SelectionDAG::getNode(unsigned Opcode, SDLoc DL, SDVTList VTList) { SDValue SelectionDAG::getNode(unsigned Opcode, SDLoc DL, SDVTList VTList) {
return getNode(Opcode, DL, VTList, ArrayRef<SDValue>()); return getNode(Opcode, DL, VTList, None);
} }
SDValue SelectionDAG::getNode(unsigned Opcode, SDLoc DL, SDVTList VTList, SDValue SelectionDAG::getNode(unsigned Opcode, SDLoc DL, SDVTList VTList,

View File

@ -2541,7 +2541,7 @@ Constant *ConstantDataArray::getString(LLVMContext &Context,
StringRef Str, bool AddNull) { StringRef Str, bool AddNull) {
if (!AddNull) { if (!AddNull) {
const uint8_t *Data = reinterpret_cast<const uint8_t *>(Str.data()); const uint8_t *Data = reinterpret_cast<const uint8_t *>(Str.data());
return get(Context, ArrayRef<uint8_t>(const_cast<uint8_t *>(Data), return get(Context, makeArrayRef(const_cast<uint8_t *>(Data),
Str.size())); Str.size()));
} }

View File

@ -692,7 +692,7 @@ static Type *DecodeFixedType(ArrayRef<Intrinsic::IITDescriptor> &Infos,
assert(D.Struct_NumElements <= 5 && "Can't handle this yet"); assert(D.Struct_NumElements <= 5 && "Can't handle this yet");
for (unsigned i = 0, e = D.Struct_NumElements; i != e; ++i) for (unsigned i = 0, e = D.Struct_NumElements; i != e; ++i)
Elts[i] = DecodeFixedType(Infos, Tys, Context); Elts[i] = DecodeFixedType(Infos, Tys, Context);
return StructType::get(Context, ArrayRef<Type*>(Elts,D.Struct_NumElements)); return StructType::get(Context, makeArrayRef(Elts,D.Struct_NumElements));
} }
case IITDescriptor::Argument: case IITDescriptor::Argument:

View File

@ -150,7 +150,7 @@ struct FunctionTypeKeyInfo {
ReturnType(R), Params(P), isVarArg(V) {} ReturnType(R), Params(P), isVarArg(V) {}
KeyTy(const FunctionType* FT) : KeyTy(const FunctionType* FT) :
ReturnType(FT->getReturnType()), ReturnType(FT->getReturnType()),
Params(ArrayRef<Type*>(FT->param_begin(), FT->param_end())), Params(makeArrayRef(FT->param_begin(), FT->param_end())),
isVarArg(FT->isVarArg()) {} isVarArg(FT->isVarArg()) {}
bool operator==(const KeyTy& that) const { bool operator==(const KeyTy& that) const {
if (ReturnType != that.ReturnType) if (ReturnType != that.ReturnType)

View File

@ -62,7 +62,7 @@ MDNode *MDBuilder::createRange(const APInt &Lo, const APInt &Hi) {
MDNode *MDBuilder::createAnonymousAARoot(StringRef Name, MDNode *Extra) { MDNode *MDBuilder::createAnonymousAARoot(StringRef Name, MDNode *Extra) {
// To ensure uniqueness the root node is self-referential. // To ensure uniqueness the root node is self-referential.
MDNode *Dummy = MDNode::getTemporary(Context, ArrayRef<Value*>()); MDNode *Dummy = MDNode::getTemporary(Context, None);
SmallVector<Value *, 3> Args(1, Dummy); SmallVector<Value *, 3> Args(1, Dummy);
if (Extra) if (Extra)

View File

@ -52,11 +52,11 @@ uint64_t MCObjectDisassembler::getEntrypoint() {
} }
ArrayRef<uint64_t> MCObjectDisassembler::getStaticInitFunctions() { ArrayRef<uint64_t> MCObjectDisassembler::getStaticInitFunctions() {
return ArrayRef<uint64_t>(); return None;
} }
ArrayRef<uint64_t> MCObjectDisassembler::getStaticExitFunctions() { ArrayRef<uint64_t> MCObjectDisassembler::getStaticExitFunctions() {
return ArrayRef<uint64_t>(); return None;
} }
MemoryObject *MCObjectDisassembler::getRegionFor(uint64_t Addr) { MemoryObject *MCObjectDisassembler::getRegionFor(uint64_t Addr) {
@ -559,7 +559,7 @@ ArrayRef<uint64_t> MCMachOObjectDisassembler::getStaticInitFunctions() {
size_t EntrySize = 8; size_t EntrySize = 8;
size_t EntryCount = ModInitContents.size() / EntrySize; size_t EntryCount = ModInitContents.size() / EntrySize;
return ArrayRef<uint64_t>( return makeArrayRef(
reinterpret_cast<const uint64_t *>(ModInitContents.data()), EntryCount); reinterpret_cast<const uint64_t *>(ModInitContents.data()), EntryCount);
} }
@ -569,6 +569,6 @@ ArrayRef<uint64_t> MCMachOObjectDisassembler::getStaticExitFunctions() {
size_t EntrySize = 8; size_t EntrySize = 8;
size_t EntryCount = ModExitContents.size() / EntrySize; size_t EntryCount = ModExitContents.size() / EntrySize;
return ArrayRef<uint64_t>( return makeArrayRef(
reinterpret_cast<const uint64_t *>(ModExitContents.data()), EntryCount); reinterpret_cast<const uint64_t *>(ModExitContents.data()), EntryCount);
} }

View File

@ -783,8 +783,7 @@ ArrayRef<uint8_t> COFFObjectFile::getSymbolAuxData(
== 0 && "Aux Symbol data did not point to the beginning of a symbol"); == 0 && "Aux Symbol data did not point to the beginning of a symbol");
# endif # endif
} }
return ArrayRef<uint8_t>(Aux, return makeArrayRef(Aux, Symbol->NumberOfAuxSymbols * sizeof(coff_symbol));
Symbol->NumberOfAuxSymbols * sizeof(coff_symbol));
} }
std::error_code COFFObjectFile::getSectionName(const coff_section *Sec, std::error_code COFFObjectFile::getSectionName(const coff_section *Sec,
@ -825,8 +824,8 @@ COFFObjectFile::getSectionContents(const coff_section *Sec,
uintptr_t ConEnd = ConStart + Sec->SizeOfRawData; uintptr_t ConEnd = ConStart + Sec->SizeOfRawData;
if (ConEnd > uintptr_t(Data.getBufferEnd())) if (ConEnd > uintptr_t(Data.getBufferEnd()))
return object_error::parse_failed; return object_error::parse_failed;
Res = ArrayRef<uint8_t>(reinterpret_cast<const unsigned char*>(ConStart), Res = makeArrayRef(reinterpret_cast<const uint8_t*>(ConStart),
Sec->SizeOfRawData); Sec->SizeOfRawData);
return object_error::success; return object_error::success;
} }

View File

@ -1515,14 +1515,14 @@ ArrayRef<char>
MachOObjectFile::getSectionRawName(DataRefImpl Sec) const { MachOObjectFile::getSectionRawName(DataRefImpl Sec) const {
const section_base *Base = const section_base *Base =
reinterpret_cast<const section_base *>(Sections[Sec.d.a]); reinterpret_cast<const section_base *>(Sections[Sec.d.a]);
return ArrayRef<char>(Base->sectname); return makeArrayRef(Base->sectname);
} }
ArrayRef<char> ArrayRef<char>
MachOObjectFile::getSectionRawFinalSegmentName(DataRefImpl Sec) const { MachOObjectFile::getSectionRawFinalSegmentName(DataRefImpl Sec) const {
const section_base *Base = const section_base *Base =
reinterpret_cast<const section_base *>(Sections[Sec.d.a]); reinterpret_cast<const section_base *>(Sections[Sec.d.a]);
return ArrayRef<char>(Base->segname); return makeArrayRef(Base->segname);
} }
bool bool

View File

@ -208,11 +208,11 @@ void MD5::update(ArrayRef<uint8_t> Data) {
memcpy(&buffer[used], Ptr, free); memcpy(&buffer[used], Ptr, free);
Ptr = Ptr + free; Ptr = Ptr + free;
Size -= free; Size -= free;
body(ArrayRef<uint8_t>(buffer, 64)); body(makeArrayRef(buffer, 64));
} }
if (Size >= 64) { if (Size >= 64) {
Ptr = body(ArrayRef<uint8_t>(Ptr, Size & ~(unsigned long) 0x3f)); Ptr = body(makeArrayRef(Ptr, Size & ~(unsigned long) 0x3f));
Size &= 0x3f; Size &= 0x3f;
} }
@ -240,7 +240,7 @@ void MD5::final(MD5Result &result) {
if (free < 8) { if (free < 8) {
memset(&buffer[used], 0, free); memset(&buffer[used], 0, free);
body(ArrayRef<uint8_t>(buffer, 64)); body(makeArrayRef(buffer, 64));
used = 0; used = 0;
free = 64; free = 64;
} }
@ -257,7 +257,7 @@ void MD5::final(MD5Result &result) {
buffer[62] = hi >> 16; buffer[62] = hi >> 16;
buffer[63] = hi >> 24; buffer[63] = hi >> 24;
body(ArrayRef<uint8_t>(buffer, 64)); body(makeArrayRef(buffer, 64));
result[0] = a; result[0] = a;
result[1] = a >> 8; result[1] = a >> 8;

View File

@ -105,8 +105,8 @@ unsigned StringRef::edit_distance(llvm::StringRef Other,
bool AllowReplacements, bool AllowReplacements,
unsigned MaxEditDistance) const { unsigned MaxEditDistance) const {
return llvm::ComputeEditDistance( return llvm::ComputeEditDistance(
llvm::ArrayRef<char>(data(), size()), makeArrayRef(data(), size()),
llvm::ArrayRef<char>(Other.data(), Other.size()), makeArrayRef(Other.data(), Other.size()),
AllowReplacements, MaxEditDistance); AllowReplacements, MaxEditDistance);
} }

View File

@ -7626,7 +7626,7 @@ static SDValue performPostLD1Combine(SDNode *N,
Ops.push_back(Inc); Ops.push_back(Inc);
EVT Tys[3] = { VT, MVT::i64, MVT::Other }; EVT Tys[3] = { VT, MVT::i64, MVT::Other };
SDVTList SDTys = DAG.getVTList(ArrayRef<EVT>(Tys, 3)); SDVTList SDTys = DAG.getVTList(Tys);
unsigned NewOp = IsLaneOp ? AArch64ISD::LD1LANEpost : AArch64ISD::LD1DUPpost; unsigned NewOp = IsLaneOp ? AArch64ISD::LD1LANEpost : AArch64ISD::LD1DUPpost;
SDValue UpdN = DAG.getMemIntrinsicNode(NewOp, SDLoc(N), SDTys, Ops, SDValue UpdN = DAG.getMemIntrinsicNode(NewOp, SDLoc(N), SDTys, Ops,
MemVT, MemVT,
@ -7756,7 +7756,7 @@ static SDValue performNEONPostLDSTCombine(SDNode *N,
Tys[n] = VecTy; Tys[n] = VecTy;
Tys[n++] = MVT::i64; // Type of write back register Tys[n++] = MVT::i64; // Type of write back register
Tys[n] = MVT::Other; // Type of the chain Tys[n] = MVT::Other; // Type of the chain
SDVTList SDTys = DAG.getVTList(ArrayRef<EVT>(Tys, NumResultVecs + 2)); SDVTList SDTys = DAG.getVTList(makeArrayRef(Tys, NumResultVecs + 2));
MemIntrinsicSDNode *MemInt = cast<MemIntrinsicSDNode>(N); MemIntrinsicSDNode *MemInt = cast<MemIntrinsicSDNode>(N);
SDValue UpdN = DAG.getMemIntrinsicNode(NewOpc, SDLoc(N), SDTys, Ops, SDValue UpdN = DAG.getMemIntrinsicNode(NewOpc, SDLoc(N), SDTys, Ops,

View File

@ -85,8 +85,7 @@ bool AArch64StorePairSuppress::shouldAddSTPToBlock(const MachineBasicBlock *BB)
// If a subtarget does not define resources for STPQi, bail here. // If a subtarget does not define resources for STPQi, bail here.
if (SCDesc->isValid() && !SCDesc->isVariant()) { if (SCDesc->isValid() && !SCDesc->isVariant()) {
unsigned ResLenWithSTP = BBTrace.getResourceLength( unsigned ResLenWithSTP = BBTrace.getResourceLength(None, SCDesc);
ArrayRef<const MachineBasicBlock *>(), SCDesc);
if (ResLenWithSTP > ResLength) { if (ResLenWithSTP > ResLength) {
DEBUG(dbgs() << " Suppress STP in BB: " << BB->getNumber() DEBUG(dbgs() << " Suppress STP in BB: " << BB->getNumber()
<< " resources " << ResLength << " -> " << ResLenWithSTP << " resources " << ResLength << " -> " << ResLenWithSTP

View File

@ -9100,7 +9100,7 @@ static SDValue CombineBaseUpdate(SDNode *N,
Tys[n] = VecTy; Tys[n] = VecTy;
Tys[n++] = MVT::i32; Tys[n++] = MVT::i32;
Tys[n] = MVT::Other; Tys[n] = MVT::Other;
SDVTList SDTys = DAG.getVTList(ArrayRef<EVT>(Tys, NumResultVecs+2)); SDVTList SDTys = DAG.getVTList(makeArrayRef(Tys, NumResultVecs+2));
SmallVector<SDValue, 8> Ops; SmallVector<SDValue, 8> Ops;
Ops.push_back(N->getOperand(0)); // incoming chain Ops.push_back(N->getOperand(0)); // incoming chain
Ops.push_back(N->getOperand(AddrOpIdx)); Ops.push_back(N->getOperand(AddrOpIdx));
@ -9179,7 +9179,7 @@ static bool CombineVLDDUP(SDNode *N, TargetLowering::DAGCombinerInfo &DCI) {
for (n = 0; n < NumVecs; ++n) for (n = 0; n < NumVecs; ++n)
Tys[n] = VT; Tys[n] = VT;
Tys[n] = MVT::Other; Tys[n] = MVT::Other;
SDVTList SDTys = DAG.getVTList(ArrayRef<EVT>(Tys, NumVecs+1)); SDVTList SDTys = DAG.getVTList(makeArrayRef(Tys, NumVecs+1));
SDValue Ops[] = { VLD->getOperand(0), VLD->getOperand(2) }; SDValue Ops[] = { VLD->getOperand(0), VLD->getOperand(2) };
MemIntrinsicSDNode *VLDMemInt = cast<MemIntrinsicSDNode>(VLD); MemIntrinsicSDNode *VLDMemInt = cast<MemIntrinsicSDNode>(VLD);
SDValue VLDDup = DAG.getMemIntrinsicNode(NewOpc, SDLoc(VLD), SDTys, SDValue VLDDup = DAG.getMemIntrinsicNode(NewOpc, SDLoc(VLD), SDTys,

View File

@ -1300,11 +1300,11 @@ static Value *createCast(IRBuilder<false> &Builder, Value *V, Type *DestTy) {
Value *Result = UndefValue::get(DestTy); Value *Result = UndefValue::get(DestTy);
for (unsigned int I = 0, E = SrcTy->getStructNumElements(); I < E; ++I) { for (unsigned int I = 0, E = SrcTy->getStructNumElements(); I < E; ++I) {
Value *Element = createCast( Value *Element = createCast(
Builder, Builder.CreateExtractValue(V, ArrayRef<unsigned int>(I)), Builder, Builder.CreateExtractValue(V, makeArrayRef(I)),
DestTy->getStructElementType(I)); DestTy->getStructElementType(I));
Result = Result =
Builder.CreateInsertValue(Result, Element, ArrayRef<unsigned int>(I)); Builder.CreateInsertValue(Result, Element, makeArrayRef(I));
} }
return Result; return Result;
} }

View File

@ -680,7 +680,7 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) {
CI, CI,
Builder->CreateShuffleVector( Builder->CreateShuffleVector(
Vec, Undef, ConstantDataVector::get( Vec, Undef, ConstantDataVector::get(
II->getContext(), ArrayRef<uint32_t>(Mask)))); II->getContext(), makeArrayRef(Mask))));
} else if (auto Source = } else if (auto Source =
dyn_cast<IntrinsicInst>(II->getArgOperand(0))) { dyn_cast<IntrinsicInst>(II->getArgOperand(0))) {

View File

@ -435,7 +435,7 @@ bool DataFlowSanitizer::doInitialization(Module &M) {
DFSanSetLabelFnTy = FunctionType::get(Type::getVoidTy(*Ctx), DFSanSetLabelFnTy = FunctionType::get(Type::getVoidTy(*Ctx),
DFSanSetLabelArgs, /*isVarArg=*/false); DFSanSetLabelArgs, /*isVarArg=*/false);
DFSanNonzeroLabelFnTy = FunctionType::get( DFSanNonzeroLabelFnTy = FunctionType::get(
Type::getVoidTy(*Ctx), ArrayRef<Type *>(), /*isVarArg=*/false); Type::getVoidTy(*Ctx), None, /*isVarArg=*/false);
if (GetArgTLSPtr) { if (GetArgTLSPtr) {
Type *ArgTLSTy = ArrayType::get(ShadowTy, 64); Type *ArgTLSTy = ArrayType::get(ShadowTy, 64);

View File

@ -737,11 +737,11 @@ GlobalVariable *GCOVProfiler::buildEdgeLookupTable(
Edge += Successors; Edge += Successors;
} }
ArrayRef<Constant*> V(&EdgeTable[0], TableSize);
GlobalVariable *EdgeTableGV = GlobalVariable *EdgeTableGV =
new GlobalVariable( new GlobalVariable(
*M, EdgeTableTy, true, GlobalValue::InternalLinkage, *M, EdgeTableTy, true, GlobalValue::InternalLinkage,
ConstantArray::get(EdgeTableTy, V), ConstantArray::get(EdgeTableTy,
makeArrayRef(&EdgeTable[0],TableSize)),
"__llvm_gcda_edge_table"); "__llvm_gcda_edge_table");
EdgeTableGV->setUnnamedAddr(true); EdgeTableGV->setUnnamedAddr(true);
return EdgeTableGV; return EdgeTableGV;

View File

@ -1870,7 +1870,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
Value *Op = I.getArgOperand(0); Value *Op = I.getArgOperand(0);
Type *OpType = Op->getType(); Type *OpType = Op->getType();
Function *BswapFunc = Intrinsic::getDeclaration( Function *BswapFunc = Intrinsic::getDeclaration(
F.getParent(), Intrinsic::bswap, ArrayRef<Type*>(&OpType, 1)); F.getParent(), Intrinsic::bswap, makeArrayRef(&OpType, 1));
setShadow(&I, IRB.CreateCall(BswapFunc, getShadow(Op))); setShadow(&I, IRB.CreateCall(BswapFunc, getShadow(Op)));
setOrigin(&I, getOrigin(Op)); setOrigin(&I, getOrigin(Op));
} }

View File

@ -481,8 +481,7 @@ bool ThreadSanitizer::instrumentAtomic(Instruction *I) {
Type *PtrTy = Ty->getPointerTo(); Type *PtrTy = Ty->getPointerTo();
Value *Args[] = {IRB.CreatePointerCast(Addr, PtrTy), Value *Args[] = {IRB.CreatePointerCast(Addr, PtrTy),
createOrdering(&IRB, LI->getOrdering())}; createOrdering(&IRB, LI->getOrdering())};
CallInst *C = CallInst::Create(TsanAtomicLoad[Idx], CallInst *C = CallInst::Create(TsanAtomicLoad[Idx], Args);
ArrayRef<Value*>(Args));
ReplaceInstWithInst(I, C); ReplaceInstWithInst(I, C);
} else if (StoreInst *SI = dyn_cast<StoreInst>(I)) { } else if (StoreInst *SI = dyn_cast<StoreInst>(I)) {
@ -497,8 +496,7 @@ bool ThreadSanitizer::instrumentAtomic(Instruction *I) {
Value *Args[] = {IRB.CreatePointerCast(Addr, PtrTy), Value *Args[] = {IRB.CreatePointerCast(Addr, PtrTy),
IRB.CreateIntCast(SI->getValueOperand(), Ty, false), IRB.CreateIntCast(SI->getValueOperand(), Ty, false),
createOrdering(&IRB, SI->getOrdering())}; createOrdering(&IRB, SI->getOrdering())};
CallInst *C = CallInst::Create(TsanAtomicStore[Idx], CallInst *C = CallInst::Create(TsanAtomicStore[Idx], Args);
ArrayRef<Value*>(Args));
ReplaceInstWithInst(I, C); ReplaceInstWithInst(I, C);
} else if (AtomicRMWInst *RMWI = dyn_cast<AtomicRMWInst>(I)) { } else if (AtomicRMWInst *RMWI = dyn_cast<AtomicRMWInst>(I)) {
Value *Addr = RMWI->getPointerOperand(); Value *Addr = RMWI->getPointerOperand();
@ -515,7 +513,7 @@ bool ThreadSanitizer::instrumentAtomic(Instruction *I) {
Value *Args[] = {IRB.CreatePointerCast(Addr, PtrTy), Value *Args[] = {IRB.CreatePointerCast(Addr, PtrTy),
IRB.CreateIntCast(RMWI->getValOperand(), Ty, false), IRB.CreateIntCast(RMWI->getValOperand(), Ty, false),
createOrdering(&IRB, RMWI->getOrdering())}; createOrdering(&IRB, RMWI->getOrdering())};
CallInst *C = CallInst::Create(F, ArrayRef<Value*>(Args)); CallInst *C = CallInst::Create(F, Args);
ReplaceInstWithInst(I, C); ReplaceInstWithInst(I, C);
} else if (AtomicCmpXchgInst *CASI = dyn_cast<AtomicCmpXchgInst>(I)) { } else if (AtomicCmpXchgInst *CASI = dyn_cast<AtomicCmpXchgInst>(I)) {
Value *Addr = CASI->getPointerOperand(); Value *Addr = CASI->getPointerOperand();
@ -543,7 +541,7 @@ bool ThreadSanitizer::instrumentAtomic(Instruction *I) {
Value *Args[] = {createOrdering(&IRB, FI->getOrdering())}; Value *Args[] = {createOrdering(&IRB, FI->getOrdering())};
Function *F = FI->getSynchScope() == SingleThread ? Function *F = FI->getSynchScope() == SingleThread ?
TsanAtomicSignalFence : TsanAtomicThreadFence; TsanAtomicSignalFence : TsanAtomicThreadFence;
CallInst *C = CallInst::Create(F, ArrayRef<Value*>(Args)); CallInst *C = CallInst::Create(F, Args);
ReplaceInstWithInst(I, C); ReplaceInstWithInst(I, C);
} }
return true; return true;

View File

@ -885,8 +885,7 @@ static void AppendMDNodeToInstForPtr(unsigned NodeId,
OldSeq), OldSeq),
SequenceToMDString(Inst->getContext(), SequenceToMDString(Inst->getContext(),
NewSeq)}; NewSeq)};
Node = MDNode::get(Inst->getContext(), Node = MDNode::get(Inst->getContext(), tmp);
ArrayRef<Value*>(tmp, 3));
Inst->setMetadata(NodeId, Node); Inst->setMetadata(NodeId, Node);
} }
@ -906,8 +905,7 @@ static void GenerateARCBBEntranceAnnotation(const char *Name, BasicBlock *BB,
Type *I8X = PointerType::getUnqual(Type::getInt8Ty(C)); Type *I8X = PointerType::getUnqual(Type::getInt8Ty(C));
Type *I8XX = PointerType::getUnqual(I8X); Type *I8XX = PointerType::getUnqual(I8X);
Type *Params[] = {I8XX, I8XX}; Type *Params[] = {I8XX, I8XX};
FunctionType *FTy = FunctionType::get(Type::getVoidTy(C), FunctionType *FTy = FunctionType::get(Type::getVoidTy(C), Params,
ArrayRef<Type*>(Params, 2),
/*isVarArg=*/false); /*isVarArg=*/false);
Constant *Callee = M->getOrInsertFunction(Name, FTy); Constant *Callee = M->getOrInsertFunction(Name, FTy);
@ -949,8 +947,7 @@ static void GenerateARCBBTerminatorAnnotation(const char *Name, BasicBlock *BB,
Type *I8X = PointerType::getUnqual(Type::getInt8Ty(C)); Type *I8X = PointerType::getUnqual(Type::getInt8Ty(C));
Type *I8XX = PointerType::getUnqual(I8X); Type *I8XX = PointerType::getUnqual(I8X);
Type *Params[] = {I8XX, I8XX}; Type *Params[] = {I8XX, I8XX};
FunctionType *FTy = FunctionType::get(Type::getVoidTy(C), FunctionType *FTy = FunctionType::get(Type::getVoidTy(C), Params,
ArrayRef<Type*>(Params, 2),
/*isVarArg=*/false); /*isVarArg=*/false);
Constant *Callee = M->getOrInsertFunction(Name, FTy); Constant *Callee = M->getOrInsertFunction(Name, FTy);

View File

@ -1010,7 +1010,7 @@ void SCCPSolver::visitGetElementPtrInst(GetElementPtrInst &I) {
} }
Constant *Ptr = Operands[0]; Constant *Ptr = Operands[0];
ArrayRef<Constant *> Indices(Operands.begin() + 1, Operands.end()); auto Indices = makeArrayRef(Operands.begin() + 1, Operands.end());
markConstant(&I, ConstantExpr::getGetElementPtr(Ptr, Indices)); markConstant(&I, ConstantExpr::getGetElementPtr(Ptr, Indices));
} }

View File

@ -42,8 +42,7 @@ Value *llvm::EmitStrLen(Value *Ptr, IRBuilder<> &B, const DataLayout *TD,
AttributeSet AS[2]; AttributeSet AS[2];
AS[0] = AttributeSet::get(M->getContext(), 1, Attribute::NoCapture); AS[0] = AttributeSet::get(M->getContext(), 1, Attribute::NoCapture);
Attribute::AttrKind AVs[2] = { Attribute::ReadOnly, Attribute::NoUnwind }; Attribute::AttrKind AVs[2] = { Attribute::ReadOnly, Attribute::NoUnwind };
AS[1] = AttributeSet::get(M->getContext(), AttributeSet::FunctionIndex, AS[1] = AttributeSet::get(M->getContext(), AttributeSet::FunctionIndex, AVs);
ArrayRef<Attribute::AttrKind>(AVs, 2));
LLVMContext &Context = B.GetInsertBlock()->getContext(); LLVMContext &Context = B.GetInsertBlock()->getContext();
Constant *StrLen = M->getOrInsertFunction("strlen", Constant *StrLen = M->getOrInsertFunction("strlen",
@ -71,8 +70,7 @@ Value *llvm::EmitStrNLen(Value *Ptr, Value *MaxLen, IRBuilder<> &B,
AttributeSet AS[2]; AttributeSet AS[2];
AS[0] = AttributeSet::get(M->getContext(), 1, Attribute::NoCapture); AS[0] = AttributeSet::get(M->getContext(), 1, Attribute::NoCapture);
Attribute::AttrKind AVs[2] = { Attribute::ReadOnly, Attribute::NoUnwind }; Attribute::AttrKind AVs[2] = { Attribute::ReadOnly, Attribute::NoUnwind };
AS[1] = AttributeSet::get(M->getContext(), AttributeSet::FunctionIndex, AS[1] = AttributeSet::get(M->getContext(), AttributeSet::FunctionIndex, AVs);
ArrayRef<Attribute::AttrKind>(AVs, 2));
LLVMContext &Context = B.GetInsertBlock()->getContext(); LLVMContext &Context = B.GetInsertBlock()->getContext();
Constant *StrNLen = M->getOrInsertFunction("strnlen", Constant *StrNLen = M->getOrInsertFunction("strnlen",
@ -100,8 +98,7 @@ Value *llvm::EmitStrChr(Value *Ptr, char C, IRBuilder<> &B,
Module *M = B.GetInsertBlock()->getParent()->getParent(); Module *M = B.GetInsertBlock()->getParent()->getParent();
Attribute::AttrKind AVs[2] = { Attribute::ReadOnly, Attribute::NoUnwind }; Attribute::AttrKind AVs[2] = { Attribute::ReadOnly, Attribute::NoUnwind };
AttributeSet AS = AttributeSet AS =
AttributeSet::get(M->getContext(), AttributeSet::FunctionIndex, AttributeSet::get(M->getContext(), AttributeSet::FunctionIndex, AVs);
ArrayRef<Attribute::AttrKind>(AVs, 2));
Type *I8Ptr = B.getInt8PtrTy(); Type *I8Ptr = B.getInt8PtrTy();
Type *I32Ty = B.getInt32Ty(); Type *I32Ty = B.getInt32Ty();
@ -128,8 +125,7 @@ Value *llvm::EmitStrNCmp(Value *Ptr1, Value *Ptr2, Value *Len,
AS[0] = AttributeSet::get(M->getContext(), 1, Attribute::NoCapture); AS[0] = AttributeSet::get(M->getContext(), 1, Attribute::NoCapture);
AS[1] = AttributeSet::get(M->getContext(), 2, Attribute::NoCapture); AS[1] = AttributeSet::get(M->getContext(), 2, Attribute::NoCapture);
Attribute::AttrKind AVs[2] = { Attribute::ReadOnly, Attribute::NoUnwind }; Attribute::AttrKind AVs[2] = { Attribute::ReadOnly, Attribute::NoUnwind };
AS[2] = AttributeSet::get(M->getContext(), AttributeSet::FunctionIndex, AS[2] = AttributeSet::get(M->getContext(), AttributeSet::FunctionIndex, AVs);
ArrayRef<Attribute::AttrKind>(AVs, 2));
LLVMContext &Context = B.GetInsertBlock()->getContext(); LLVMContext &Context = B.GetInsertBlock()->getContext();
Value *StrNCmp = M->getOrInsertFunction("strncmp", Value *StrNCmp = M->getOrInsertFunction("strncmp",
@ -238,8 +234,7 @@ Value *llvm::EmitMemChr(Value *Ptr, Value *Val,
Module *M = B.GetInsertBlock()->getParent()->getParent(); Module *M = B.GetInsertBlock()->getParent()->getParent();
AttributeSet AS; AttributeSet AS;
Attribute::AttrKind AVs[2] = { Attribute::ReadOnly, Attribute::NoUnwind }; Attribute::AttrKind AVs[2] = { Attribute::ReadOnly, Attribute::NoUnwind };
AS = AttributeSet::get(M->getContext(), AttributeSet::FunctionIndex, AS = AttributeSet::get(M->getContext(), AttributeSet::FunctionIndex, AVs);
ArrayRef<Attribute::AttrKind>(AVs, 2));
LLVMContext &Context = B.GetInsertBlock()->getContext(); LLVMContext &Context = B.GetInsertBlock()->getContext();
Value *MemChr = M->getOrInsertFunction("memchr", Value *MemChr = M->getOrInsertFunction("memchr",
AttributeSet::get(M->getContext(), AS), AttributeSet::get(M->getContext(), AS),
@ -268,8 +263,7 @@ Value *llvm::EmitMemCmp(Value *Ptr1, Value *Ptr2,
AS[0] = AttributeSet::get(M->getContext(), 1, Attribute::NoCapture); AS[0] = AttributeSet::get(M->getContext(), 1, Attribute::NoCapture);
AS[1] = AttributeSet::get(M->getContext(), 2, Attribute::NoCapture); AS[1] = AttributeSet::get(M->getContext(), 2, Attribute::NoCapture);
Attribute::AttrKind AVs[2] = { Attribute::ReadOnly, Attribute::NoUnwind }; Attribute::AttrKind AVs[2] = { Attribute::ReadOnly, Attribute::NoUnwind };
AS[2] = AttributeSet::get(M->getContext(), AttributeSet::FunctionIndex, AS[2] = AttributeSet::get(M->getContext(), AttributeSet::FunctionIndex, AVs);
ArrayRef<Attribute::AttrKind>(AVs, 2));
LLVMContext &Context = B.GetInsertBlock()->getContext(); LLVMContext &Context = B.GetInsertBlock()->getContext();
Value *MemCmp = M->getOrInsertFunction("memcmp", Value *MemCmp = M->getOrInsertFunction("memcmp",

View File

@ -317,8 +317,7 @@ static void CloneAliasScopeMetadata(CallSite CS, ValueToValueMapTy &VMap) {
DenseMap<const MDNode *, TrackingVH<MDNode> > MDMap; DenseMap<const MDNode *, TrackingVH<MDNode> > MDMap;
for (SetVector<const MDNode *>::iterator I = MD.begin(), IE = MD.end(); for (SetVector<const MDNode *>::iterator I = MD.begin(), IE = MD.end();
I != IE; ++I) { I != IE; ++I) {
MDNode *Dummy = MDNode::getTemporary(CalledFunc->getContext(), MDNode *Dummy = MDNode::getTemporary(CalledFunc->getContext(), None);
ArrayRef<Value*>());
DummyNodes.push_back(Dummy); DummyNodes.push_back(Dummy);
MDMap[*I] = Dummy; MDMap[*I] = Dummy;
} }

View File

@ -173,8 +173,7 @@ static BasicBlock *rewriteLoopExitBlock(Loop *L, BasicBlock *Exit, Pass *PP) {
if (Exit->isLandingPad()) { if (Exit->isLandingPad()) {
SmallVector<BasicBlock*, 2> NewBBs; SmallVector<BasicBlock*, 2> NewBBs;
SplitLandingPadPredecessors(Exit, ArrayRef<BasicBlock*>(&LoopBlocks[0], SplitLandingPadPredecessors(Exit, LoopBlocks,
LoopBlocks.size()),
".loopexit", ".nonloopexit", ".loopexit", ".nonloopexit",
PP, NewBBs); PP, NewBBs);
NewExitBB = NewBBs[0]; NewExitBB = NewBBs[0];

View File

@ -3225,8 +3225,7 @@ public:
unsigned i = 0; unsigned i = 0;
for (; i < NumReducedVals - ReduxWidth + 1; i += ReduxWidth) { for (; i < NumReducedVals - ReduxWidth + 1; i += ReduxWidth) {
ArrayRef<Value *> ValsToReduce(&ReducedVals[i], ReduxWidth); V.buildTree(makeArrayRef(&ReducedVals[i], ReduxWidth), ReductionOps);
V.buildTree(ValsToReduce, ReductionOps);
// Estimate cost. // Estimate cost.
int Cost = V.getTreeCost() + getReductionCost(TTI, ReducedVals[i]); int Cost = V.getTreeCost() + getReductionCost(TTI, ReducedVals[i]);
@ -3418,8 +3417,7 @@ bool SLPVectorizer::vectorizeChainsInBlock(BasicBlock *BB, BoUpSLP &R) {
// Try to vectorize them. // Try to vectorize them.
unsigned NumElts = (SameTypeIt - IncIt); unsigned NumElts = (SameTypeIt - IncIt);
DEBUG(errs() << "SLP: Trying to vectorize starting at PHIs (" << NumElts << ")\n"); DEBUG(errs() << "SLP: Trying to vectorize starting at PHIs (" << NumElts << ")\n");
if (NumElts > 1 && if (NumElts > 1 && tryToVectorizeList(makeArrayRef(IncIt, NumElts), R)) {
tryToVectorizeList(ArrayRef<Value *>(IncIt, NumElts), R)) {
// Success start over because instructions might have been changed. // Success start over because instructions might have been changed.
HaveVectorizedPhiNodes = true; HaveVectorizedPhiNodes = true;
Changed = true; Changed = true;
@ -3561,8 +3559,8 @@ bool SLPVectorizer::vectorizeStoreChains(BoUpSLP &R) {
// Process the stores in chunks of 16. // Process the stores in chunks of 16.
for (unsigned CI = 0, CE = it->second.size(); CI < CE; CI+=16) { for (unsigned CI = 0, CE = it->second.size(); CI < CE; CI+=16) {
unsigned Len = std::min<unsigned>(CE - CI, 16); unsigned Len = std::min<unsigned>(CE - CI, 16);
ArrayRef<StoreInst *> Chunk(&it->second[CI], Len); Changed |= vectorizeStores(makeArrayRef(&it->second[CI], Len),
Changed |= vectorizeStores(Chunk, -SLPCostThreshold, R); -SLPCostThreshold, R);
} }
} }
return Changed; return Changed;

View File

@ -88,5 +88,5 @@ FileCoverageSummary CoverageSummary::getCombinedFileSummaries() {
"TOTAL", RegionCoverageInfo(CoveredRegions, NumRegions), "TOTAL", RegionCoverageInfo(CoveredRegions, NumRegions),
LineCoverageInfo(CoveredLines, NonCodeLines, NumLines), LineCoverageInfo(CoveredLines, NonCodeLines, NumLines),
FunctionCoverageInfo(NumFunctionsCovered, NumFunctions), FunctionCoverageInfo(NumFunctionsCovered, NumFunctions),
ArrayRef<FunctionCoverageSummary>()); None);
} }

View File

@ -214,8 +214,8 @@ public:
} }
void printBinary(StringRef Label, StringRef Str, ArrayRef<char> Value) { void printBinary(StringRef Label, StringRef Str, ArrayRef<char> Value) {
ArrayRef<uint8_t> V(reinterpret_cast<const uint8_t*>(Value.data()), auto V = makeArrayRef(reinterpret_cast<const uint8_t*>(Value.data()),
Value.size()); Value.size());
printBinaryImpl(Label, Str, V, false); printBinaryImpl(Label, Str, V, false);
} }
@ -224,20 +224,20 @@ public:
} }
void printBinary(StringRef Label, ArrayRef<char> Value) { void printBinary(StringRef Label, ArrayRef<char> Value) {
ArrayRef<uint8_t> V(reinterpret_cast<const uint8_t*>(Value.data()), auto V = makeArrayRef(reinterpret_cast<const uint8_t*>(Value.data()),
Value.size()); Value.size());
printBinaryImpl(Label, StringRef(), V, false); printBinaryImpl(Label, StringRef(), V, false);
} }
void printBinary(StringRef Label, StringRef Value) { void printBinary(StringRef Label, StringRef Value) {
ArrayRef<uint8_t> V(reinterpret_cast<const uint8_t*>(Value.data()), auto V = makeArrayRef(reinterpret_cast<const uint8_t*>(Value.data()),
Value.size()); Value.size());
printBinaryImpl(Label, StringRef(), V, false); printBinaryImpl(Label, StringRef(), V, false);
} }
void printBinaryBlock(StringRef Label, StringRef Value) { void printBinaryBlock(StringRef Label, StringRef Value) {
ArrayRef<uint8_t> V(reinterpret_cast<const uint8_t*>(Value.data()), auto V = makeArrayRef(reinterpret_cast<const uint8_t*>(Value.data()),
Value.size()); Value.size());
printBinaryImpl(Label, StringRef(), V, true); printBinaryImpl(Label, StringRef(), V, true);
} }

View File

@ -614,7 +614,7 @@ TEST(APIntTest, arrayAccess) {
0x7E7FFA5EADD8846ULL, 0x7E7FFA5EADD8846ULL,
0x305F341CA00B613DULL 0x305F341CA00B613DULL
}; };
APInt A2(integerPartWidth*4, ArrayRef<integerPart>(E2, 4)); APInt A2(integerPartWidth*4, E2);
for (unsigned i = 0; i < 4; ++i) { for (unsigned i = 0; i < 4; ++i) {
for (unsigned j = 0; j < integerPartWidth; ++j) { for (unsigned j = 0; j < integerPartWidth; ++j) {
EXPECT_EQ(bool(E2[i] & (1ULL << j)), EXPECT_EQ(bool(E2[i] & (1ULL << j)),
@ -653,17 +653,17 @@ TEST(APIntTest, nearestLogBase2) {
// Test round up. // Test round up.
integerPart I4[4] = {0x0, 0xF, 0x18, 0x0}; integerPart I4[4] = {0x0, 0xF, 0x18, 0x0};
APInt A4(integerPartWidth*4, ArrayRef<integerPart>(I4, 4)); APInt A4(integerPartWidth*4, I4);
EXPECT_EQ(A4.nearestLogBase2(), A4.ceilLogBase2()); EXPECT_EQ(A4.nearestLogBase2(), A4.ceilLogBase2());
// Test round down. // Test round down.
integerPart I5[4] = {0x0, 0xF, 0x10, 0x0}; integerPart I5[4] = {0x0, 0xF, 0x10, 0x0};
APInt A5(integerPartWidth*4, ArrayRef<integerPart>(I5, 4)); APInt A5(integerPartWidth*4, I5);
EXPECT_EQ(A5.nearestLogBase2(), A5.logBase2()); EXPECT_EQ(A5.nearestLogBase2(), A5.logBase2());
// Test ties round up. // Test ties round up.
uint64_t I6[4] = {0x0, 0x0, 0x0, 0x18}; uint64_t I6[4] = {0x0, 0x0, 0x0, 0x18};
APInt A6(integerPartWidth*4, ArrayRef<integerPart>(I6, 4)); APInt A6(integerPartWidth*4, I6);
EXPECT_EQ(A6.nearestLogBase2(), A6.ceilLogBase2()); EXPECT_EQ(A6.nearestLogBase2(), A6.ceilLogBase2());
// Test BitWidth == 1 special cases. // Test BitWidth == 1 special cases.

View File

@ -39,30 +39,30 @@ TEST(ConvertUTFTest, ConvertUTF16BigEndianToUTF8String) {
TEST(ConvertUTFTest, OddLengthInput) { TEST(ConvertUTFTest, OddLengthInput) {
std::string Result; std::string Result;
bool Success = convertUTF16ToUTF8String(ArrayRef<char>("xxxxx", 5), Result); bool Success = convertUTF16ToUTF8String(makeArrayRef("xxxxx", 5), Result);
EXPECT_FALSE(Success); EXPECT_FALSE(Success);
} }
TEST(ConvertUTFTest, Empty) { TEST(ConvertUTFTest, Empty) {
std::string Result; std::string Result;
bool Success = convertUTF16ToUTF8String(ArrayRef<char>(), Result); bool Success = convertUTF16ToUTF8String(None, Result);
EXPECT_TRUE(Success); EXPECT_TRUE(Success);
EXPECT_TRUE(Result.empty()); EXPECT_TRUE(Result.empty());
} }
TEST(ConvertUTFTest, HasUTF16BOM) { TEST(ConvertUTFTest, HasUTF16BOM) {
bool HasBOM = hasUTF16ByteOrderMark(ArrayRef<char>("\xff\xfe", 2)); bool HasBOM = hasUTF16ByteOrderMark(makeArrayRef("\xff\xfe", 2));
EXPECT_TRUE(HasBOM); EXPECT_TRUE(HasBOM);
HasBOM = hasUTF16ByteOrderMark(ArrayRef<char>("\xfe\xff", 2)); HasBOM = hasUTF16ByteOrderMark(makeArrayRef("\xfe\xff", 2));
EXPECT_TRUE(HasBOM); EXPECT_TRUE(HasBOM);
HasBOM = hasUTF16ByteOrderMark(ArrayRef<char>("\xfe\xff ", 3)); HasBOM = hasUTF16ByteOrderMark(makeArrayRef("\xfe\xff ", 3));
EXPECT_TRUE(HasBOM); // Don't care about odd lengths. EXPECT_TRUE(HasBOM); // Don't care about odd lengths.
HasBOM = hasUTF16ByteOrderMark(ArrayRef<char>("\xfe\xff\x00asdf", 6)); HasBOM = hasUTF16ByteOrderMark(makeArrayRef("\xfe\xff\x00asdf", 6));
EXPECT_TRUE(HasBOM); EXPECT_TRUE(HasBOM);
HasBOM = hasUTF16ByteOrderMark(ArrayRef<char>()); HasBOM = hasUTF16ByteOrderMark(None);
EXPECT_FALSE(HasBOM); EXPECT_FALSE(HasBOM);
HasBOM = hasUTF16ByteOrderMark(ArrayRef<char>("\xfe", 1)); HasBOM = hasUTF16ByteOrderMark(makeArrayRef("\xfe", 1));
EXPECT_FALSE(HasBOM); EXPECT_FALSE(HasBOM);
} }

View File

@ -41,19 +41,19 @@ void TestMD5Sum(StringRef Input, StringRef Final) {
} }
TEST(MD5Test, MD5) { TEST(MD5Test, MD5) {
TestMD5Sum(ArrayRef<uint8_t>((const uint8_t *)"", (size_t) 0), TestMD5Sum(makeArrayRef((const uint8_t *)"", (size_t) 0),
"d41d8cd98f00b204e9800998ecf8427e"); "d41d8cd98f00b204e9800998ecf8427e");
TestMD5Sum(ArrayRef<uint8_t>((const uint8_t *)"a", (size_t) 1), TestMD5Sum(makeArrayRef((const uint8_t *)"a", (size_t) 1),
"0cc175b9c0f1b6a831c399e269772661"); "0cc175b9c0f1b6a831c399e269772661");
TestMD5Sum(ArrayRef<uint8_t>((const uint8_t *)"abcdefghijklmnopqrstuvwxyz", TestMD5Sum(makeArrayRef((const uint8_t *)"abcdefghijklmnopqrstuvwxyz",
(size_t) 26), (size_t) 26),
"c3fcd3d76192e4007dfb496cca67e13b"); "c3fcd3d76192e4007dfb496cca67e13b");
TestMD5Sum(ArrayRef<uint8_t>((const uint8_t *)"\0", (size_t) 1), TestMD5Sum(makeArrayRef((const uint8_t *)"\0", (size_t) 1),
"93b885adfe0da089cdf634904fd59f71"); "93b885adfe0da089cdf634904fd59f71");
TestMD5Sum(ArrayRef<uint8_t>((const uint8_t *)"a\0", (size_t) 2), TestMD5Sum(makeArrayRef((const uint8_t *)"a\0", (size_t) 2),
"4144e195f46de78a3623da7364d04f11"); "4144e195f46de78a3623da7364d04f11");
TestMD5Sum(ArrayRef<uint8_t>((const uint8_t *)"abcdefghijklmnopqrstuvwxyz\0", TestMD5Sum(makeArrayRef((const uint8_t *)"abcdefghijklmnopqrstuvwxyz\0",
(size_t) 27), (size_t) 27),
"81948d1f1554f58cd1a56ebb01f808cb"); "81948d1f1554f58cd1a56ebb01f808cb");
TestMD5Sum("abcdefghijklmnopqrstuvwxyz", "c3fcd3d76192e4007dfb496cca67e13b"); TestMD5Sum("abcdefghijklmnopqrstuvwxyz", "c3fcd3d76192e4007dfb496cca67e13b");
} }

View File

@ -680,8 +680,7 @@ EmitAttributes(const std::vector<CodeGenIntrinsic> &Ints, raw_ostream &OS) {
OS << " }\n"; OS << " }\n";
OS << " }\n"; OS << " }\n";
OS << " return AttributeSet::get(C, ArrayRef<AttributeSet>(AS, " OS << " return AttributeSet::get(C, makeArrayRef(AS, NumAttrs));\n";
"NumAttrs));\n";
OS << "}\n"; OS << "}\n";
OS << "#endif // GET_INTRINSIC_ATTRIBUTES\n\n"; OS << "#endif // GET_INTRINSIC_ATTRIBUTES\n\n";
} }