Changes

Summary

  1. [flang][OpenMP] Add semantic checks for occurrence of nested Barrier regions (details)
  2. [lld-macho] Handle non-extern symbols marked as private extern (details)
  3. [lld-macho] Have path-related functions return std::string, not StringRef (details)
  4. [NFC][compiler-rt][hwasan] Move hwasanThreadList().CreateCurrentThread() into InitThreads (details)
  5. [Clang][Codegen] Add GNU function attribute 'no_profile' and lower it to noprofile (details)
  6. [GCOVProfiling] don't profile Fn's w/ noprofile attribute (details)
  7. [mlir] Add support to SourceMgrDiagnosticHandler for filtering FileLineColLocs (details)
  8. [CSSPGO][llvm-profgen] Fix an issue in findDisjointRanges (details)
  9. [LoopUnroll] Simplify optimization remarks (details)
Commit 8fdd475c85634c4a5e5cd83d7dc15ff56c458813 by arnamoy.bhattacharyya
[flang][OpenMP] Add semantic checks for occurrence of nested Barrier regions

This patch adds the following nesting check for `barrier` constructs:

```
A barrier region may not be closely nested inside a worksharing, loop, task, taskloop, critical, ordered, atomic, or master region.
```

Also adds a test case for the check,

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D99888
The file was addedflang/test/Semantics/omp-nested-barrier.f90
The file was modifiedflang/lib/Semantics/check-omp-structure.cpp
The file was modifiedflang/lib/Semantics/check-omp-structure.h
Commit 4c49f9ceafd6bdc261e0ee157a2ea0fa943d6921 by jezng
[lld-macho] Handle non-extern symbols marked as private extern

Previously, we asserted that such a case was invalid, but in fact
`ld -r` can emit such symbols if the input contained a (true) private
extern, or if it contained a symbol started with "L".

Non-extern symbols marked as private extern are essentially equivalent
to regular TU-scoped symbols, so no new functionality is needed.

Reviewed By: #lld-macho, thakis

Differential Revision: https://reviews.llvm.org/D104502
The file was addedlld/test/MachO/local-private-extern.yaml
The file was modifiedlld/MachO/InputFiles.cpp
Commit 1d31fb8d122b1117cf20a9edc09812db8472e930 by jezng
[lld-macho] Have path-related functions return std::string, not StringRef

findLibrary() returned a StringRef while findFramework & other helper
functions returned std::strings. Standardize on std::string.

(I initially tried making the helper functions all return StringRefs,
but I realized we shouldn't return input StringRefs since their
lifetimes would not be obvious from the calling code.)
The file was modifiedlld/MachO/DriverUtils.cpp
The file was modifiedlld/MachO/Driver.h
The file was modifiedlld/MachO/Driver.cpp
Commit f7999e73caeff482a324ab0f9ac2fbeb99f8e3ec by leonardchan
[NFC][compiler-rt][hwasan] Move hwasanThreadList().CreateCurrentThread() into InitThreads

Once D104553 lands, CreateCurrentThread will be able to accept optional
parameters for initializing the hwasan thread object. On fuchsia, we can get
stack info in the platform-specific InitThreads and pass it through
CreateCurrentThread. On linux, this is a no-op.

Differential Revision: https://reviews.llvm.org/D104561
The file was modifiedcompiler-rt/lib/hwasan/hwasan.cpp
The file was modifiedcompiler-rt/lib/hwasan/hwasan_linux.cpp
Commit 193e41c987127aad86d0380df83e67a85266f1f1 by ndesaulniers
[Clang][Codegen] Add GNU function attribute 'no_profile' and lower it to noprofile

noprofile IR attribute already exists to prevent profiling with PGO;
emit that when a function uses the newly added no_profile function
attribute.

