Changes

Summary

  1. [clang-tidy] Make header-guard check a little looser on comment whitespace (details)
  2. [analyzer] Canonicalize SymIntExpr so the RHS is positive when possible (details)
  3. Fix "the the" typo in documentation and user facing strings (details)
  4. [Driver] Remove -fno-concept-satisfaction-caching (details)
  5. [OpenMP] libomp: cleanup dead code (details)
  6. [OpenMP] libomp: cleanup - remove duplicate check (details)
  7. [clang] Fix Clang release notes (details)
  8. Silence a false positive about an unevaluated expr w/side effects (details)
  9. [AArch64][GlobalISel] Add undef combines to postlegalizer combiner. (details)
  10. [OpenMP] libomp: Add itt notifications to sync dependent tasks. (details)
  11. [RISCV] Add integer min/max intrinsic tests. NFC (details)
  12. [DAGCombiner] Fold (max/min X, X) -> X. (details)
  13. [DAGCombiner] Fold (sext/zext undef) -> 0 and aext(undef) -> undef. (details)
  14. [flang] Fix triple in a couple of driver tests (details)
  15. [SelectionDAG] Constant fold (sext_inreg undef, VT) to 0 instead of undef. (details)
  16. [InstCombine] add scalable vector test for logical select; NFC (details)
  17. [InstCombine] fix typo in test name; NFC (details)
  18. [clangd] Fix inlayhints crash, don't assume functions have FunctionTypeLocs (details)
  19. [mlir][nvvm] Fix support for tf32 data type in mma.sync (details)
  20. [BOLT][CMAKE] Check build target architecture for runtime libs (details)
  21. [AMDGPU] Split FeatureAtomicFaddInsts (details)
  22. No longer accept scoped enumerations in C (details)
  23. [flang][driver] Add missing parentheses in an assert (details)
  24. [x86][scheduler] Add MIR test for 41914 (details)
  25. [libc++] Avoid a Microsoft SAL macro. (details)
  26. Revert "[InstCombine] Remove side effect of replaced constrained intrinsics" (details)
  27. [X86SchedSandyBridge] update cost of COPY to 1 cycle from 0 (details)
  28. DWARFVerifier: Verify CU/TU index overlap issues (details)
  29. [VPlan] Remove dead code to create VPWidenPHIRecipes (NFCI). (details)
  30. Fix debugserver translation check (details)
  31. Pedantically warn about // comments in gnu89 mode (details)
  32. [BOLT] Report per-section hotness in bolt-heatmap. (details)
  33. [clang][ASTImporter][NFC]: Move clang::ImportError into own header. (details)
  34. [X86] Add some test coverage for Issue #55271 (details)
Commit 7cf97d62f40990c2f86f75eb5a1d9cf2bd9de71e by sam.mccall
[clang-tidy] Make header-guard check a little looser on comment whitespace

Currently it rejects "//  FOO_BAR_H" as an endif comment due to the extra space.
A user complained that this is too picky, which seems fair enough.

Differential Revision: https://reviews.llvm.org/D124955
The file was modifiedclang-tools-extra/unittests/clang-tidy/LLVMModuleTest.cpp
The file was modifiedclang-tools-extra/clang-tidy/utils/HeaderGuard.cpp
Commit f0d6cb4a5cf5723d7ddab2c7dab74f2f62116a6d by balazs.benics
[analyzer] Canonicalize SymIntExpr so the RHS is positive when possible

This PR changes the `SymIntExpr` so the expression that uses a
negative value as `RHS`, for example: `x +/- (-N)`, is modeled as
`x -/+ N` instead.

This avoids producing a very large `RHS` when the symbol is cased to
an unsigned number, and as consequence makes the value more robust in
presence of casts.

Note that this change is not applied if `N` is the lowest negative
value for which negation would not be representable.

Reviewed By: steakhal

Patch By: tomasz-kaminski-sonarsource!

