brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · c1f49d2 Raw
40 lines · plain
1! RUN: %flang_fc1 -emit-llvm -debug-info-kind=standalone %s -o - | FileCheck  %s2 3! Simple test that checks that metadata for `t0` is only duplicated once.4 5! The difficulty is that at the mlir::LLVM::DITypeAttr, because of the6! lack of MLIR attribute true recursion, the mlir::LLVM::DITypeAttr for7! `t0` inside `t1` is special because it is only valid when found8! in an mlir::LLVM::DITypeAttr tree under `base` (it will point to `base`9! via an integer id that is only meanigfu;l when a node with such id has10! been traversed).11! A different node has to be created for `t0` usage in `x0` (will12! point to the actual mlir::LLVM::DITypeAttr for `base` instead of13! an integer id since the cycle is already "taken care of" in `base`14! definition).15! However, the same special `t0` node can be used for both `x1_1` and16! `x1_2` components because they are both under `base` in the17! mlir::LLVM::DITypeAttr tree definition. This used to not be the case,18! leading to a lot of duplicate mlir::LLVM::DITypeAttr and actual LLVM IR19! metadata, causing noticeable compilation slowdowns in apps with non trivial20! derived types.21 22subroutine duplicate_cycle_branch()23  type t024    type(base), pointer :: x25  end type26  type t127    type(t0) :: x1_128    type(t0) :: x1_229  end type30  type base31    type(t1) :: x_base32  end type33  type(base) :: x34  type(t0) :: x035  call bar(x, x0)36end subroutine37! CHECK: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "t0",38! CHECK: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "t0",39! CHECK-NOT: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "t0",40