[Passes] Add DisableSimplifyLibCalls flag to runCodeGenPipeline - #222430
Merged
boomanaiden154 merged 1 commit intoSep 10, 2026
Conversation
Created using spr 1.3.7
|
@llvm/pr-subscribers-clang-codegen Author: Aiden Grossman (boomanaiden154) ChangesThis enables this abstraction to be a drop-in replacement for rustc Full diff: https://github.com/llvm/llvm-project/pull/222430.diff 3 Files Affected:
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index c09a8f7c0d679..737760c4b7db1 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -1243,7 +1243,8 @@ void EmitAssemblyHelper::RunCodegenPipeline(
TimeCodegenPasses([&]() {
Error CodeGenError = runCodeGenPipeline(
*TM, *TheModule, *OS, DwoOS, CGFT, PrintPipelinePasses.has_value(),
- !CodeGenOpts.VerifyModule, CI.getVirtualFileSystemPtr());
+ !CodeGenOpts.VerifyModule, /*DisableSimplifyLibCalls=*/false,
+ CI.getVirtualFileSystemPtr());
if (CodeGenError)
Diags.Report(diag::err_fe_unable_to_interface_with_target);
});
diff --git a/llvm/include/llvm/Passes/RunCodeGen.h b/llvm/include/llvm/Passes/RunCodeGen.h
index 713b46b465ceb..4834b99dbe6fb 100644
--- a/llvm/include/llvm/Passes/RunCodeGen.h
+++ b/llvm/include/llvm/Passes/RunCodeGen.h
@@ -20,6 +20,7 @@ Error runCodeGenPipeline(
TargetMachine &TM, Module &M, raw_pwrite_stream &OS,
std::unique_ptr<ToolOutputFile> &DwoOS, CodeGenFileType CGFT,
bool PrintPipelinePasses = false, bool DisableVerify = true,
+ bool DisableSimplifyLibCalls = false,
IntrusiveRefCntPtr<vfs::FileSystem> VFS = vfs::getRealFileSystem());
} // namespace llvm
diff --git a/llvm/lib/Passes/RunCodeGen.cpp b/llvm/lib/Passes/RunCodeGen.cpp
index 66e48b802416d..adcebe0d6ad20 100644
--- a/llvm/lib/Passes/RunCodeGen.cpp
+++ b/llvm/lib/Passes/RunCodeGen.cpp
@@ -31,17 +31,18 @@ static cl::opt<cl::boolOrDefault>
"option will default to what the target prefers."),
cl::init(cl::boolOrDefault::BOU_UNSET));
-static Error runCodeGenPipelineLegacy(TargetMachine &TM, Module &M,
- raw_pwrite_stream &OS,
- std::unique_ptr<ToolOutputFile> &DwoOS,
- CodeGenFileType CGFT,
- bool PrintPipelinePasses,
- bool DisableVerify) {
+static Error
+runCodeGenPipelineLegacy(TargetMachine &TM, Module &M, raw_pwrite_stream &OS,
+ std::unique_ptr<ToolOutputFile> &DwoOS,
+ CodeGenFileType CGFT, bool PrintPipelinePasses,
+ bool DisableVerify, bool DisableSimplifyLibCalls) {
legacy::PassManager CodeGenPasses;
CodeGenPasses.add(
createTargetTransformInfoWrapperPass(TM.getTargetIRAnalysis()));
// Add LibraryInfo.
TargetLibraryInfoImpl TLII(TM.getTargetTriple(), TM.Options.VecLib);
+ if (DisableSimplifyLibCalls)
+ TLII.disableAllFunctions();
CodeGenPasses.add(new TargetLibraryInfoWrapperPass(TLII));
const TargetOptions &Options = TM.Options;
@@ -98,7 +99,7 @@ Error llvm::runCodeGenPipeline(TargetMachine &TM, Module &M,
raw_pwrite_stream &OS,
std::unique_ptr<ToolOutputFile> &DwoOS,
CodeGenFileType CGFT, bool PrintPipelinePasses,
- bool DisableVerify,
+ bool DisableVerify, bool DisableSimplifyLibCalls,
IntrusiveRefCntPtr<vfs::FileSystem> VFS) {
if (ForceNewPM == cl::boolOrDefault::BOU_TRUE ||
(TM.shouldDefaultToNewPM() &&
@@ -107,5 +108,5 @@ Error llvm::runCodeGenPipeline(TargetMachine &TM, Module &M,
}
return runCodeGenPipelineLegacy(TM, M, OS, DwoOS, CGFT, PrintPipelinePasses,
- DisableVerify);
+ DisableVerify, DisableSimplifyLibCalls);
}
|
aengelke
approved these changes
Sep 10, 2026
boomanaiden154
deleted the
users/boomanaiden154/passes-add-disablesimplifylibcalls-flag-to-runcodegenpipeline
branch
September 10, 2026 14:17
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/234/builds/4402 Here is the relevant piece of the build log for the reference |
vadimkotov
pushed a commit
to vadimkotov/llvm-project
that referenced
this pull request
Sep 11, 2026
…#222430) This enables this abstraction to be a drop-in replacement for rustc after some minor refactoring.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This enables this abstraction to be a drop-in replacement for rustc
after some minor refactoring.