Differential Revision: https://reviews.llvm.org/D124658
The file was modifiedclang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
The file was modifiedclang/test/Analysis/expr-inspection.c
The file was addedclang/test/Analysis/additive-op-on-sym-int-expr.c
Commit 87a55137e2a2a6684a20223494ad46d2fa33aca8 by koraq
Fix "the the" typo in documentation and user facing strings

There are many more instances of this pattern, but I chose to limit this change to .rst files (docs), anything in libcxx/include, and string literals. These have the highest chance of being seen by end users.

Reviewed By: #libc, Mordante, martong, ldionne

Differential Revision: https://reviews.llvm.org/D124708
The file was modifiedllvm/docs/CodingStandards.rst
The file was modifiedllvm/include/llvm/Analysis/Loads.h
The file was modifiedllvm/docs/CommandGuide/llvm-profdata.rst
The file was modifiedlibcxx/src/filesystem/operations.cpp
The file was modifiedllvm/include/llvm/ExecutionEngine/Orc/Core.h
The file was modifiedllvm/tools/llvm-profdata/llvm-profdata.cpp
The file was modifiedclang/test/Analysis/cert/env34-c.c
The file was modifiedllvm/docs/BugLifeCycle.rst
The file was modifiedclang/docs/analyzer/checkers.rst
The file was modifiedllvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
The file was modifiedllvm/docs/AMDGPUUsage.rst
The file was modifiedclang/docs/UndefinedBehaviorSanitizer.rst
The file was modifiedclang/lib/StaticAnalyzer/Checkers/cert/InvalidPtrChecker.cpp
The file was modifiedclang/docs/LanguageExtensions.rst
The file was modifiedlibcxx/include/__iterator/advance.h
The file was modifiedclang/docs/MatrixTypes.rst
Commit e13c28ec595d99e694cb7e2589e7574dcda628ef by ibiryukov
[Driver] Remove -fno-concept-satisfaction-caching

The flag was added when the C++20 draft did not allow for concept
caching. The final C++20 standard permits the caching, so flag is
redundant. See http://wg21.link/p2104r0.

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D125014
The file was modifiedclang/docs/ReleaseNotes.rst
The file was modifiedclang/test/SemaTemplate/cxx2a-constraint-caching.cpp
The file was modifiedclang/include/clang/Basic/LangOptions.def
The file was modifiedclang/lib/Sema/SemaConcept.cpp
The file was modifiedclang/include/clang/Driver/Options.td
Commit eed0d8515295d83ba6bd608096df820ce329426e by jonathan.l.peyton
[OpenMP] libomp: cleanup dead code

Differential Revision: https://reviews.llvm.org/D123047
The file was modifiedopenmp/runtime/src/kmp.h
Commit 4a64bed2160c6031d2c7c3321d4f88734c00f9bb by jonathan.l.peyton
[OpenMP] libomp: cleanup - remove duplicate check

The identical check remains 20 lines above in the code.

Differential Revision: https://reviews.llvm.org/D123046
The file was modifiedopenmp/runtime/src/kmp_wait_release.h
Commit 1e95d1bee63837cd40e6ea5ecc95eb8854ba8d21 by ibiryukov
[clang] Fix Clang release notes

I have forgotten a space by mistake in the previous commit.
The file was modifiedclang/docs/ReleaseNotes.rst
Commit 199dfb4d0cca0aaa217e79bd2371f96f6336bbc5 by aaron
Silence a false positive about an unevaluated expr w/side effects

If the operand to `sizeof` is an expression of VLA type, the operand is
still evaluated, so we should not issue a diagnostic about ignoring the
side effects in this case, as they're not actually ignored.

Fixes #48010
The file was modifiedclang/lib/Sema/SemaExpr.cpp
The file was modifiedclang/docs/ReleaseNotes.rst
The file was modifiedclang/test/Sema/warn-unused-value.c
Commit 87e3646a1f8addc18339a3b1c8bcb480c5339cd7 by Amara Emerson
[AArch64][GlobalISel] Add undef combines to postlegalizer combiner.
The file was modifiedllvm/lib/Target/AArch64/AArch64Combine.td
The file was removedllvm/test/CodeGen/AArch64/GlobalISel/postlegalizer-combiner-store-undef.mir
The file was addedllvm/test/CodeGen/AArch64/GlobalISel/postlegalizer-combiner-undef.mir
Commit 52d0ef3c00fc0542630fa98a4dfdf7137fb8635f by jonathan.l.peyton
[OpenMP] libomp: Add itt notifications to sync dependent tasks.

