Skip to content

Commit 176ae91

Browse files
committed
Process the body of the TARGET DATA construct
1 parent dc3d1a8 commit 176ae91

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

flang/test/Lower/ignore-target-data.f90

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
1-
!RUN: %flang_fc1 -emit-llvm -fopenmp %s -o - | FileCheck %s
1+
!RUN: %flang_fc1 -emit-llvm -fopenmp %s -o - | FileCheck %s --check-prefix=NORT
2+
!RUN: %flang_fc1 -emit-llvm -fopenmp %s -o - | FileCheck %s --check-prefix=LLVM
23

34
!Make sure that there are no calls to the mapper.
5+
!NORT-NOT: call{{.*}}__tgt_target_data_begin_mapper
6+
!NORT-NOT: call{{.*}}__tgt_target_data_end_mapper
7+
8+
!Make sure we generate the body
9+
!LLVM: define internal void @_QFPf(ptr %[[A0:[0-9]+]], ptr %[[A1:[0-9]+]]) {
10+
!LLVM: %[[V0:[0-9]+]] = load i32, ptr %[[A0]], align 4
11+
!LLVM: %[[V1:[0-9]+]] = load i32, ptr %[[A1]], align 4
12+
!LLVM: %[[V2:[0-9]+]] = add i32 %[[V0]], %[[V1]]
13+
!LLVM: store i32 %[[V2]], ptr %[[A0]], align 4
14+
!LLVM: ret void
15+
!LLVM: }
416

5-
!CHECK-NOT: call{{.*}}__tgt_target_data_begin_mapper
6-
!CHECK-NOT: call{{.*}}__tgt_target_data_end_mapper
717

818
program test
919

mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4476,8 +4476,10 @@ convertOmpTargetData(Operation *op, llvm::IRBuilderBase &builder,
44764476

44774477
if (failed(result))
44784478
return failure();
4479-
if (!isOffloadEntry)
4480-
return success();
4479+
if (!isOffloadEntry) {
4480+
// Pretend we have IF(false) if we're not doing offload.
4481+
ifCond = builder.getFalse();
4482+
}
44814483

44824484
using InsertPointTy = llvm::OpenMPIRBuilder::InsertPointTy;
44834485
MapInfoData mapData;

0 commit comments

Comments
 (0)