[PATCH] D56286: [OPENMP] Deal with additional store inserted by Clang under -fno-PIC for PowerPC.

Stefan Pintilie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 3 12:10:37 PST 2019


stefanp created this revision.
stefanp added reviewers: ABataev, Hahnfeld, RaviNarayanaswamy, mikerice, kkwli0, hfinkel, gtbercea.
stefanp added a project: OpenMP.
Herald added subscribers: jsji, guansong, nemanjai.

Changing the default from -fPIC to -fno-PIC on PowerPC exposed an issue in OpenMP for PowerPC.
The issue is reported here:
https://bugs.llvm.org/show_bug.cgi?id=40082

This is a fix for that issue.
Also removed the XFAIL from the two tests that were failing under -fno-PIC.


https://reviews.llvm.org/D56286

Files:
  openmp/runtime/test/ompt/callback.h
  openmp/runtime/test/ompt/misc/control_tool.c
  openmp/runtime/test/ompt/synchronization/taskwait.c


Index: openmp/runtime/test/ompt/synchronization/taskwait.c
===================================================================
--- openmp/runtime/test/ompt/synchronization/taskwait.c
+++ openmp/runtime/test/ompt/synchronization/taskwait.c
@@ -1,7 +1,6 @@
 // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s
 // REQUIRES: ompt
 // UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7
-// XFAIL: powerpc64le, ppc64le
 #include "callback.h"
 #include <omp.h>
 
Index: openmp/runtime/test/ompt/misc/control_tool.c
===================================================================
--- openmp/runtime/test/ompt/misc/control_tool.c
+++ openmp/runtime/test/ompt/misc/control_tool.c
@@ -1,7 +1,6 @@
 // RUN: %libomp-compile-and-run | FileCheck %s
 // REQUIRES: ompt
 // UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7
-// XFAIL: powerpc64le, ppc64le
 #define TEST_NEED_PRINT_FRAME_FROM_OUTLINED_FN
 #include "callback.h"
 #include <omp.h>
Index: openmp/runtime/test/ompt/callback.h
===================================================================
--- openmp/runtime/test/ompt/callback.h
+++ openmp/runtime/test/ompt/callback.h
@@ -151,11 +151,12 @@
          ompt_get_thread_data()->value, ((char *)addr) - 1, ((char *)addr) - 4)
 #elif KMP_ARCH_PPC64
 // On Power the NOP instruction is 4 bytes long. In addition, the compiler
-// inserts an LD instruction which accounts for another 4 bytes. In contrast to
-// X86 this instruction is always there, even for void runtime functions.
+// inserts a second NOP instruction (another 4 bytes). For non-void runtime
+// functions Clang inserts a STW instruction (but only if compiling under
+// -fno-PIC which will be the default with Clang 8.0, another 4 bytes).
 #define print_possible_return_addresses(addr) \
-  printf("%" PRIu64 ": current_address=%p\n", ompt_get_thread_data()->value, \
-         ((char *)addr) - 8)
+  printf("%" PRIu64 ": current_address=%p or %p\n", ompt_get_thread_data()->value, \
+         ((char *)addr) - 8, ((char *)addr) - 12)
 #elif KMP_ARCH_AARCH64
 // On AArch64 the NOP instruction is 4 bytes long, can be followed by inserted
 // store instruction (another 4 bytes long).


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56286.180119.patch
Type: text/x-patch
Size: 2142 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190103/f55cb6ef/attachment.bin>


More information about the llvm-commits mailing list