The Linux kernel would like to avoid compiler generated code in
functions annotated with such attribute. We already respect this for
libcalls to fentry() and mcount().

Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80223
Link: https://lore.kernel.org/lkml/CAKwvOdmPTi93n2L0_yQkrzLdmpxzrOR7zggSzonyaw2PGshApw@mail.gmail.com/

Reviewed By: MaskRay, void, phosek, aaron.ballman

Differential Revision: https://reviews.llvm.org/D104475
The file was modifiedclang/include/clang/Basic/AttrDocs.td
The file was addedclang/test/Sema/no_profile-attribute.c
The file was modifiedclang/include/clang/Basic/Attr.td
The file was modifiedclang/lib/CodeGen/CodeGenFunction.cpp
The file was addedclang/test/CodeGen/no_profile.c
The file was modifiedclang/test/Misc/pragma-attribute-supported-attributes-list.test
Commit bef299286104c2b6383a43b9d1eb0e47838cb5b6 by ndesaulniers
[GCOVProfiling] don't profile Fn's w/ noprofile attribute

Similar to D104475, the Linux kernel would like to avoid compiler
generated code in certain functions. The no_profile function
attribute can be used in C to generate the the noprofile fn attr in IR.
Respect that from GCOVProfiling.

Link: https://lore.kernel.org/lkml/CAKwvOdmPTi93n2L0_yQkrzLdmpxzrOR7zggSzonyaw2PGshApw@mail.gmail.com/

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D104257
The file was modifiedllvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
The file was addedllvm/test/Transforms/GCOVProfiling/noprofile.ll
Commit d1baf2895467735ab14f4b3415fce204c0cc8e7f by riddleriver
[mlir] Add support to SourceMgrDiagnosticHandler for filtering FileLineColLocs

This revision adds support for passing a functor to SourceMgrDiagnosticHandler for filtering out FileLineColLocs when emitting a diagnostic. More specifically, this can be useful in situations where there may be large CallSiteLocs with locations that aren't necessarily important/useful for users.

For now the filtering support is limited to FileLineColLocs, but conceptually we could allow filtering for all locations types if a need arises in the future.

Differential Revision: https://reviews.llvm.org/D103649
The file was addedmlir/test/lib/IR/TestDiagnostics.cpp
The file was addedmlir/test/IR/diagnostic-handler-filter.mlir
The file was modifiedmlir/docs/Diagnostics.md
The file was modifiedmlir/tools/mlir-opt/mlir-opt.cpp
The file was modifiedmlir/lib/IR/Diagnostics.cpp
The file was modifiedmlir/test/lib/IR/CMakeLists.txt
The file was modifiedmlir/include/mlir/IR/Diagnostics.h
Commit fb19aa0c74fdb864ddbd677a7b3585661966a098 by hoy
[CSSPGO][llvm-profgen] Fix an issue in findDisjointRanges

We were using 0 as an indicator of invalid offset when computing disjoint ranges. In reality, 0 can be an valid code offset which stands for the first function in .text section. I'm using UINT64_MAX as an invalid code offset instead.

Reviewed By: wenlei

Differential Revision: https://reviews.llvm.org/D104497
The file was modifiedllvm/tools/llvm-profgen/ProfileGenerator.cpp
Commit 3308205ae9dd3b42e19b377157c642a04312f7fd by nikita.ppv
[LoopUnroll] Simplify optimization remarks

Remove dependence on ULO.TripCount/ULO.TripMultiple from ORE and
debug code. For debug code, print information about all exits.
For optimization remarks, only include the unroll count and the
type of unroll (complete, partial or runtime), but omit detailed
information about exit folding, now that more than one exit may
be folded.

Differential Revision: https://reviews.llvm.org/D104482
The file was modifiedllvm/lib/Transforms/Utils/LoopUnroll.cpp
The file was modifiedllvm/test/Transforms/LoopUnroll/loop-remarks-with-hotness.ll
The file was modifiedllvm/test/CodeGen/AArch64/loop-micro-op-buffer-size-t99.ll