Intel Inspector uses itt notifications to analyze code execution, and it
reports race conditions in dependent tasks.
This patch fixes the issue notifying Inspector on tasks dependency
synchronizations.

Differential Revision: https://reviews.llvm.org/D123042
The file was modifiedopenmp/runtime/src/kmp_taskdeps.h
The file was modifiedopenmp/runtime/src/kmp_taskdeps.cpp
Commit be51ddf6b4545122318150795a02d3408942e221 by craig.topper
[RISCV] Add integer min/max intrinsic tests. NFC

Add basic tests and some tests for same operands and all undef
operands inspired by PR55271.

i32 is umin/umax is using signext to match RISC-V ABI. i8/i16 are
using signext/zeroext to match the operation.

Differential Revision: https://reviews.llvm.org/D124948
The file was addedllvm/test/CodeGen/RISCV/min-max.ll
Commit fd13192aa55508e426a9de3aa8959bf639d49d7f by craig.topper
[DAGCombiner] Fold (max/min X, X) -> X.

Differential Revision: https://reviews.llvm.org/D124951
The file was modifiedllvm/test/CodeGen/RISCV/min-max.ll
The file was modifiedllvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Commit 4e2d1a6c180613058766eea0c564154b8a563726 by craig.topper
[DAGCombiner] Fold (sext/zext undef) -> 0 and aext(undef) -> undef.

Differential Revision: https://reviews.llvm.org/D124988
The file was modifiedllvm/test/CodeGen/AMDGPU/llvm.amdgcn.class.ll
The file was modifiedllvm/test/CodeGen/RISCV/min-max.ll
The file was modifiedllvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Commit bb0aa574e7d66049bcb08c8a17532dadd875bf41 by andrzej.warzynski
[flang] Fix triple in a couple of driver tests

In https://reviews.llvm.org/D124667, I added tests that check the
generated assembly. I verified the assembly on AArch64 and X86_64, but
the PPC Flang buildbot [1] started failing (i.e. the assembly was not
generic enough).

In order to fix this, I'm changing these tests to be only run on
AAarch64 - that's the architecture that most of public Flang buildbots
use.

I'm hoping that this is straightforward enough and am merging it without
a review.

[1] https://lab.llvm.org/buildbot/#/builders/21/builds/40256
The file was modifiedflang/test/Driver/emit-asm-from-llvm.ll
The file was modifiedflang/test/Driver/emit-asm-from-llvm-bc.ll
Commit 084f967370fcd9a2964da0ff09c1970ebcc721c6 by craig.topper
[SelectionDAG] Constant fold (sext_inreg undef, VT) to 0 instead of undef.

The result of sign_extend_inreg needs to have as many sign bits
as requested by the VT argument. The easiest way to guarantee this
is to fold it to 0.

SystemZ test was modified to avoid using undef.

Fixes https://github.com/llvm/llvm-project/issues/55178

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D124696
The file was modifiedllvm/test/CodeGen/SystemZ/regcoal_remat_empty_subrange.ll
The file was modifiedllvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
The file was modifiedllvm/test/CodeGen/AArch64/pr55178.ll
Commit 7bad1d281c798929ae1be44b8c8a1e0713151ea9 by spatel
[InstCombine] add scalable vector test for logical select; NFC

D124997 shows that the code is not ready to handle scalable vectors,
so add some more coverage for a potential crashing case.
The file was modifiedllvm/test/Transforms/InstCombine/logical-select.ll
Commit 21c028ac946e3d51a2d3f602a285c650f0475798 by spatel
[InstCombine] fix typo in test name; NFC
The file was modifiedllvm/test/Transforms/InstCombine/logical-select.ll
Commit 6385c039b821c76c215c3ae6202f9e702a01fd92 by sam.mccall
[clangd] Fix inlayhints crash, don't assume functions have FunctionTypeLocs

