[Openmp-commits] [PATCH] D101973: [OpenMP][NFC] Remove SIMD check lines for non-simd tests

Johannes Doerfert via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed May 19 22:23:20 PDT 2021


jdoerfert added a comment.

In D101973#2770283 <https://reviews.llvm.org/D101973#2770283>, @JonChesterfield wrote:

> I can't see a change to a script in this diff. Should there be one? Looks like the test change was done programmatically

It was, but I did not expect to need the script in the future.

If you really want to see how bad my python skills are, here you go ;)

  import os,re
  
  path = "clang/test/OpenMP/"
  for f in os.listdir(path):
      if not os.path.isfile(path+f):
          continue
      fd = open(path + f, "r")
      content = fd.read()
      fd.close()
  
      if "_cc_test_check" not in content:
          continue
      if " simd" in content or " SIMD" in content:
          continue
      if "-fopenmp-simd" not in content:
          continue
  
      changed = False
      lines = content.splitlines()
      newlines = []
      matches = ['// CHECK:', '// CHECK-', '//CHECK:', '//CHECK-']
      empty = 0
      for i in range(len(lines)):
          line = lines[i]
          match = False
          for m in matches:
              if m in line:
                  match = True
                  break
          if match:
              continue
          if line == "//":
              empty += 1
              if empty > 2:
                  continue
          else:
              empty = 0
          if "-fopenmp-simd" not in line:
              newlines.append(line)
              continue
          if "FileCheck" not in line:
              newlines.append(line)
              continue
          m = re.search(r"=((SIMD|CHECK)[^\s]*)", line)
          if not m:
              newlines.append(line)
              continue
          print(m.group(1))
          matches.append(m.group(1))
  
          idx = line.index("FileCheck")
          line = line[:idx]
          line += 'FileCheck %s --implicit-check-not="{{__kmpc|__tgt}}"'
          newlines.append(line)
          changed = True
  
      if changed:
          fd = open(path + f, "w")
          fd.write('\n'.join(newlines))
          fd.close()


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101973



More information about the Openmp-commits mailing list