diff --git a/flang/lib/Lower/Allocatable.cpp b/flang/lib/Lower/Allocatable.cpp --- a/flang/lib/Lower/Allocatable.cpp +++ b/flang/lib/Lower/Allocatable.cpp @@ -41,11 +41,15 @@ llvm::cl::desc("Lower allocations to fortran runtime calls"), llvm::cl::init(false)); /// Switch to force lowering of allocatable and pointers to descriptors in all -/// cases for debug purposes. +/// cases. This is now turned on by default since that is what will happen with +/// HLFIR lowering, so this allows getting early feedback of the impact. +/// If this turns out to cause performance regressions, a dedicated fir.box +/// "discretization pass" would make more sense to cover all the fir.box usage +/// (taking advantage of any future inlining for instance). static llvm::cl::opt useDescForMutableBox( "use-desc-for-alloc", llvm::cl::desc("Always use descriptors for POINTER and ALLOCATABLE"), - llvm::cl::init(false)); + llvm::cl::init(true)); //===----------------------------------------------------------------------===// // Error management diff --git a/flang/test/Lower/Intrinsics/c_loc.f90 b/flang/test/Lower/Intrinsics/c_loc.f90 --- a/flang/test/Lower/Intrinsics/c_loc.f90 +++ b/flang/test/Lower/Intrinsics/c_loc.f90 @@ -1,5 +1,5 @@ -! RUN: bbc -emit-fir %s -o - | FileCheck %s -! RUN: %flang_fc1 -emit-fir %s -o - | FileCheck %s +! RUN: bbc --use-desc-for-alloc=false --emit-fir %s -o - | FileCheck %s +! RUN: %flang_fc1 -mllvm --use-desc-for-alloc=false -emit-fir %s -o - | FileCheck %s ! Test intrinsic module procedure c_loc diff --git a/flang/test/Lower/Intrinsics/iall.f90 b/flang/test/Lower/Intrinsics/iall.f90 --- a/flang/test/Lower/Intrinsics/iall.f90 +++ b/flang/test/Lower/Intrinsics/iall.f90 @@ -1,4 +1,4 @@ -! RUN: bbc -emit-fir %s -o - | FileCheck %s +! RUN: bbc --use-desc-for-alloc=false -emit-fir %s -o - | FileCheck %s ! CHECK-LABEL: func @_QPiall_test_1( ! CHECK-SAME: %[[arg0:.*]]: !fir.box>{{.*}}) -> i8 { diff --git a/flang/test/Lower/Intrinsics/iany.f90 b/flang/test/Lower/Intrinsics/iany.f90 --- a/flang/test/Lower/Intrinsics/iany.f90 +++ b/flang/test/Lower/Intrinsics/iany.f90 @@ -1,4 +1,4 @@ -! RUN: bbc -emit-fir %s -o - | FileCheck %s +! RUN: bbc --use-desc-for-alloc=false -emit-fir %s -o - | FileCheck %s ! CHECK-LABEL: func @_QPiany_test_1( ! CHECK-SAME: %[[arg0:.*]]: !fir.box>{{.*}}) -> i8 { diff --git a/flang/test/Lower/Intrinsics/iparity.f90 b/flang/test/Lower/Intrinsics/iparity.f90 --- a/flang/test/Lower/Intrinsics/iparity.f90 +++ b/flang/test/Lower/Intrinsics/iparity.f90 @@ -1,4 +1,4 @@ -! RUN: bbc -emit-fir %s -o - | FileCheck %s +! RUN: bbc --use-desc-for-alloc=false -emit-fir %s -o - | FileCheck %s ! CHECK-LABEL: func @_QPiparity_test_1( ! CHECK-SAME: %[[arg0:.*]]: !fir.box>{{.*}}) -> i8 { diff --git a/flang/test/Lower/Intrinsics/len.f90 b/flang/test/Lower/Intrinsics/len.f90 --- a/flang/test/Lower/Intrinsics/len.f90 +++ b/flang/test/Lower/Intrinsics/len.f90 @@ -1,4 +1,4 @@ -! RUN: bbc -emit-fir %s -o - | FileCheck %s +! RUN: bbc --use-desc-for-alloc=false -emit-fir %s -o - | FileCheck %s ! CHECK-LABEL: len_test subroutine len_test(i, c) diff --git a/flang/test/Lower/Intrinsics/loc.f90 b/flang/test/Lower/Intrinsics/loc.f90 --- a/flang/test/Lower/Intrinsics/loc.f90 +++ b/flang/test/Lower/Intrinsics/loc.f90 @@ -1,5 +1,5 @@ -! RUN: bbc -emit-fir %s -o - | FileCheck %s -! RUN: %flang_fc1 -emit-fir %s -o - | FileCheck %s +! RUN: bbc --use-desc-for-alloc=false -emit-fir %s -o - | FileCheck %s +! RUN: %flang_fc1 -mllvm --use-desc-for-alloc=false -emit-fir %s -o - | FileCheck %s ! Test LOC intrinsic diff --git a/flang/test/Lower/Intrinsics/move_alloc.f90 b/flang/test/Lower/Intrinsics/move_alloc.f90 --- a/flang/test/Lower/Intrinsics/move_alloc.f90 +++ b/flang/test/Lower/Intrinsics/move_alloc.f90 @@ -1,5 +1,5 @@ - ! RUN: bbc -emit-fir %s -o - | FileCheck %s - ! RUN: flang-new -fc1 -emit-fir %s -o - | FileCheck %s + ! RUN: bbc --use-desc-for-alloc=false -emit-fir %s -o - | FileCheck %s + ! RUN: flang-new -fc1 -mllvm --use-desc-for-alloc=false -emit-fir %s -o - | FileCheck %s ! CHECK-LABEL: to_from_only subroutine to_from_only diff --git a/flang/test/Lower/Intrinsics/product.f90 b/flang/test/Lower/Intrinsics/product.f90 --- a/flang/test/Lower/Intrinsics/product.f90 +++ b/flang/test/Lower/Intrinsics/product.f90 @@ -1,4 +1,4 @@ -! RUN: bbc -emit-fir %s -o - | FileCheck %s +! RUN: bbc --use-desc-for-alloc=false -emit-fir %s -o - | FileCheck %s ! CHECK-LABEL: func @_QPproduct_test( ! CHECK-SAME: %[[arg0:.*]]: !fir.box>{{.*}}) -> i32 diff --git a/flang/test/Lower/Intrinsics/sum.f90 b/flang/test/Lower/Intrinsics/sum.f90 --- a/flang/test/Lower/Intrinsics/sum.f90 +++ b/flang/test/Lower/Intrinsics/sum.f90 @@ -1,4 +1,4 @@ -! RUN: bbc -emit-fir %s -o - | FileCheck %s +! RUN: bbc --use-desc-for-alloc=false -emit-fir %s -o - | FileCheck %s ! CHECK-LABEL: func @_QPsum_test( ! CHECK-SAME: %[[arg0:.*]]: !fir.box>{{.*}}) -> i32 { diff --git a/flang/test/Lower/Intrinsics/system_clock.f90 b/flang/test/Lower/Intrinsics/system_clock.f90 --- a/flang/test/Lower/Intrinsics/system_clock.f90 +++ b/flang/test/Lower/Intrinsics/system_clock.f90 @@ -1,4 +1,4 @@ -! RUN: bbc -emit-fir %s -o - | FileCheck %s +! RUN: bbc --use-desc-for-alloc=false -emit-fir %s -o - | FileCheck %s ! CHECK-LABEL: system_clock_test subroutine system_clock_test() diff --git a/flang/test/Lower/OpenACC/acc-data-operands.f90 b/flang/test/Lower/OpenACC/acc-data-operands.f90 --- a/flang/test/Lower/OpenACC/acc-data-operands.f90 +++ b/flang/test/Lower/OpenACC/acc-data-operands.f90 @@ -1,6 +1,6 @@ ! This test checks lowering of complex OpenACC data operands. -! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s +! RUN: bbc --use-desc-for-alloc=false -fopenacc -emit-fir %s -o - | FileCheck %s module acc_data_operand diff --git a/flang/test/Lower/OpenMP/atomic-read.f90 b/flang/test/Lower/OpenMP/atomic-read.f90 --- a/flang/test/Lower/OpenMP/atomic-read.f90 +++ b/flang/test/Lower/OpenMP/atomic-read.f90 @@ -1,4 +1,4 @@ -! RUN: bbc -fopenmp -emit-fir %s -o - | FileCheck %s +! RUN: bbc --use-desc-for-alloc=false -fopenmp -emit-fir %s -o - | FileCheck %s ! This test checks the lowering of atomic read diff --git a/flang/test/Lower/OpenMP/atomic-update.f90 b/flang/test/Lower/OpenMP/atomic-update.f90 --- a/flang/test/Lower/OpenMP/atomic-update.f90 +++ b/flang/test/Lower/OpenMP/atomic-update.f90 @@ -1,6 +1,6 @@ ! This test checks lowering of atomic and atomic update constructs -! RUN: bbc -fopenmp -emit-fir %s -o - | FileCheck %s -! RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | FileCheck %s +! RUN: bbc --use-desc-for-alloc=false -fopenmp -emit-fir %s -o - | FileCheck %s +! RUN: %flang_fc1 -mllvm --use-desc-for-alloc=false -emit-fir -fopenmp %s -o - | FileCheck %s program OmpAtomicUpdate use omp_lib diff --git a/flang/test/Lower/OpenMP/atomic-write.f90 b/flang/test/Lower/OpenMP/atomic-write.f90 --- a/flang/test/Lower/OpenMP/atomic-write.f90 +++ b/flang/test/Lower/OpenMP/atomic-write.f90 @@ -1,4 +1,4 @@ -! RUN: bbc -fopenmp -emit-fir %s -o - | FileCheck %s +! RUN: bbc --use-desc-for-alloc=false -fopenmp -emit-fir %s -o - | FileCheck %s ! This test checks the lowering of atomic write diff --git a/flang/test/Lower/OpenMP/parallel-private-clause.f90 b/flang/test/Lower/OpenMP/parallel-private-clause.f90 --- a/flang/test/Lower/OpenMP/parallel-private-clause.f90 +++ b/flang/test/Lower/OpenMP/parallel-private-clause.f90 @@ -2,7 +2,7 @@ ! `PRIVATE` clause present. ! REQUIRES: shell -! RUN: bbc -fopenmp -emit-fir %s -o - | \ +! RUN: bbc --use-desc-for-alloc=false -fopenmp -emit-fir %s -o - | \ ! RUN: FileCheck %s --check-prefix=FIRDialect !FIRDialect: func @_QPprivate_clause(%[[ARG1:.*]]: !fir.ref{{.*}}, %[[ARG2:.*]]: !fir.ref>{{.*}}, %[[ARG3:.*]]: !fir.boxchar<1>{{.*}}, %[[ARG4:.*]]: !fir.boxchar<1>{{.*}}) { diff --git a/flang/test/Lower/allocatable-assignment.f90 b/flang/test/Lower/allocatable-assignment.f90 --- a/flang/test/Lower/allocatable-assignment.f90 +++ b/flang/test/Lower/allocatable-assignment.f90 @@ -1,5 +1,5 @@ ! Test allocatable assignments -! RUN: bbc -emit-fir %s -o - | FileCheck %s +! RUN: bbc --use-desc-for-alloc=false -emit-fir %s -o - | FileCheck %s module alloc_assign type t diff --git a/flang/test/Lower/allocatable-polymorphic.f90 b/flang/test/Lower/allocatable-polymorphic.f90 --- a/flang/test/Lower/allocatable-polymorphic.f90 +++ b/flang/test/Lower/allocatable-polymorphic.f90 @@ -1,5 +1,5 @@ -! RUN: bbc -polymorphic-type -emit-fir %s -o - | FileCheck %s -! RUN: bbc -polymorphic-type -emit-fir %s -o - | tco | FileCheck %s --check-prefix=LLVM +! RUN: bbc --use-desc-for-alloc=false -polymorphic-type -emit-fir %s -o - | FileCheck %s +! RUN: bbc --use-desc-for-alloc=false -polymorphic-type -emit-fir %s -o - | tco | FileCheck %s --check-prefix=LLVM module poly type p1 diff --git a/flang/test/Lower/allocatables.f90 b/flang/test/Lower/allocatables.f90 --- a/flang/test/Lower/allocatables.f90 +++ b/flang/test/Lower/allocatables.f90 @@ -1,4 +1,4 @@ -! RUN: bbc -emit-fir %s -o - | FileCheck %s +! RUN: bbc --use-desc-for-alloc=false -emit-fir %s -o - | FileCheck %s ! Test lowering of allocatables using runtime for allocate/deallcoate statements. ! CHECK-LABEL: _QPfooscalar diff --git a/flang/test/Lower/allocate-mold.f90 b/flang/test/Lower/allocate-mold.f90 --- a/flang/test/Lower/allocate-mold.f90 +++ b/flang/test/Lower/allocate-mold.f90 @@ -1,4 +1,4 @@ -! RUN: bbc -emit-fir %s -o - | FileCheck %s +! RUN: bbc --use-desc-for-alloc=false -emit-fir %s -o - | FileCheck %s ! Test lowering of ALLOCATE statement with a MOLD argument for scalars diff --git a/flang/test/Lower/allocate-source-allocatables.f90 b/flang/test/Lower/allocate-source-allocatables.f90 --- a/flang/test/Lower/allocate-source-allocatables.f90 +++ b/flang/test/Lower/allocate-source-allocatables.f90 @@ -1,4 +1,4 @@ -! RUN: bbc -emit-fir %s -o - | FileCheck %s +! RUN: bbc --use-desc-for-alloc=false -emit-fir %s -o - | FileCheck %s ! Test lowering of allocatables for allocate statements with source. diff --git a/flang/test/Lower/allocate-source-pointers.f90 b/flang/test/Lower/allocate-source-pointers.f90 --- a/flang/test/Lower/allocate-source-pointers.f90 +++ b/flang/test/Lower/allocate-source-pointers.f90 @@ -1,4 +1,4 @@ -! RUN: bbc -emit-fir %s -o - | FileCheck %s +! RUN: bbc --use-desc-for-alloc=false -emit-fir %s -o - | FileCheck %s ! Test lowering of pointers for allocate statements with source. diff --git a/flang/test/Lower/array-constructor-2.f90 b/flang/test/Lower/array-constructor-2.f90 --- a/flang/test/Lower/array-constructor-2.f90 +++ b/flang/test/Lower/array-constructor-2.f90 @@ -1,4 +1,4 @@ -! RUN: bbc %s -o - | FileCheck %s +! RUN: bbc --use-desc-for-alloc=false %s -o - | FileCheck %s ! Constant array ctor. ! CHECK-LABEL: func @_QPtest1( diff --git a/flang/test/Lower/character-assignment.f90 b/flang/test/Lower/character-assignment.f90 --- a/flang/test/Lower/character-assignment.f90 +++ b/flang/test/Lower/character-assignment.f90 @@ -1,4 +1,4 @@ -! RUN: bbc %s -o - -emit-fir | FileCheck %s +! RUN: bbc --use-desc-for-alloc=false %s -o - -emit-fir | FileCheck %s ! Simple character assignment tests ! CHECK-LABEL: _QPassign1 diff --git a/flang/test/Lower/derived-type-finalization.f90 b/flang/test/Lower/derived-type-finalization.f90 --- a/flang/test/Lower/derived-type-finalization.f90 +++ b/flang/test/Lower/derived-type-finalization.f90 @@ -1,5 +1,5 @@ ! Test derived type finalization -! RUN: bbc -polymorphic-type -emit-fir %s -o - | FileCheck %s +! RUN: bbc --use-desc-for-alloc=false -polymorphic-type -emit-fir %s -o - | FileCheck %s ! Missing tests: ! - finalization within BLOCK construct diff --git a/flang/test/Lower/do_loop.f90 b/flang/test/Lower/do_loop.f90 --- a/flang/test/Lower/do_loop.f90 +++ b/flang/test/Lower/do_loop.f90 @@ -1,5 +1,5 @@ -! RUN: bbc -emit-fir -o - %s | FileCheck %s -! RUN: %flang_fc1 -emit-fir -o - %s | FileCheck %s +! RUN: bbc --use-desc-for-alloc=false -emit-fir -o - %s | FileCheck %s +! RUN: %flang_fc1 -mllvm --use-desc-for-alloc=false -emit-fir -o - %s | FileCheck %s ! Simple tests for structured ordered loops with loop-control. ! Tests the structure of the loop, storage to index variable and return and diff --git a/flang/test/Lower/forall/array-pointer.f90 b/flang/test/Lower/forall/array-pointer.f90 --- a/flang/test/Lower/forall/array-pointer.f90 +++ b/flang/test/Lower/forall/array-pointer.f90 @@ -6,7 +6,7 @@ ! is a pointer to an array of T and never an array of pointer to T in ! Fortran. -! RUN: bbc -emit-fir %s -o - | FileCheck %s +! RUN: bbc --use-desc-for-alloc=false -emit-fir %s -o - | FileCheck %s module array_of_pointer_test type t diff --git a/flang/test/Lower/forall/forall-allocatable.f90 b/flang/test/Lower/forall/forall-allocatable.f90 --- a/flang/test/Lower/forall/forall-allocatable.f90 +++ b/flang/test/Lower/forall/forall-allocatable.f90 @@ -1,6 +1,6 @@ ! Test forall lowering -! RUN: bbc -emit-fir %s -o - | FileCheck %s +! RUN: bbc --use-desc-for-alloc=false -emit-fir %s -o - | FileCheck %s subroutine forall_with_allocatable(a1) real :: a1(:) diff --git a/flang/test/Lower/intentout-deallocate.f90 b/flang/test/Lower/intentout-deallocate.f90 --- a/flang/test/Lower/intentout-deallocate.f90 +++ b/flang/test/Lower/intentout-deallocate.f90 @@ -1,5 +1,5 @@ ! Test correct deallocation of intent(out) allocatables. -! RUN: bbc -emit-fir -polymorphic-type %s -o - | FileCheck %s +! RUN: bbc --use-desc-for-alloc=false -emit-fir -polymorphic-type %s -o - | FileCheck %s module mod1 type, bind(c) :: t1 diff --git a/flang/test/Lower/io-implied-do-fixes.f90 b/flang/test/Lower/io-implied-do-fixes.f90 --- a/flang/test/Lower/io-implied-do-fixes.f90 +++ b/flang/test/Lower/io-implied-do-fixes.f90 @@ -1,4 +1,4 @@ -! RUN: bbc -emit-fir %s -o - | FileCheck %s +! RUN: bbc --use-desc-for-alloc=false -emit-fir %s -o - | FileCheck %s ! UNSUPPORTED: system-windows ! CHECK-LABEL: func @_QPido1 diff --git a/flang/test/Lower/parent-component.f90 b/flang/test/Lower/parent-component.f90 --- a/flang/test/Lower/parent-component.f90 +++ b/flang/test/Lower/parent-component.f90 @@ -1,7 +1,7 @@ ! Test different ways of passing the parent component of an extended ! derived-type to a subroutine or the runtime. -! RUN: bbc -emit-fir %s -o - | FileCheck %s +! RUN: bbc --use-desc-for-alloc=false -emit-fir %s -o - | FileCheck %s program parent_comp type p diff --git a/flang/test/Lower/pointer-assignments.f90 b/flang/test/Lower/pointer-assignments.f90 --- a/flang/test/Lower/pointer-assignments.f90 +++ b/flang/test/Lower/pointer-assignments.f90 @@ -1,5 +1,5 @@ ! Test lowering of pointer assignments -! RUN: bbc -emit-fir %s -o - | FileCheck %s +! RUN: bbc --use-desc-for-alloc=false -emit-fir %s -o - | FileCheck %s ! Note that p => NULL() are tested in pointer-disassociate.f90 diff --git a/flang/test/Lower/polymorphic.f90 b/flang/test/Lower/polymorphic.f90 --- a/flang/test/Lower/polymorphic.f90 +++ b/flang/test/Lower/polymorphic.f90 @@ -1,4 +1,4 @@ -! RUN: bbc -polymorphic-type -emit-fir %s -o - | FileCheck %s +! RUN: bbc --use-desc-for-alloc=false -polymorphic-type -emit-fir %s -o - | FileCheck %s ! Tests various aspect of the lowering of polymorphic entities.