Skip to content

Commit 6c8878c

Browse files
committed
Do not force flag use-alloc-runtime for amdgpu.
1 parent 3d0093e commit 6c8878c

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

clang/lib/Driver/ToolChains/Flang.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -432,10 +432,6 @@ void Flang::AddAMDGPUTargetArgs(const ArgList &Args,
432432
Args.MakeArgString("--amdhsa-code-object-version=" + Val));
433433
}
434434

435-
// Force the use of runtime and descriptors for heap allocate/deallocate.
436-
CmdArgs.push_back(Args.MakeArgString("-mmlir"));
437-
CmdArgs.push_back(Args.MakeArgString("--use-alloc-runtime"));
438-
439435
const ToolChain &TC = getToolChain();
440436
TC.addClangTargetOptions(Args, CmdArgs, Action::OffloadKind::OFK_OpenMP);
441437
}
Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
1-
! RUN: %flang -target amdgcn-- -S -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK-AMDGPU
2-
! RUN: %flang -target x86_64-- -S -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK-x86_64
1+
! RUN: %flang -target amdgcn-- -mmlir -use-alloc-runtime -S -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK
2+
! RUN: %flang -target amdgcn-- -S -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK-NO-FLAG
3+
4+
! Test to check if usage of flag -use-alloc-runtime results in runtime calls.
35

46
subroutine allocate_deallocate()
57
real, allocatable :: x
68

79
allocate(x)
8-
! CHECK-AMDGPU: call i32 @_FortranAAllocatableAllocate
9-
! CHECK-x86_64: call ptr @malloc
10+
! CHECK: call i32 @_FortranAAllocatableAllocate
11+
! CHECK-NO-FLAG: call ptr @malloc
1012

1113
deallocate(x)
12-
! CHECK-AMDGPU: call i32 @_FortranAAllocatableDeallocate
13-
! CHECK-x86_64: call void @free
14+
! CHECK: call i32 @_FortranAAllocatableDeallocate
15+
! CHECK-NO-FLAG: call void @free
1416
end subroutine
1517

1618
subroutine allocate_deallocate_ptr()
1719
integer, pointer :: x
1820

1921
allocate(x)
20-
! CHECK-AMDGPU: call i32 @_FortranAPointerAllocate
21-
! CHECK-x86_64: call i32 @_FortranAPointerAllocate
22+
! CHECK: call i32 @_FortranAPointerAllocate
23+
! CHECK-NO-FLAG: call i32 @_FortranAPointerAllocate
2224

2325
deallocate(x)
24-
! CHECK-AMDGPU: call i32 @_FortranAPointerDeallocate
25-
! CHECK-x86_64: call i32 @_FortranAPointerDeallocate
26+
! CHECK: call i32 @_FortranAPointerDeallocate
27+
! CHECK-NO-FLAG: call i32 @_FortranAPointerDeallocate
2628
end subroutine

0 commit comments

Comments
 (0)