[PATCH] D80996: [AMDGPU][OpenMP] Fix duplicate copies of arguments in commands

Pushpinder Singh via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 2 07:08:51 PDT 2020


pdhaliwal updated this revision to Diff 267870.
pdhaliwal added a comment.

Added lit test case


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80996/new/

https://reviews.llvm.org/D80996

Files:
  clang/lib/Driver/ToolChains/HIP.cpp
  clang/test/Driver/hip-openmp-arguments.c


Index: clang/test/Driver/hip-openmp-arguments.c
===================================================================
--- /dev/null
+++ clang/test/Driver/hip-openmp-arguments.c
@@ -0,0 +1,13 @@
+// REQUIRES: clang-driver
+// REQUIRES: x86-registered-target
+// REQUIRES: amdgpu-registered-target
+
+// RUN: %clang -### -target x86_64-pc-linux-gnu -fopenmp \
+// RUN:   -fopenmp-targets=amdgcn-amd-amdhsa -nogpulib \
+// RUN:   -mllvm -amdgpu-dump-hsa-metadata \
+// RUN:   %s 2>&1 | FileCheck %s
+
+// CHECK: [[CLANG:".*clang.*"]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
+// CHECK-SAME: "-aux-triple" "x86_64-pc-linux-gnu" "-emit-obj"
+// CHECK-SAME: {{.*}} "-fopenmp"
+// CHECK-SAME: {{.*}} "-mllvm" "-amdgpu-dump-hsa-metadata" "-fopenmp-is-device" {{.*}}
Index: clang/lib/Driver/ToolChains/HIP.cpp
===================================================================
--- clang/lib/Driver/ToolChains/HIP.cpp
+++ clang/lib/Driver/ToolChains/HIP.cpp
@@ -386,8 +386,10 @@
 
   const OptTable &Opts = getDriver().getOpts();
 
-  for (Arg *A : Args) {
-    DAL->append(A);
+  if (DeviceOffloadKind != Action::OFK_OpenMP) {
+    for (Arg *A : Args) {
+      DAL->append(A);
+    }
   }
 
   if (!BoundArch.empty()) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80996.267870.patch
Type: text/x-patch
Size: 1206 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200602/cc2cfb92/attachment-0001.bin>


More information about the cfe-commits mailing list