Fixes https://github.com/clangd/clangd/issues/1140
The file was modifiedclang-tools-extra/clangd/InlayHints.cpp
The file was modifiedclang-tools-extra/clangd/unittests/InlayHintTests.cpp
Commit 22c6e7b277fbe6c65216d8c7a690d53c8122cb42 by cbate
[mlir][nvvm] Fix support for tf32 data type in mma.sync

The NVVM dialect test coverage for all possible type/shape combinations
in the `nvvm.mma.sync` op is mostly complete. However, there were tests
missing for TF32 datatype support. This change adds tests for the one
relevant shape/type combination. This uncovered a small bug in the op
verifier, which this change also fixes.

Differential Revision: https://reviews.llvm.org/D124975
The file was modifiedmlir/test/Target/LLVMIR/nvvmir.mlir
The file was modifiedmlir/test/Dialect/LLVMIR/nvvm.mlir
The file was modifiedmlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp
Commit aff52d1f08d2bb566192618d59a01aa7dd442088 by aaupov
[BOLT][CMAKE] Check build target architecture for runtime libs

Account for cross-compilation build scenarios (X86 to ARM, Linux
to Windows, etc).

Reviewed By: rafauler

Differential Revision: https://reviews.llvm.org/D124712
The file was modifiedbolt/CMakeLists.txt
Commit 7e71a039667bad3686771e1b69de24ee836b80b1 by Joseph.Nash
[AMDGPU] Split FeatureAtomicFaddInsts

FeatureAtomicFaddInsts is replaced with three more granular features.
Contributors:
Petar Avramovic <Petar.Avramovic@amd.com>

Patch 3/N for upstreaming of AMDGPU gfx11 architecture

Depends on D124537

Reviewed By: foad, #amdgpu, arsenm

Differential Revision: https://reviews.llvm.org/D124538
The file was modifiedllvm/lib/Target/AMDGPU/GCNSubtarget.h
The file was modifiedllvm/test/CodeGen/AMDGPU/llvm.amdgcn.atomic.fadd.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/global-atomics-fp.ll
The file was modifiedllvm/lib/Target/AMDGPU/FLATInstructions.td
The file was modifiedllvm/lib/Target/AMDGPU/AMDGPU.td
The file was modifiedllvm/test/CodeGen/AMDGPU/global-atomics-fp-wrong-subtarget.ll
The file was modifiedllvm/lib/Target/AMDGPU/BUFInstructions.td
Commit 967137ca3cb7cf38b2fedf0415946ff3ffd0ef50 by aaron
No longer accept scoped enumerations in C

We had a think-o that would allow a user to declare a scoped
enumeration in C language modes "as a C++11 extension". This is a
think-o because there's no way for the user to spell the name of the
enumerators; C does not have '::' for a fully-qualified name. See
commit d0d87b597259a2b74ae5c2825a081c7e336cb1d0 for details on why this
is unintentional for C.

Fixes #42372
The file was modifiedclang/test/Sema/enum.c
The file was modifiedclang/docs/ReleaseNotes.rst
The file was modifiedclang/lib/Parse/ParseDecl.cpp
Commit c12ef70d2b0ac6234feb48e01eb954dd753bb538 by andrzej.warzynski
[flang][driver] Add missing parentheses in an assert

The assert in https://reviews.llvm.org/D124665 was missing parentheses,
which triggered a warning in GCC (verified with GCC 11). As `-Werror` is
on by default in FLang, that triggered build errors, see e.g. [1].

The fix is rather straightforward, so I am sending this without a
review.

[1] https://lab.llvm.org/buildbot/#/builders/160/builds/7016

Differential Revision: https://reviews.llvm.org/D125027
The file was modifiedflang/lib/Frontend/FrontendActions.cpp
Commit 617edfa4811184c3ec027fbc7244a062ef93a62c by ndesaulniers
[x86][scheduler] Add MIR test for 41914

Generated via:
    $ clang -fno-omit-frame-pointer -m32 -mregparm=3 -O2 crash.c -emit-llvm -S
    $ llc -print-before=machine-scheduler -mcpu=sandybridge crash.mir

