[PATCH] D69984: [OpenMP][Opt] Annotate known runtime functions and deduplicate more

Jon Chesterfield via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 8 02:01:11 PST 2019


JonChesterfield added a comment.

Some comments on the verbosity of the patch. Definitely like the effect - deduplicating calls where legal is a great result.



================
Comment at: llvm/include/llvm/IR/OpenMPKinds.def:221
                 AttributeSet(), {})
+__OMP_RTL_ATTRS(omp_get_num_threads,
+                AttributeSet(EnumAttr(ReadOnly), EnumAttr(NoUnwind),
----------------
The repeated expression
```AttributeSet(EnumAttr(ReadOnly), EnumAttr(NoUnwind),
                             EnumAttr(NoFree), EnumAttr(NoSync))```
is probably worth factoring out into a named variable.

Starting to approach the point where a tablegen style generator is worthwhile, but I don't think it's there yet



================
Comment at: llvm/lib/Transforms/IPO/OpenMPOpt.cpp:106
           *F, RFIs[OMPRTL___kmpc_global_thread_num], GTIdArg);
       Changed |= deduplicateRuntimeCalls(*F, RFIs[OMPRTL_omp_get_thread_num]);
     }
----------------
```for (auto op : {OMPRTL_omp_get_thread_num, OMPRTL_omp_get_num_threads,..}) {
Changed |= deduplicateRuntimeCalls(*F, RFIs[op]);
}``` ?


================
Comment at: llvm/test/Transforms/OpenMP/add_attributes.ll:1
+; RUN: opt < %s -S -openmpopt        | FileCheck %s
+; RUN: opt < %s -S -passes=openmpopt | FileCheck %s
----------------
Is there a standard in-tree way of deduplicating stuff like this? It could be a hash of function name to expected attribute, with a generator that writes the IR.

My last backend generated many thousands of lines of IR from much shorter python scripts. Maybe the in tree equivalent is tablegen?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69984





More information about the llvm-commits mailing list