[flang-commits] [flang] a95255f - Revert "[flang] Load fir.ref<fir.class<T>> instead of creating a wrong box"
Valentin Clement via flang-commits
flang-commits at lists.llvm.org
Wed Mar 15 02:38:32 PDT 2023
Author: Valentin Clement
Date: 2023-03-15T10:37:56+01:00
New Revision: a95255f9662b72c7a1121a59b4c346d0e823783f
URL: https://github.com/llvm/llvm-project/commit/a95255f9662b72c7a1121a59b4c346d0e823783f
DIFF: https://github.com/llvm/llvm-project/commit/a95255f9662b72c7a1121a59b4c346d0e823783f.diff
LOG: Revert "[flang] Load fir.ref<fir.class<T>> instead of creating a wrong box"
This reverts commit fbca61c46612a6377b7d7cf5b56573df3c6759e2.
This is causing some issue. Revert for now.
Added:
Modified:
flang/lib/Optimizer/Builder/FIRBuilder.cpp
flang/test/Lower/polymorphic.f90
Removed:
################################################################################
diff --git a/flang/lib/Optimizer/Builder/FIRBuilder.cpp b/flang/lib/Optimizer/Builder/FIRBuilder.cpp
index 39253e727265e..64c3c26231eb2 100644
--- a/flang/lib/Optimizer/Builder/FIRBuilder.cpp
+++ b/flang/lib/Optimizer/Builder/FIRBuilder.cpp
@@ -516,9 +516,6 @@ mlir::Value fir::FirOpBuilder::createBox(mlir::Location loc,
<< itemAddr.getType();
llvm_unreachable("not a memory reference type");
}
- if (itemAddr.getType().isa<fir::ReferenceType>() &&
- elementType.isa<fir::BaseBoxType>())
- return create<fir::LoadOp>(loc, fir::getBase(exv));
mlir::Type boxTy = fir::BoxType::get(elementType);
mlir::Value tdesc;
if (isPolymorphic) {
diff --git a/flang/test/Lower/polymorphic.f90 b/flang/test/Lower/polymorphic.f90
index dd023b9694ff1..6bb9f735f5d9a 100644
--- a/flang/test/Lower/polymorphic.f90
+++ b/flang/test/Lower/polymorphic.f90
@@ -1086,32 +1086,6 @@ subroutine test_parent_comp_opt(p)
! CHECK: %[[CONV:.*]] = fir.convert %[[RES]] : (!fir.box<!fir.type<_QMpolymorphic_testTp1{a:i32,b:i32}>>) -> !fir.class<!fir.type<_QMpolymorphic_testTp1{a:i32,b:i32}>>
! CHECK: fir.call @_QMpolymorphic_testPtakes_p1_opt(%[[CONV]]) {{.*}} : (!fir.class<!fir.type<_QMpolymorphic_testTp1{a:i32,b:i32}>>) -> ()
- subroutine class_with_entry(a)
- class(p1) :: a,b
- select type (a)
- type is(p2)
- print*, a%c
- class default
- print*, a%a
- end select
- return
- entry d(b)
- select type(b)
- type is(p2)
- print*,b%c
- class default
- print*,b%a
- end select
- end subroutine
-
-! CHECK-LABEL: func.func @_QMpolymorphic_testPclass_with_entry(
-! CHECK-SAME: %[[A:.*]]: !fir.class<!fir.type<_QMpolymorphic_testTp1{a:i32,b:i32}>> {fir.bindc_name = "a"}) {
-! CHECK: %[[B:.*]] = fir.alloca !fir.class<!fir.type<_QMpolymorphic_testTp1{a:i32,b:i32}>> {bindc_name = "b", uniq_name = "_QMpolymorphic_testFclass_with_entryEb"}
-
-! CHECK-LABEL: func.func @_QMpolymorphic_testPd(
-! CHECK-SAME: %[[B:.*]]: !fir.class<!fir.type<_QMpolymorphic_testTp1{a:i32,b:i32}>> {fir.bindc_name = "b"}) {
-! CHECK: %[[A:.*]] = fir.alloca !fir.class<!fir.type<_QMpolymorphic_testTp1{a:i32,b:i32}>> {bindc_name = "a", uniq_name = "_QMpolymorphic_testFclass_with_entryEa"}
-
end module
program test
More information about the flang-commits
mailing list