Skip to content

[Debugify] applyDebugify - remove unnecessary defaults arg values and assert dereferencable values #127186

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

Merged
merged 1 commit into from
Feb 14, 2025
Merged
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
19 changes: 8 additions & 11 deletions llvm/lib/Transforms/Utils/Debugify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,30 +214,27 @@ bool llvm::applyDebugifyMetadata(
return true;
}

static bool
applyDebugify(Function &F,
enum DebugifyMode Mode = DebugifyMode::SyntheticDebugInfo,
DebugInfoPerPass *DebugInfoBeforePass = nullptr,
StringRef NameOfWrappedPass = "") {
static bool applyDebugify(Function &F, enum DebugifyMode Mode,
DebugInfoPerPass *DebugInfoBeforePass,
StringRef NameOfWrappedPass = "") {
Module &M = *F.getParent();
auto FuncIt = F.getIterator();
if (Mode == DebugifyMode::SyntheticDebugInfo)
return applyDebugifyMetadata(M, make_range(FuncIt, std::next(FuncIt)),
"FunctionDebugify: ", /*ApplyToMF*/ nullptr);
assert(DebugInfoBeforePass);
assert(DebugInfoBeforePass && "Missing debug info metadata");
return collectDebugInfoMetadata(M, M.functions(), *DebugInfoBeforePass,
"FunctionDebugify (original debuginfo)",
NameOfWrappedPass);
}

static bool
applyDebugify(Module &M,
enum DebugifyMode Mode = DebugifyMode::SyntheticDebugInfo,
DebugInfoPerPass *DebugInfoBeforePass = nullptr,
StringRef NameOfWrappedPass = "") {
static bool applyDebugify(Module &M, enum DebugifyMode Mode,
DebugInfoPerPass *DebugInfoBeforePass,
StringRef NameOfWrappedPass = "") {
if (Mode == DebugifyMode::SyntheticDebugInfo)
return applyDebugifyMetadata(M, M.functions(),
"ModuleDebugify: ", /*ApplyToMF*/ nullptr);
assert(DebugInfoBeforePass && "Missing debug info metadata");
return collectDebugInfoMetadata(M, M.functions(), *DebugInfoBeforePass,
"ModuleDebugify (original debuginfo)",
NameOfWrappedPass);
Expand Down