Skip to content

[definite-init] Convert always true bool return value to void. #21588

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
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
8 changes: 5 additions & 3 deletions lib/SILOptimizer/Mandatory/DefiniteInitialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2818,7 +2818,7 @@ bool LifetimeChecker::isInitializedAtUse(const DIMemoryUse &Use,
// Top Level Driver
//===----------------------------------------------------------------------===//

static bool processMemoryObject(MarkUninitializedInst *I) {
static void processMemoryObject(MarkUninitializedInst *I) {
LLVM_DEBUG(llvm::dbgs() << "*** Definite Init looking at: " << *I << "\n");
DIMemoryObjectInfo MemInfo(I);

Expand All @@ -2830,7 +2830,6 @@ static bool processMemoryObject(MarkUninitializedInst *I) {
/*TreatAddressToPointerAsInout*/ true);

LifetimeChecker(MemInfo, UseInfo).doIt();
return true;
}

/// Check that all memory objects that require initialization before use are
Expand All @@ -2846,11 +2845,14 @@ static bool checkDefiniteInitialization(SILFunction &Fn) {
SILInstruction *Inst = &*I;

auto *MUI = dyn_cast<MarkUninitializedInst>(Inst);
if (!MUI || !processMemoryObject(MUI)) {
if (!MUI) {
++I;
continue;
}

// Then process the memory object.
processMemoryObject(MUI);

// Move off of the MUI only after we have processed memory objects. The
// lifetime checker may rewrite instructions, so it is important to not
// move onto the next element until after it runs.
Expand Down