Skip to content

Revert "[flang] Lower c_ptr_eq/ne for iso_c_binding" #85293

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
Mar 14, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 0 additions & 3 deletions flang/include/flang/Optimizer/Builder/IntrinsicCall.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,6 @@ struct IntrinsicLibrary {
void genCFProcPointer(llvm::ArrayRef<fir::ExtendedValue>);
fir::ExtendedValue genCFunLoc(mlir::Type, llvm::ArrayRef<fir::ExtendedValue>);
fir::ExtendedValue genCLoc(mlir::Type, llvm::ArrayRef<fir::ExtendedValue>);
template <mlir::arith::CmpIPredicate pred>
fir::ExtendedValue genCPtrCompare(mlir::Type,
llvm::ArrayRef<fir::ExtendedValue>);
mlir::Value genCosd(mlir::Type, llvm::ArrayRef<mlir::Value>);
void genDateAndTime(llvm::ArrayRef<fir::ExtendedValue>);
mlir::Value genDim(mlir::Type, llvm::ArrayRef<mlir::Value>);
Expand Down
19 changes: 0 additions & 19 deletions flang/lib/Optimizer/Builder/IntrinsicCall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ static constexpr IntrinsicHandler handlers[]{
/*isElemental=*/false},
{"c_funloc", &I::genCFunLoc, {{{"x", asBox}}}, /*isElemental=*/false},
{"c_loc", &I::genCLoc, {{{"x", asBox}}}, /*isElemental=*/false},
{"c_ptr_eq", &I::genCPtrCompare<mlir::arith::CmpIPredicate::eq>},
{"c_ptr_ne", &I::genCPtrCompare<mlir::arith::CmpIPredicate::ne>},
{"ceiling", &I::genCeiling},
{"char", &I::genChar},
{"cmplx",
Expand Down Expand Up @@ -2799,23 +2797,6 @@ IntrinsicLibrary::genCLoc(mlir::Type resultType,
return genCLocOrCFunLoc(builder, loc, resultType, args);
}

// C_PTR_EQ and C_PTR_NE
template <mlir::arith::CmpIPredicate pred>
fir::ExtendedValue
IntrinsicLibrary::genCPtrCompare(mlir::Type resultType,
llvm::ArrayRef<fir::ExtendedValue> args) {
assert(args.size() == 2);
mlir::Value cPtr1 = fir::getBase(args[0]);
mlir::Value cPtrVal1 =
fir::factory::genCPtrOrCFunptrValue(builder, loc, cPtr1);
mlir::Value cPtr2 = fir::getBase(args[1]);
mlir::Value cPtrVal2 =
fir::factory::genCPtrOrCFunptrValue(builder, loc, cPtr2);
mlir::Value cmp =
builder.create<mlir::arith::CmpIOp>(loc, pred, cPtrVal1, cPtrVal2);
return builder.createConvert(loc, resultType, cmp);
}

// CEILING
mlir::Value IntrinsicLibrary::genCeiling(mlir::Type resultType,
llvm::ArrayRef<mlir::Value> args) {
Expand Down
2 changes: 1 addition & 1 deletion flang/module/__fortran_builtins.f90
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
public :: operator(==)

interface operator(/=)
module procedure __builtin_c_ptr_ne
module procedure __builtin_c_ptr_eq
end interface
public :: operator(/=)

Expand Down
56 changes: 0 additions & 56 deletions flang/test/Lower/Intrinsics/c_ptr_eq_ne.f90

This file was deleted.