Skip to content

Commit 7c8a4a0

Browse files
authored
Merge pull request swiftlang#9753 from swiftlang/cherrypick-swift/release/6.1-7df9da7d780f-2ccbea1d7383-5886454669c3
[🍒 swift/release/6.1] [dsymutil] Provide an option to ignore object timestamp mismatches (llvm#113238)
2 parents 3efb04a + 84cb80c commit 7c8a4a0

36 files changed

+120
-106
lines changed

llvm/docs/CommandGuide/dsymutil.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ OPTIONS
8383
used in conjunction with ``--update`` option, this option will cause redundant
8484
accelerator tables to be removed.
8585

86+
.. option:: --no-object-timestamp
87+
88+
Don't check timestamp for object files.
89+
8690
.. option:: --no-odr
8791

8892
Do not use ODR (One Definition Rule) for uniquing C++ types.

llvm/include/llvm/Analysis/TargetTransformInfoImpl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1389,7 +1389,7 @@ class TargetTransformInfoImplCRTPBase : public TargetTransformInfoImplBase {
13891389

13901390
bool IsUnary = isa<UndefValue>(Operands[1]);
13911391
NumSubElts = VecSrcTy->getElementCount().getKnownMinValue();
1392-
SmallVector<int, 16> AdjustMask(Mask.begin(), Mask.end());
1392+
SmallVector<int, 16> AdjustMask(Mask);
13931393

13941394
// Widening shuffle - widening the source(s) to the new length
13951395
// (treated as free - see above), and then perform the adjusted

llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -669,8 +669,7 @@ class BuildInfoRecord : public TypeRecord {
669669
BuildInfoRecord() = default;
670670
explicit BuildInfoRecord(TypeRecordKind Kind) : TypeRecord(Kind) {}
671671
BuildInfoRecord(ArrayRef<TypeIndex> ArgIndices)
672-
: TypeRecord(TypeRecordKind::BuildInfo),
673-
ArgIndices(ArgIndices.begin(), ArgIndices.end()) {}
672+
: TypeRecord(TypeRecordKind::BuildInfo), ArgIndices(ArgIndices) {}
674673

675674
ArrayRef<TypeIndex> getArgs() const { return ArgIndices; }
676675

llvm/include/llvm/FuzzMutate/RandomIRBuilder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ struct RandomIRBuilder {
4343
uint64_t MinFunctionNum = 1;
4444

4545
RandomIRBuilder(int Seed, ArrayRef<Type *> AllowedTypes)
46-
: Rand(Seed), KnownTypes(AllowedTypes.begin(), AllowedTypes.end()) {}
46+
: Rand(Seed), KnownTypes(AllowedTypes) {}
4747

4848
// TODO: Try to make this a bit less of a random mishmash of functions.
4949

llvm/include/llvm/IR/DebugInfoMetadata.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3990,7 +3990,7 @@ class DIArgList : public Metadata, ReplaceableMetadataImpl {
39903990

39913991
DIArgList(LLVMContext &Context, ArrayRef<ValueAsMetadata *> Args)
39923992
: Metadata(DIArgListKind, Uniqued), ReplaceableMetadataImpl(Context),
3993-
Args(Args.begin(), Args.end()) {
3993+
Args(Args) {
39943994
track();
39953995
}
39963996
~DIArgList() { untrack(); }

llvm/include/llvm/IR/Metadata.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,8 +1489,7 @@ class MDTuple : public MDNode {
14891489

14901490
TempMDTuple cloneImpl() const {
14911491
ArrayRef<MDOperand> Operands = operands();
1492-
return getTemporary(getContext(), SmallVector<Metadata *, 4>(
1493-
Operands.begin(), Operands.end()));
1492+
return getTemporary(getContext(), SmallVector<Metadata *, 4>(Operands));
14941493
}
14951494

14961495
public:

llvm/include/llvm/MC/MCFragment.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,8 +543,7 @@ class MCCVDefRangeFragment : public MCEncodedFragmentWithFixups<32, 4> {
543543
ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
544544
StringRef FixedSizePortion)
545545
: MCEncodedFragmentWithFixups<32, 4>(FT_CVDefRange, false),
546-
Ranges(Ranges.begin(), Ranges.end()),
547-
FixedSizePortion(FixedSizePortion) {}
546+
Ranges(Ranges), FixedSizePortion(FixedSizePortion) {}
548547

549548
ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> getRanges() const {
550549
return Ranges;

llvm/include/llvm/ProfileData/MemProf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ struct IndexedAllocationInfo {
352352
IndexedAllocationInfo(ArrayRef<FrameId> CS, CallStackId CSId,
353353
const MemInfoBlock &MB,
354354
const MemProfSchema &Schema = getFullSchema())
355-
: CallStack(CS.begin(), CS.end()), CSId(CSId), Info(MB, Schema) {}
355+
: CallStack(CS), CSId(CSId), Info(MB, Schema) {}
356356

357357
// Returns the size in bytes when this allocation info struct is serialized.
358358
size_t serializedSize(const MemProfSchema &Schema,

llvm/include/llvm/Support/GenericDomTree.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ class DominatorTreeBase {
578578
// The PostViewCFG is created with updates reversed (equivalent to changes
579579
// made to the CFG), so the PreViewCFG needs all the updates reverse
580580
// applied.
581-
SmallVector<UpdateType> AllUpdates(Updates.begin(), Updates.end());
581+
SmallVector<UpdateType> AllUpdates(Updates);
582582
append_range(AllUpdates, PostViewUpdates);
583583
GraphDiff<NodePtr, IsPostDom> PreViewCFG(AllUpdates,
584584
/*ReverseApplyUpdates=*/true);

llvm/include/llvm/Support/ScopedPrinter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ class ScopedPrinter {
161161
void printFlags(StringRef Label, T Value, ArrayRef<EnumEntry<TFlag>> Flags,
162162
TFlag EnumMask1 = {}, TFlag EnumMask2 = {},
163163
TFlag EnumMask3 = {}, ArrayRef<FlagEntry> ExtraFlags = {}) {
164-
SmallVector<FlagEntry, 10> SetFlags(ExtraFlags.begin(), ExtraFlags.end());
164+
SmallVector<FlagEntry, 10> SetFlags(ExtraFlags);
165165

166166
for (const auto &Flag : Flags) {
167167
if (Flag.Value == 0)

llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ MDNode *AAMDNodes::extendToTBAA(MDNode *MD, ssize_t Len) {
807807

808808
// Otherwise, create TBAA with the new Len
809809
ArrayRef<MDOperand> MDOperands = MD->operands();
810-
SmallVector<Metadata *, 4> NextNodes(MDOperands.begin(), MDOperands.end());
810+
SmallVector<Metadata *, 4> NextNodes(MDOperands);
811811
ConstantInt *PreviousSize = mdconst::extract<ConstantInt>(NextNodes[3]);
812812

813813
// Don't create a new MDNode if it is the same length.

llvm/lib/Analysis/ValueTracking.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6122,7 +6122,7 @@ static Value *BuildSubAggregate(Value *From, ArrayRef<unsigned> idx_range,
61226122
Type *IndexedType = ExtractValueInst::getIndexedType(From->getType(),
61236123
idx_range);
61246124
Value *To = PoisonValue::get(IndexedType);
6125-
SmallVector<unsigned, 10> Idxs(idx_range.begin(), idx_range.end());
6125+
SmallVector<unsigned, 10> Idxs(idx_range);
61266126
unsigned IdxSkip = Idxs.size();
61276127

61286128
return BuildSubAggregate(From, To, IndexedType, Idxs, IdxSkip, InsertBefore);

llvm/lib/IR/Attributes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ AttributeSetNode::AttributeSetNode(ArrayRef<Attribute> Attrs)
10401040

10411041
AttributeSetNode *AttributeSetNode::get(LLVMContext &C,
10421042
ArrayRef<Attribute> Attrs) {
1043-
SmallVector<Attribute, 8> SortedAttrs(Attrs.begin(), Attrs.end());
1043+
SmallVector<Attribute, 8> SortedAttrs(Attrs);
10441044
llvm::sort(SortedAttrs);
10451045
return getSorted(C, SortedAttrs);
10461046
}

llvm/lib/IR/DebugInfoMetadata.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1865,7 +1865,7 @@ DIExpression *DIExpression::appendOpsToArg(const DIExpression *Expr,
18651865
[](auto Op) { return Op.getOp() == dwarf::DW_OP_LLVM_arg; })) {
18661866
assert(ArgNo == 0 &&
18671867
"Location Index must be 0 for a non-variadic expression.");
1868-
SmallVector<uint64_t, 8> NewOps(Ops.begin(), Ops.end());
1868+
SmallVector<uint64_t, 8> NewOps(Ops);
18691869
return DIExpression::prependOpcodes(Expr, NewOps, StackValue);
18701870
}
18711871

llvm/lib/Linker/IRMover.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,8 +1371,7 @@ Error IRLinker::linkModuleFlagsMetadata() {
13711371
return dyn_cast<MDTuple>(DstValue);
13721372
ArrayRef<MDOperand> DstOperands = DstValue->operands();
13731373
MDTuple *New = MDTuple::getDistinct(
1374-
DstM.getContext(),
1375-
SmallVector<Metadata *, 4>(DstOperands.begin(), DstOperands.end()));
1374+
DstM.getContext(), SmallVector<Metadata *, 4>(DstOperands));
13761375
Metadata *FlagOps[] = {DstOp->getOperand(0), ID, New};
13771376
MDNode *Flag = MDTuple::getDistinct(DstM.getContext(), FlagOps);
13781377
DstModFlags->setOperand(DstIndex, Flag);

llvm/lib/Object/BuildID.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ BuildID llvm::object::parseBuildID(StringRef Str) {
5050
return {};
5151
ArrayRef<uint8_t> BuildID(reinterpret_cast<const uint8_t *>(Bytes.data()),
5252
Bytes.size());
53-
return SmallVector<uint8_t>(BuildID.begin(), BuildID.end());
53+
return SmallVector<uint8_t>(BuildID);
5454
}
5555

5656
BuildIDRef llvm::object::getBuildID(const ObjectFile *Obj) {

llvm/lib/Support/SourceMgr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ SMDiagnostic::SMDiagnostic(const SourceMgr &sm, SMLoc L, StringRef FN, int Line,
398398
ArrayRef<SMFixIt> Hints)
399399
: SM(&sm), Loc(L), Filename(std::string(FN)), LineNo(Line), ColumnNo(Col),
400400
Kind(Kind), Message(Msg), LineContents(LineStr), Ranges(Ranges.vec()),
401-
FixIts(Hints.begin(), Hints.end()) {
401+
FixIts(Hints) {
402402
llvm::sort(FixIts);
403403
}
404404

llvm/lib/Support/VirtualFileSystem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ class CombiningDirIterImpl : public llvm::vfs::detail::DirIterImpl {
611611

612612
CombiningDirIterImpl(ArrayRef<directory_iterator> DirIters,
613613
std::error_code &EC)
614-
: IterList(DirIters.begin(), DirIters.end()) {
614+
: IterList(DirIters) {
615615
EC = incrementImpl(true);
616616
}
617617

llvm/lib/Target/Hexagon/HexagonISelLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2274,7 +2274,7 @@ HexagonTargetLowering::LowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG)
22742274

22752275
// Normalize the mask so that the first non-negative index comes from
22762276
// the first operand.
2277-
SmallVector<int,8> Mask(AM.begin(), AM.end());
2277+
SmallVector<int, 8> Mask(AM);
22782278
unsigned F = llvm::find_if(AM, [](int M) { return M >= 0; }) - AM.data();
22792279
if (F == AM.size())
22802280
return DAG.getUNDEF(VecTy);

llvm/lib/Target/Hexagon/HexagonISelLoweringHVX.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,7 +1725,7 @@ HexagonTargetLowering::LowerHvxConcatVectors(SDValue Op, SelectionDAG &DAG)
17251725
return DAG.getNode(HexagonISD::QCAT, dl, VecTy, Op0, Op.getOperand(1));
17261726

17271727
ArrayRef<SDUse> U(Op.getNode()->ops());
1728-
SmallVector<SDValue,4> SV(U.begin(), U.end());
1728+
SmallVector<SDValue, 4> SV(U);
17291729
ArrayRef<SDValue> Ops(SV);
17301730

17311731
MVT HalfTy = typeSplit(VecTy).first;
@@ -2128,7 +2128,7 @@ SDValue
21282128
HexagonTargetLowering::LowerHvxIntrinsic(SDValue Op, SelectionDAG &DAG) const {
21292129
const SDLoc &dl(Op);
21302130
unsigned IntNo = Op.getConstantOperandVal(0);
2131-
SmallVector<SDValue> Ops(Op->ops().begin(), Op->ops().end());
2131+
SmallVector<SDValue> Ops(Op->ops());
21322132

21332133
auto Swap = [&](SDValue P) {
21342134
return DAG.getMergeValues({P.getValue(1), P.getValue(0)}, dl);
@@ -3589,7 +3589,7 @@ HexagonTargetLowering::PerformHvxDAGCombine(SDNode *N, DAGCombinerInfo &DCI)
35893589
SDValue Op(N, 0);
35903590
unsigned Opc = Op.getOpcode();
35913591

3592-
SmallVector<SDValue, 4> Ops(N->ops().begin(), N->ops().end());
3592+
SmallVector<SDValue, 4> Ops(N->ops());
35933593

35943594
if (Opc == ISD::TRUNCATE)
35953595
return combineTruncateBeforeLegal(Op, DCI);

llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2691,7 +2691,7 @@ auto HexagonVectorCombine::joinVectorElements(IRBuilderBase &Builder,
26912691
// joins, the shuffles will hopefully be folded into a perfect shuffle.
26922692
// The output will need to be sign-extended to a type with element width
26932693
// being a power-of-2 anyways.
2694-
SmallVector<Value *> Inputs(Values.begin(), Values.end());
2694+
SmallVector<Value *> Inputs(Values);
26952695

26962696
unsigned ToWidth = ToType->getScalarSizeInBits();
26972697
unsigned Width = Inputs.front()->getType()->getScalarSizeInBits();

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4292,7 +4292,7 @@ static SDValue getAVX512Node(unsigned Opcode, const SDLoc &DL, MVT VT,
42924292
DstVT = MVT::getVectorVT(SVT, 512 / SVT.getSizeInBits());
42934293

42944294
// Canonicalize src operands.
4295-
SmallVector<SDValue> SrcOps(Ops.begin(), Ops.end());
4295+
SmallVector<SDValue> SrcOps(Ops);
42964296
for (SDValue &Op : SrcOps) {
42974297
MVT OpVT = Op.getSimpleValueType();
42984298
// Just pass through scalar operands.
@@ -39292,7 +39292,7 @@ static SDValue combineX86ShuffleChainWithExtract(
3929239292
// Attempt to peek through inputs and adjust mask when we extract from an
3929339293
// upper subvector.
3929439294
int AdjustedMasks = 0;
39295-
SmallVector<SDValue, 4> WideInputs(Inputs.begin(), Inputs.end());
39295+
SmallVector<SDValue, 4> WideInputs(Inputs);
3929639296
for (unsigned I = 0; I != NumInputs; ++I) {
3929739297
SDValue &Input = WideInputs[I];
3929839298
Input = peekThroughBitcasts(Input);
@@ -39977,8 +39977,7 @@ static SDValue combineX86ShufflesRecursively(
3997739977
HasVariableMask |= IsOpVariableMask;
3997839978

3997939979
// Update the list of shuffle nodes that have been combined so far.
39980-
SmallVector<const SDNode *, 16> CombinedNodes(SrcNodes.begin(),
39981-
SrcNodes.end());
39980+
SmallVector<const SDNode *, 16> CombinedNodes(SrcNodes);
3998239981
CombinedNodes.push_back(Op.getNode());
3998339982

3998439983
// See if we can recurse into each shuffle source op (if it's a target

llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ int llvm::libDriverMain(ArrayRef<const char *> ArgsArr) {
312312
StringSaver Saver(Alloc);
313313

314314
// Parse command line arguments.
315-
SmallVector<const char *, 20> NewArgs(ArgsArr.begin(), ArgsArr.end());
315+
SmallVector<const char *, 20> NewArgs(ArgsArr);
316316
cl::ExpandResponseFiles(Saver, cl::TokenizeWindowsCommandLine, NewArgs);
317317
ArgsArr = NewArgs;
318318

llvm/test/tools/dsymutil/X86/timestamp-mismatch.test

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@ RUN: cp %p/../Inputs/basic.macho.x86_64 %t/Inputs
33
RUN: cp %p/../Inputs/basic1.macho.x86_64.o %t/Inputs
44
RUN: cp %p/../Inputs/basic2.macho.x86_64.o %t/Inputs
55
RUN: cp %p/../Inputs/basic3.macho.x86_64.o %t/Inputs
6-
RUN: dsymutil -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 -o %t.dSYM 2>&1 | FileCheck %s
6+
RUN: dsymutil -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 -o %t.dSYM 2>&1 | FileCheck %s --check-prefix=WARN
7+
RUN: dsymutil -no-object-timestamp -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 -o %t.dSYM 2>&1 | FileCheck %s --allow-empty --check-prefix=NOWARN
78

8-
RUN: dsymutil --linker parallel -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 -o %t.dSYM 2>&1 | FileCheck %s
9+
RUN: dsymutil --linker parallel -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 -o %t.dSYM 2>&1 | FileCheck %s --check-prefix=WARN
10+
RUN: dsymutil --linker parallel -no-object-timestamp -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 -o %t.dSYM 2>&1 | FileCheck %s --allow-empty --check-prefix=NOWARN
911

10-
CHECK: warning: {{.*}}/Inputs/basic1.macho.x86_64.o: timestamp mismatch between object file ({{.*}}) and debug map ({{.*}})
11-
CHECK: warning: {{.*}}/Inputs/basic2.macho.x86_64.o: timestamp mismatch between object file ({{.*}}) and debug map ({{.*}})
12-
CHECK: warning: {{.*}}/Inputs/basic3.macho.x86_64.o: timestamp mismatch between object file ({{.*}}) and debug map ({{.*}})
12+
WARN: warning: {{.*}}/Inputs/basic1.macho.x86_64.o: timestamp mismatch between object file ({{.*}}) and debug map ({{.*}})
13+
WARN: warning: {{.*}}/Inputs/basic2.macho.x86_64.o: timestamp mismatch between object file ({{.*}}) and debug map ({{.*}})
14+
WARN: warning: {{.*}}/Inputs/basic3.macho.x86_64.o: timestamp mismatch between object file ({{.*}}) and debug map ({{.*}})
15+
16+
NOWARN-NOT: warning: {{.*}}/Inputs/basic3.macho.x86_64.o: timestamp mismatch between object file ({{.*}}) and debug map ({{.*}})

llvm/test/tools/dsymutil/cmdline.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ CHECK: -flat
1515
CHECK: -gen-reproducer
1616
CHECK: -help
1717
CHECK: -keep-function-for-static
18+
CHECK: -no-object-timestamp
1819
CHECK: -no-odr
1920
CHECK: -no-output
2021
CHECK: -no-swiftmodule-timestamp

0 commit comments

Comments
 (0)