[PATCH] D125406: [OpenMP] Fix mangling for linear parameters with negative stride

Mike Rice via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 11 14:03:10 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG772b0c44a429: [OpenMP] Fix mangling for linear parameters with negative stride (authored by mikerice).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125406

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/test/OpenMP/declare_simd_codegen.cpp


Index: clang/test/OpenMP/declare_simd_codegen.cpp
===================================================================
--- clang/test/OpenMP/declare_simd_codegen.cpp
+++ clang/test/OpenMP/declare_simd_codegen.cpp
@@ -155,6 +155,14 @@
   return a + int(b);
 }
 
+// Test negative strides
+#pragma omp declare simd simdlen(4) linear(a:-2) linear(b:-8) \
+                                    linear(uval(c):-4) linear(ref(d):-16) \
+                                    linear(e:-1) linear(f:-1) linear(g:0)
+double Six(int a, float *b, int &c, int *&d, char e, char *f, short g) {
+ return a + int(*b) + c + *d + e + *f + g;
+}
+
 // CHECK-DAG: define {{.+}}@_Z5add_1Pf(
 // CHECK-DAG: define {{.+}}@_Z1hIiEvPT_S1_S1_S1_(
 // CHECK-DAG: define {{.+}}@_Z1hIfEvPT_S1_S1_S1_(
@@ -178,6 +186,7 @@
 // CHECK-DAG: define {{.+}}@_Z5ThreeRiS_
 // CHECK-DAG: define {{.+}}@_Z4FourRiS_
 // CHECK-DAG: define {{.+}}@_Z4FiveiRsS_S_S_S_S_S_S_
+// CHECK-DAG: define {{.+}}@_Z3SixiPfRiRPicPcs
 
 // CHECK-DAG: "_ZGVbM4l32__Z5add_1Pf"
 // CHECK-DAG: "_ZGVbN4l32__Z5add_1Pf"
@@ -399,6 +408,8 @@
 // CHECK-DAG: "_ZGVbN4R8R4__Z4FourRiS_"
 // CHECK-DAG: "_ZGVbM4uL2Ls0L4Ls0U8Us0R32Rs0__Z4FiveiRsS_S_S_S_S_S_S_"
 // CHECK-DAG: "_ZGVbN4uL2Ls0L4Ls0U8Us0R32Rs0__Z4FiveiRsS_S_S_S_S_S_S_"
+// CHECK-DAG: "_ZGVbM4ln2ln32Un4Rn128ln1ln1l0__Z3SixiPfRiRPicPcs"
+// CHECK-DAG: "_ZGVbN4ln2ln32Un4Rn128ln1ln1l0__Z3SixiPfRiRPicPcs"
 
 // CHECK-NOT: "_ZGV{{.+}}__Z1fRA_i
 
Index: clang/lib/CodeGen/CGOpenMPRuntime.cpp
===================================================================
--- clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -11506,7 +11506,9 @@
              ParamAttr.Kind == LinearUVal || ParamAttr.Kind == LinearVal) {
       // Don't print the step value if it is not present or if it is
       // equal to 1.
-      if (ParamAttr.StrideOrArg != 1)
+      if (ParamAttr.StrideOrArg < 0)
+        Out << 'n' << -ParamAttr.StrideOrArg;
+      else if (ParamAttr.StrideOrArg != 1)
         Out << ParamAttr.StrideOrArg;
     }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125406.428773.patch
Type: text/x-patch
Size: 2039 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220511/05be1b1b/attachment.bin>


More information about the cfe-commits mailing list