Reviewed By: pengfei

Differential Revision: https://reviews.llvm.org/D122348
The file was addedllvm/test/CodeGen/X86/scheduler-asm-moves.mir
Commit 5a4f177c949e5ff56bc6af9c0145e2d0c1b29c4d by koraq
[libc++] Avoid a Microsoft SAL macro.

Bug: https://github.com/llvm/llvm-project/issues/55195

Reviewed By: #libc, Mordante

Differential Revision: https://reviews.llvm.org/D124695
The file was modifiedlibcxx/include/__functional/perfect_forward.h
The file was modifiedlibcxx/include/__ranges/iota_view.h
The file was modifiedlibcxx/include/__iterator/prev.h
The file was modifiedlibcxx/include/__iterator/advance.h
The file was modifiedlibcxx/test/libcxx/nasty_macros.compile.pass.cpp
The file was modifiedlibcxx/include/__functional/bind_back.h
The file was modifiedlibcxx/include/__iterator/next.h
Commit e1554ac63a903891843b248d611fa8e9fc75d476 by sepavloff
Revert "[InstCombine] Remove side effect of replaced constrained intrinsics"

This reverts commit 83914ee96fc2d828e1cfb8913f5d156d39150e2c.
The change caused discussion: https://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20220502/1034841.html
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
The file was removedllvm/test/Transforms/InstCombine/constrained.ll
The file was modifiedllvm/include/llvm/Analysis/InstructionSimplify.h
Commit 18fd09ab64b07c45d0373307e37f7c96b3984183 by ndesaulniers
[X86SchedSandyBridge] update cost of COPY to 1 cycle from 0

To match the cost of other scheduling models. This is expected to
schedule mov instructions around INLINEASM less frequently for the
default machineschedule (pre-RA scheduling).

Suggested by Craig Topper.

Link: https://github.com/llvm/llvm-project/issues/41914

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D122350
The file was modifiedllvm/test/CodeGen/X86/2009-03-23-MultiUseSched.ll
The file was modifiedllvm/test/CodeGen/X86/gather-addresses.ll
The file was modifiedllvm/test/CodeGen/X86/sqrt-fastmath-tune.ll
The file was modifiedllvm/test/CodeGen/X86/fp-load-trunc.ll
The file was modifiedllvm/test/CodeGen/X86/machine-combiner-int.ll
The file was modifiedllvm/test/CodeGen/X86/machine-combiner-int-vec.ll
The file was modifiedllvm/test/CodeGen/X86/fp-trunc.ll
The file was modifiedllvm/test/CodeGen/X86/scheduler-asm-moves.mir
The file was modifiedllvm/test/CodeGen/X86/recip-fastmath2.ll
The file was modifiedllvm/test/CodeGen/X86/recip-fastmath.ll
The file was modifiedllvm/test/CodeGen/X86/vector-reduce-fmul-fast.ll
The file was modifiedllvm/test/CodeGen/X86/vector-reduce-fadd-fast.ll
The file was modifiedllvm/test/CodeGen/X86/vector-shuffle-combining.ll
The file was modifiedllvm/test/CodeGen/X86/sqrt-fastmath.ll
The file was modifiedllvm/lib/Target/X86/X86SchedSandyBridge.td
Commit 0d8cb8b399adcd17e8bf17be7814d030308c8b82 by dblaikie
DWARFVerifier: Verify CU/TU index overlap issues

Discovered in a large object that would need a 64 bit index (but the
cu/tu index format doesn't include a 64 bit offset/length mode in
DWARF64 - a spec bug) but instead binutils dwp overflowed the offsets
causing overlapping regions.
The file was modifiedllvm/include/llvm/DebugInfo/DWARF/DWARFUnitIndex.h
The file was modifiedllvm/include/llvm/DebugInfo/DWARF/DWARFVerifier.h
The file was modifiedllvm/lib/DebugInfo/DWARF/DWARFContext.cpp
The file was modifiedllvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
The file was addedllvm/test/DebugInfo/X86/debug-cu-index-overlap.s
Commit f9f7aa30f8a06867b7c144f7a748fa3a22df797d by flo
[VPlan] Remove dead code to create VPWidenPHIRecipes (NFCI).

