Skip to content

[flang] Remove dead functions for getting LLVM intrinsics #137743

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
Apr 29, 2025

Conversation

ashermancinelli
Copy link
Contributor

In cleaning up LowLevelIntrinsics I found some uncalled functions. We would like to remove direct calls to llvm instructions wherever possible to make it easier on consumers of our IR to match LLVM intrinsics, so if this code is needed again we should use the op from the llvm dialect instead anyways.

In cleaning up LowLevelIntrinsics I found some uncalled functions.
We would like to remove direct calls to llvm instructions wherever possible
to make it easier on consumers of our IR to match LLVM intrinsics, so if
this code is needed again we should use the op from the llvm dialect instead
anyways.
@ashermancinelli ashermancinelli self-assigned this Apr 29, 2025
@llvmbot llvmbot added flang Flang issues not falling into any other category flang:fir-hlfir labels Apr 29, 2025
@llvmbot
Copy link
Member

llvmbot commented Apr 29, 2025

@llvm/pr-subscribers-flang-fir-hlfir

Author: Asher Mancinelli (ashermancinelli)

Changes

In cleaning up LowLevelIntrinsics I found some uncalled functions. We would like to remove direct calls to llvm instructions wherever possible to make it easier on consumers of our IR to match LLVM intrinsics, so if this code is needed again we should use the op from the llvm dialect instead anyways.


Full diff: https://github.com/llvm/llvm-project/pull/137743.diff

2 Files Affected:

  • (modified) flang/include/flang/Optimizer/Builder/LowLevelIntrinsics.h (-3)
  • (modified) flang/lib/Optimizer/Builder/LowLevelIntrinsics.cpp (-10)
diff --git a/flang/include/flang/Optimizer/Builder/LowLevelIntrinsics.h b/flang/include/flang/Optimizer/Builder/LowLevelIntrinsics.h
index 45499906e39f8..9303f09d42fb9 100644
--- a/flang/include/flang/Optimizer/Builder/LowLevelIntrinsics.h
+++ b/flang/include/flang/Optimizer/Builder/LowLevelIntrinsics.h
@@ -24,9 +24,6 @@ class FirOpBuilder;
 
 namespace fir::factory {
 
-/// Get the LLVM intrinsic for `memset`. Use the 64 bit version.
-mlir::func::FuncOp getLlvmMemset(FirOpBuilder &builder);
-
 /// Get the C standard library `realloc` function.
 mlir::func::FuncOp getRealloc(FirOpBuilder &builder);
 
diff --git a/flang/lib/Optimizer/Builder/LowLevelIntrinsics.cpp b/flang/lib/Optimizer/Builder/LowLevelIntrinsics.cpp
index 73fd8fa0c2b61..64d70d70829fb 100644
--- a/flang/lib/Optimizer/Builder/LowLevelIntrinsics.cpp
+++ b/flang/lib/Optimizer/Builder/LowLevelIntrinsics.cpp
@@ -21,16 +21,6 @@
 #include "flang/Optimizer/Builder/LowLevelIntrinsics.h"
 #include "flang/Optimizer/Builder/FIRBuilder.h"
 
-mlir::func::FuncOp fir::factory::getLlvmMemset(fir::FirOpBuilder &builder) {
-  auto ptrTy = builder.getRefType(builder.getIntegerType(8));
-  llvm::SmallVector<mlir::Type> args = {ptrTy, ptrTy, builder.getI64Type(),
-                                        builder.getI1Type()};
-  auto memsetTy =
-      mlir::FunctionType::get(builder.getContext(), args, std::nullopt);
-  return builder.createFunction(builder.getUnknownLoc(),
-                                "llvm.memset.p0.p0.i64", memsetTy);
-}
-
 mlir::func::FuncOp fir::factory::getRealloc(fir::FirOpBuilder &builder) {
   auto ptrTy = builder.getRefType(builder.getIntegerType(8));
   llvm::SmallVector<mlir::Type> args = {ptrTy, builder.getI64Type()};

Copy link
Contributor

@vzakhari vzakhari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, Asher!

@ashermancinelli ashermancinelli merged commit 1433c3e into llvm:main Apr 29, 2025
14 checks passed
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
In cleaning up LowLevelIntrinsics I found some uncalled functions. We
would like to remove direct calls to llvm instructions wherever possible
to make it easier on consumers of our IR to match LLVM intrinsics, so if
this code is needed again we should use the op from the llvm dialect
instead anyways.
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
In cleaning up LowLevelIntrinsics I found some uncalled functions. We
would like to remove direct calls to llvm instructions wherever possible
to make it easier on consumers of our IR to match LLVM intrinsics, so if
this code is needed again we should use the op from the llvm dialect
instead anyways.
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
In cleaning up LowLevelIntrinsics I found some uncalled functions. We
would like to remove direct calls to llvm instructions wherever possible
to make it easier on consumers of our IR to match LLVM intrinsics, so if
this code is needed again we should use the op from the llvm dialect
instead anyways.
GeorgeARM pushed a commit to GeorgeARM/llvm-project that referenced this pull request May 7, 2025
In cleaning up LowLevelIntrinsics I found some uncalled functions. We
would like to remove direct calls to llvm instructions wherever possible
to make it easier on consumers of our IR to match LLVM intrinsics, so if
this code is needed again we should use the op from the llvm dialect
instead anyways.
Ankur-0429 pushed a commit to Ankur-0429/llvm-project that referenced this pull request May 9, 2025
In cleaning up LowLevelIntrinsics I found some uncalled functions. We
would like to remove direct calls to llvm instructions wherever possible
to make it easier on consumers of our IR to match LLVM intrinsics, so if
this code is needed again we should use the op from the llvm dialect
instead anyways.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang:fir-hlfir flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants