Skip to content

Fix whitespace changes introduced during a merge conflict resolution #14680

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
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
34 changes: 17 additions & 17 deletions lib/IRGen/IRGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ void swift::performLLVMOptimizations(IRGenOptions &Opts, llvm::Module *Module,
PMBuilder.addExtension(PassManagerBuilder::EP_EnabledOnOptLevel0,
addAddressSanitizerPasses);
}

if (Opts.Sanitizers & SanitizerKind::Thread) {
PMBuilder.addExtension(PassManagerBuilder::EP_OptimizerLast,
addThreadSanitizerPass);
Expand Down Expand Up @@ -657,7 +657,7 @@ static void embedBitcode(llvm::Module *M, const IRGenOptions &Opts)
static void initLLVMModule(const IRGenModule &IGM) {
auto *Module = IGM.getModule();
assert(Module && "Expected llvm:Module for IR generation!");

Module->setTargetTriple(IGM.Triple.str());

// Set the module's string representation.
Expand Down Expand Up @@ -736,7 +736,7 @@ static std::unique_ptr<llvm::Module> performIRGeneration(IRGenOptions &Opts,

// Run SIL level IRGen preparation passes.
runIRGenPreparePasses(*SILMod, IGM);

{
SharedTimer timer("IRGen");
// Emit the module contents.
Expand Down Expand Up @@ -884,7 +884,7 @@ static void performParallelIRGeneration(IRGenOptions &Opts,
}
}
} _igmDeleter(irgen);

auto OutputIter = Opts.OutputFilenames.begin();
bool IGMcreated = false;

Expand All @@ -895,7 +895,7 @@ static void performParallelIRGeneration(IRGenOptions &Opts,
auto nextSF = dyn_cast<SourceFile>(File);
if (!nextSF || nextSF->ASTStage < SourceFile::TypeChecked)
continue;

// There must be an output filename for each source file.
// We ignore additional output filenames.
if (OutputIter == Opts.OutputFilenames.end()) {
Expand All @@ -908,9 +908,9 @@ static void performParallelIRGeneration(IRGenOptions &Opts,
if (!targetMachine) continue;

// This (and the IGM itself) will get deleted by the IGMDeleter
// as long as the IGM is registered with the IRGenerator.
// as long as the IGM is registered with the IRGenerator.
auto Context = new LLVMContext();

// Create the IR emitter.
IRGenModule *IGM = new IRGenModule(irgen, std::move(targetMachine),
nextSF, *Context,
Expand All @@ -925,7 +925,7 @@ static void performParallelIRGeneration(IRGenOptions &Opts,
DidRunSILCodeGenPreparePasses = true;
}
}

if (!IGMcreated) {
// TODO: Check this already at argument parsing.
Ctx.Diags.diagnose(SourceLoc(), diag::no_input_files_for_mt);
Expand All @@ -934,7 +934,7 @@ static void performParallelIRGeneration(IRGenOptions &Opts,

// Emit the module contents.
irgen.emitGlobalTopLevel();

for (auto *File : M->getFiles()) {
if (auto *SF = dyn_cast<SourceFile>(File)) {
IRGenModule *IGM = irgen.getGenModule(SF);
Expand All @@ -945,7 +945,7 @@ static void performParallelIRGeneration(IRGenOptions &Opts,
});
}
}

// Okay, emit any definitions that we suddenly need.
irgen.emitLazyDefinitions();

Expand All @@ -966,32 +966,32 @@ static void performParallelIRGeneration(IRGenOptions &Opts,

// Emit symbols for eliminated dead methods.
PrimaryGM->emitVTableStubs();

// Verify type layout if we were asked to.
if (!Opts.VerifyTypeLayoutNames.empty())
PrimaryGM->emitTypeVerifier();

std::for_each(Opts.LinkLibraries.begin(), Opts.LinkLibraries.end(),
[&](LinkLibrary linkLib) {
PrimaryGM->addLinkLibrary(linkLib);
});

// Hack to handle thunks eagerly synthesized by the Clang importer.
swift::ModuleDecl *prev = nullptr;
for (auto external : Ctx.ExternalDefinitions) {
swift::ModuleDecl *next = external->getModuleContext();
if (next == prev)
continue;
prev = next;

if (next->getName() == M->getName())
continue;

next->collectLinkLibraries([&](LinkLibrary linkLib) {
PrimaryGM->addLinkLibrary(linkLib);
});
}

llvm::StringSet<> referencedGlobals;

for (auto it = irgen.begin(); it != irgen.end(); ++it) {
Expand Down Expand Up @@ -1019,7 +1019,7 @@ static void performParallelIRGeneration(IRGenOptions &Opts,
for (auto it = irgen.begin(); it != irgen.end(); ++it) {
IRGenModule *IGM = it->second;
llvm::Module *M = IGM->getModule();

// Update the linkage of shared functions/globals.
// If a shared function/global is referenced from another file it must have
// weak instead of linkonce linkage. Otherwise LLVM would remove the
Expand Down