Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🍒 swift/release/6.1] [dsymutil] Provide an option to ignore object timestamp mismatches (#113238) #9753

Open
wants to merge 3 commits into
base: swift/release/6.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions llvm/docs/CommandGuide/dsymutil.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ OPTIONS
used in conjunction with ``--update`` option, this option will cause redundant
accelerator tables to be removed.

.. option:: --no-object-timestamp

Don't check timestamp for object files.

.. option:: --no-odr

Do not use ODR (One Definition Rule) for uniquing C++ types.
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1389,7 +1389,7 @@ class TargetTransformInfoImplCRTPBase : public TargetTransformInfoImplBase {

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

// Widening shuffle - widening the source(s) to the new length
// (treated as free - see above), and then perform the adjusted
Expand Down
3 changes: 1 addition & 2 deletions llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h
Original file line number Diff line number Diff line change
Expand Up @@ -669,8 +669,7 @@ class BuildInfoRecord : public TypeRecord {
BuildInfoRecord() = default;
explicit BuildInfoRecord(TypeRecordKind Kind) : TypeRecord(Kind) {}
BuildInfoRecord(ArrayRef<TypeIndex> ArgIndices)
: TypeRecord(TypeRecordKind::BuildInfo),
ArgIndices(ArgIndices.begin(), ArgIndices.end()) {}
: TypeRecord(TypeRecordKind::BuildInfo), ArgIndices(ArgIndices) {}

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

Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/FuzzMutate/RandomIRBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct RandomIRBuilder {
uint64_t MinFunctionNum = 1;

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

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

Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/IR/DebugInfoMetadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -3990,7 +3990,7 @@ class DIArgList : public Metadata, ReplaceableMetadataImpl {

DIArgList(LLVMContext &Context, ArrayRef<ValueAsMetadata *> Args)
: Metadata(DIArgListKind, Uniqued), ReplaceableMetadataImpl(Context),
Args(Args.begin(), Args.end()) {
Args(Args) {
track();
}
~DIArgList() { untrack(); }
Expand Down
3 changes: 1 addition & 2 deletions llvm/include/llvm/IR/Metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -1489,8 +1489,7 @@ class MDTuple : public MDNode {

TempMDTuple cloneImpl() const {
ArrayRef<MDOperand> Operands = operands();
return getTemporary(getContext(), SmallVector<Metadata *, 4>(
Operands.begin(), Operands.end()));
return getTemporary(getContext(), SmallVector<Metadata *, 4>(Operands));
}

public:
Expand Down
3 changes: 1 addition & 2 deletions llvm/include/llvm/MC/MCFragment.h
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,7 @@ class MCCVDefRangeFragment : public MCEncodedFragmentWithFixups<32, 4> {
ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
StringRef FixedSizePortion)
: MCEncodedFragmentWithFixups<32, 4>(FT_CVDefRange, false),
Ranges(Ranges.begin(), Ranges.end()),
FixedSizePortion(FixedSizePortion) {}
Ranges(Ranges), FixedSizePortion(FixedSizePortion) {}

ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> getRanges() const {
return Ranges;
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/ProfileData/MemProf.h
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ struct IndexedAllocationInfo {
IndexedAllocationInfo(ArrayRef<FrameId> CS, CallStackId CSId,
const MemInfoBlock &MB,
const MemProfSchema &Schema = getFullSchema())
: CallStack(CS.begin(), CS.end()), CSId(CSId), Info(MB, Schema) {}
: CallStack(CS), CSId(CSId), Info(MB, Schema) {}

// Returns the size in bytes when this allocation info struct is serialized.
size_t serializedSize(const MemProfSchema &Schema,
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/Support/GenericDomTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ class DominatorTreeBase {
// The PostViewCFG is created with updates reversed (equivalent to changes
// made to the CFG), so the PreViewCFG needs all the updates reverse
// applied.
SmallVector<UpdateType> AllUpdates(Updates.begin(), Updates.end());
SmallVector<UpdateType> AllUpdates(Updates);
append_range(AllUpdates, PostViewUpdates);
GraphDiff<NodePtr, IsPostDom> PreViewCFG(AllUpdates,
/*ReverseApplyUpdates=*/true);
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/Support/ScopedPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class ScopedPrinter {
void printFlags(StringRef Label, T Value, ArrayRef<EnumEntry<TFlag>> Flags,
TFlag EnumMask1 = {}, TFlag EnumMask2 = {},
TFlag EnumMask3 = {}, ArrayRef<FlagEntry> ExtraFlags = {}) {
SmallVector<FlagEntry, 10> SetFlags(ExtraFlags.begin(), ExtraFlags.end());
SmallVector<FlagEntry, 10> SetFlags(ExtraFlags);

for (const auto &Flag : Flags) {
if (Flag.Value == 0)
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ MDNode *AAMDNodes::extendToTBAA(MDNode *MD, ssize_t Len) {

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

// Don't create a new MDNode if it is the same length.
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Analysis/ValueTracking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6122,7 +6122,7 @@ static Value *BuildSubAggregate(Value *From, ArrayRef<unsigned> idx_range,
Type *IndexedType = ExtractValueInst::getIndexedType(From->getType(),
idx_range);
Value *To = PoisonValue::get(IndexedType);
SmallVector<unsigned, 10> Idxs(idx_range.begin(), idx_range.end());
SmallVector<unsigned, 10> Idxs(idx_range);
unsigned IdxSkip = Idxs.size();

return BuildSubAggregate(From, To, IndexedType, Idxs, IdxSkip, InsertBefore);
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/IR/Attributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,7 @@ AttributeSetNode::AttributeSetNode(ArrayRef<Attribute> Attrs)

AttributeSetNode *AttributeSetNode::get(LLVMContext &C,
ArrayRef<Attribute> Attrs) {
SmallVector<Attribute, 8> SortedAttrs(Attrs.begin(), Attrs.end());
SmallVector<Attribute, 8> SortedAttrs(Attrs);
llvm::sort(SortedAttrs);
return getSorted(C, SortedAttrs);
}
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/IR/DebugInfoMetadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1865,7 +1865,7 @@ DIExpression *DIExpression::appendOpsToArg(const DIExpression *Expr,
[](auto Op) { return Op.getOp() == dwarf::DW_OP_LLVM_arg; })) {
assert(ArgNo == 0 &&
"Location Index must be 0 for a non-variadic expression.");
SmallVector<uint64_t, 8> NewOps(Ops.begin(), Ops.end());
SmallVector<uint64_t, 8> NewOps(Ops);
return DIExpression::prependOpcodes(Expr, NewOps, StackValue);
}

Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Linker/IRMover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1371,8 +1371,7 @@ Error IRLinker::linkModuleFlagsMetadata() {
return dyn_cast<MDTuple>(DstValue);
ArrayRef<MDOperand> DstOperands = DstValue->operands();
MDTuple *New = MDTuple::getDistinct(
DstM.getContext(),
SmallVector<Metadata *, 4>(DstOperands.begin(), DstOperands.end()));
DstM.getContext(), SmallVector<Metadata *, 4>(DstOperands));
Metadata *FlagOps[] = {DstOp->getOperand(0), ID, New};
MDNode *Flag = MDTuple::getDistinct(DstM.getContext(), FlagOps);
DstModFlags->setOperand(DstIndex, Flag);
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Object/BuildID.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ BuildID llvm::object::parseBuildID(StringRef Str) {
return {};
ArrayRef<uint8_t> BuildID(reinterpret_cast<const uint8_t *>(Bytes.data()),
Bytes.size());
return SmallVector<uint8_t>(BuildID.begin(), BuildID.end());
return SmallVector<uint8_t>(BuildID);
}

BuildIDRef llvm::object::getBuildID(const ObjectFile *Obj) {
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Support/SourceMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ SMDiagnostic::SMDiagnostic(const SourceMgr &sm, SMLoc L, StringRef FN, int Line,
ArrayRef<SMFixIt> Hints)
: SM(&sm), Loc(L), Filename(std::string(FN)), LineNo(Line), ColumnNo(Col),
Kind(Kind), Message(Msg), LineContents(LineStr), Ranges(Ranges.vec()),
FixIts(Hints.begin(), Hints.end()) {
FixIts(Hints) {
llvm::sort(FixIts);
}

Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Support/VirtualFileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ class CombiningDirIterImpl : public llvm::vfs::detail::DirIterImpl {

CombiningDirIterImpl(ArrayRef<directory_iterator> DirIters,
std::error_code &EC)
: IterList(DirIters.begin(), DirIters.end()) {
: IterList(DirIters) {
EC = incrementImpl(true);
}

Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/Hexagon/HexagonISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2274,7 +2274,7 @@ HexagonTargetLowering::LowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG)

// Normalize the mask so that the first non-negative index comes from
// the first operand.
SmallVector<int,8> Mask(AM.begin(), AM.end());
SmallVector<int, 8> Mask(AM);
unsigned F = llvm::find_if(AM, [](int M) { return M >= 0; }) - AM.data();
if (F == AM.size())
return DAG.getUNDEF(VecTy);
Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/Target/Hexagon/HexagonISelLoweringHVX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1725,7 +1725,7 @@ HexagonTargetLowering::LowerHvxConcatVectors(SDValue Op, SelectionDAG &DAG)
return DAG.getNode(HexagonISD::QCAT, dl, VecTy, Op0, Op.getOperand(1));

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

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

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

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

if (Opc == ISD::TRUNCATE)
return combineTruncateBeforeLegal(Op, DCI);
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2691,7 +2691,7 @@ auto HexagonVectorCombine::joinVectorElements(IRBuilderBase &Builder,
// joins, the shuffles will hopefully be folded into a perfect shuffle.
// The output will need to be sign-extended to a type with element width
// being a power-of-2 anyways.
SmallVector<Value *> Inputs(Values.begin(), Values.end());
SmallVector<Value *> Inputs(Values);

unsigned ToWidth = ToType->getScalarSizeInBits();
unsigned Width = Inputs.front()->getType()->getScalarSizeInBits();
Expand Down
7 changes: 3 additions & 4 deletions llvm/lib/Target/X86/X86ISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4292,7 +4292,7 @@ static SDValue getAVX512Node(unsigned Opcode, const SDLoc &DL, MVT VT,
DstVT = MVT::getVectorVT(SVT, 512 / SVT.getSizeInBits());

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

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

// See if we can recurse into each shuffle source op (if it's a target
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ int llvm::libDriverMain(ArrayRef<const char *> ArgsArr) {
StringSaver Saver(Alloc);

// Parse command line arguments.
SmallVector<const char *, 20> NewArgs(ArgsArr.begin(), ArgsArr.end());
SmallVector<const char *, 20> NewArgs(ArgsArr);
cl::ExpandResponseFiles(Saver, cl::TokenizeWindowsCommandLine, NewArgs);
ArgsArr = NewArgs;

Expand Down
14 changes: 9 additions & 5 deletions llvm/test/tools/dsymutil/X86/timestamp-mismatch.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@ RUN: cp %p/../Inputs/basic.macho.x86_64 %t/Inputs
RUN: cp %p/../Inputs/basic1.macho.x86_64.o %t/Inputs
RUN: cp %p/../Inputs/basic2.macho.x86_64.o %t/Inputs
RUN: cp %p/../Inputs/basic3.macho.x86_64.o %t/Inputs
RUN: dsymutil -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 -o %t.dSYM 2>&1 | FileCheck %s
RUN: dsymutil -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 -o %t.dSYM 2>&1 | FileCheck %s --check-prefix=WARN
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

RUN: dsymutil --linker parallel -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 -o %t.dSYM 2>&1 | FileCheck %s
RUN: dsymutil --linker parallel -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 -o %t.dSYM 2>&1 | FileCheck %s --check-prefix=WARN
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

CHECK: warning: {{.*}}/Inputs/basic1.macho.x86_64.o: timestamp mismatch between object file ({{.*}}) and debug map ({{.*}})
CHECK: warning: {{.*}}/Inputs/basic2.macho.x86_64.o: timestamp mismatch between object file ({{.*}}) and debug map ({{.*}})
CHECK: warning: {{.*}}/Inputs/basic3.macho.x86_64.o: timestamp mismatch between object file ({{.*}}) and debug map ({{.*}})
WARN: warning: {{.*}}/Inputs/basic1.macho.x86_64.o: timestamp mismatch between object file ({{.*}}) and debug map ({{.*}})
WARN: warning: {{.*}}/Inputs/basic2.macho.x86_64.o: timestamp mismatch between object file ({{.*}}) and debug map ({{.*}})
WARN: warning: {{.*}}/Inputs/basic3.macho.x86_64.o: timestamp mismatch between object file ({{.*}}) and debug map ({{.*}})

NOWARN-NOT: warning: {{.*}}/Inputs/basic3.macho.x86_64.o: timestamp mismatch between object file ({{.*}}) and debug map ({{.*}})
1 change: 1 addition & 0 deletions llvm/test/tools/dsymutil/cmdline.test
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ CHECK: -flat
CHECK: -gen-reproducer
CHECK: -help
CHECK: -keep-function-for-static
CHECK: -no-object-timestamp
CHECK: -no-odr
CHECK: -no-output
CHECK: -no-swiftmodule-timestamp
Expand Down
Loading