After introducing VPWidenPointerInductionRecipe, VPWidenPHIRecipes
should not be created at this point. Turn check into an assert.
The file was modifiedllvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Commit eb3136f022b3e5061fe790e7886f4bb592d8a1d1 by alexandrecperez
Fix debugserver translation check

Currently, debugserver has a test to check if it was launched in
translation. The intent was to cover the case where an x86_64
debugserver attempts to control an arm64/arm64e process, returning
an error. However, this check also covers the case where users
are attaching to an x86_64 process, exiting out before attempting
to hand off control to the translated debugserver at
`/Library/Apple/usr/libexec/oah/debugserver`.

This diff delays the debugserver translation check until after
determining whether to hand off control to
`/Library/Apple/usr/libexec/oah/debugserver`. Only when the
process is not translated and thus has not been handed off do we
check if the debugserver is translated, erroring out in that case.

Reviewed By: jasonmolenda

Differential Revision: https://reviews.llvm.org/D124814
The file was modifiedlldb/tools/debugserver/source/DNB.cpp
The file was modifiedlldb/tools/debugserver/source/RNBRemote.cpp
The file was modifiedlldb/tools/debugserver/source/DNBDefs.h
Commit f6dff93641b2259623e686eb13a1884b8b9f4a00 by aaron
Pedantically warn about // comments in gnu89 mode

GCC warns with a pedantic warning when -std=gnu89, but Clang would only
diagnose in -std=c89 mode. Clang now matches the GCC behavior in both
modes.

Fixes #18427
The file was modifiedclang/test/Lexer/c90.c
The file was modifiedclang/test/Sema/gnu89.c
The file was modifiedclang/include/clang/Basic/LangStandards.def
The file was modifiedclang/docs/ReleaseNotes.rst
Commit 733dc3e50b2d34ebccaba24ca72ce72b5a3545f6 by rahmanl
[BOLT] Report per-section hotness in bolt-heatmap.

This patch adds a new feature to bolt heatmap to print the hotness of each section in terms of the percentage of samples within that section.

Sample output generated for the clang binary:

Section Name, Begin Address, End Address, Percentage Hotness
.text, 0x1a7b9b0, 0x20a2cc0, 1.4709
.init, 0x20a2cc0, 0x20a2ce1, 0.0001
.fini, 0x20a2ce4, 0x20a2cf2, 0.0000
.text.unlikely, 0x20a2d00, 0x431990c, 0.3061
.text.hot, 0x4319910, 0x4bc6927, 97.2197
.text.startup, 0x4bc6930, 0x4c10c89, 0.0058
.plt, 0x4c10c90, 0x4c12010, 0.9974

Reviewed By: rafauler

Differential Revision: https://reviews.llvm.org/D124412
The file was modifiedbolt/lib/Profile/DataAggregator.cpp
The file was modifiedbolt/include/bolt/Profile/Heatmap.h
The file was modifiedbolt/lib/Profile/Heatmap.cpp
Commit dcb906757ada24edf8da89439c72d015b53f204b by singh.shivamsingh2003
[clang][ASTImporter][NFC]: Move clang::ImportError into own header.

Reviewed By: martong

Differential Revision: https://reviews.llvm.org/D124774
The file was addedclang/include/clang/AST/ASTImportError.h
The file was modifiedclang/include/clang/AST/ASTImporterSharedState.h
The file was modifiedclang/include/clang/AST/ASTImporter.h
Commit c2a5a87500d92c7c2e76c595f1b0f439b98b0aff by llvm-dev
[X86] Add some test coverage for Issue #55271

We needed something that would delay the creation of the undef until after the rem-by-constant expansion, so I used a SSE shift of undef by zero which will expand to undef.
The file was modifiedllvm/test/CodeGen/X86/combine-srem.ll
The file was modifiedllvm/test/CodeGen/X86/combine-urem.ll