Changes

Summary

  1. [compiler-rt] Use portable "#!/usr/bin/env bash" shebang for tests. (details)
  2. Revert "[DSE] Track earliest escape, use for loads in isReadClobber." (details)
  3. tsan: add a test for flushing memory (details)
  4. Revert "[JumpThreading] Ignore free instructions" (details)
  5. tsan: add a stress test (details)
  6. Revert "[InstCombine] fold cast of right-shift if high bits are not demanded (2nd try)" (details)
  7. [TargetLibraryInfo][AMDGPU] Minor cleanup, NFC (details)
  8. [llvm-objcopy][NFC] Add a helper method RelocationSectionBase::getNamePrefix() (details)
  9. [Transforms/Utils] Remove redundant declaration computeSyntheticCounts (NFC) (details)
  10. [libc++][NFC] Add missing link to a ranges review (details)
  11. [InstCombine] add tests for lshr-trunc-lshr; NFC (details)
  12. [x86] convert logic-of-FP-compares to FP logic-of-vector-compares (details)
  13. [libc++] Require a C++20 capable compiler. (details)
  14. [X86][SSE] combineMulToPMADDWD - replace sext(v8i16) -> zext(v8i16) (details)
  15. tsan: don't use pipe2 in tests (details)
  16. [MC][NFC] Add end-of-namespace comments (details)
  17. Recommit "[DSE] Track earliest escape, use for loads in isReadClobber." (details)
  18. [PowerPC] Add range check for vec_genpcvm builtins (details)
  19. [mlir] Linalg: ensure tile-and-pad always creates padding as requested (details)
  20. [AMDGPU] Always reserve flat scratch SGPR for architected flat scratch (details)
  21. Revert "[flang][fir] Add support to mangle/deconstruct namelist group name" (details)
  22. Re-apply "[JumpThreading] Ignore free instructions" (details)
Commit 626e2a6c6236d2fd7582928a0363d381c55eb43d by shivam98.tkg
[compiler-rt] Use portable "#!/usr/bin/env bash" shebang for tests.

In build_symbolizer.sh we can safely remove the -eu argument from the shebang (which is an unportable construct), as the scripts sets **-e** and **-u** already.

Differential Revision: https://reviews.llvm.org/D110039
The file was modifiedcompiler-rt/lib/sanitizer_common/symbolizer/scripts/ar_to_bc.sh
The file was modifiedcompiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh
The file was modifiedcompiler-rt/lib/gwp_asan/scripts/symbolize.sh
The file was modifiedcompiler-rt/lib/tsan/analyze_libtsan.sh
The file was modifiedcompiler-rt/lib/asan/scripts/asan_device_setup
The file was modifiedcompiler-rt/lib/tsan/check_analyze.sh
The file was modifiedcompiler-rt/lib/tsan/check_cmake.sh
Commit df56fc6ebbee6c458b0473185277b7860f7e3408 by thakis
Revert "[DSE] Track earliest escape, use for loads in isReadClobber."

This reverts commit 5ce89279c0986d0bcbe526dce52f91dd0c16427c.
Makes clang crash, see comments on https://reviews.llvm.org/D109844
The file was modifiedllvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
The file was modifiedllvm/include/llvm/Analysis/CaptureTracking.h
The file was modifiedllvm/test/Transforms/DeadStoreElimination/captures-before-load.ll
The file was modifiedllvm/lib/Analysis/CaptureTracking.cpp
Commit ad890aa2327feb6b6aee676fe85b2352fba2403e by dvyukov
tsan: add a test for flushing memory

Add a test for __tsan_flush_memory() and for background
flushing of the runtime memory.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D110409
The file was addedcompiler-rt/test/tsan/flush_memory.cpp
The file was modifiedcompiler-rt/include/sanitizer/tsan_interface.h
Commit 4604695d7c20e72b551a1a5224f3de877cb41bd3 by hans
Revert "[JumpThreading] Ignore free instructions"

It caused compiler crashes, see comment on the code review for repro.

> This is basically D108837 but for jump threading. Free instructions
> should be ignored for the threading decision. JumpThreading already
> skips some free instructions (like pointer bitcasts), but does not
> skip various free intrinsics -- in fact, it currently gives them a
> fairly large cost of 2.
>
> Differential Revision: https://reviews.llvm.org/D110290

This reverts commit 1e3c6fc7cb9d2ee6a5328881f95d6643afeadbff.
The file was modifiedllvm/test/Transforms/PhaseOrdering/inlining-alignment-assumptions.ll
The file was modifiedllvm/include/llvm/Transforms/Scalar/JumpThreading.h
The file was modifiedllvm/test/Transforms/JumpThreading/free_instructions.ll
The file was modifiedllvm/lib/Transforms/Scalar/JumpThreading.cpp
Commit 124fcd7e9d2b8831dab0c50d4fce9900b033c6c2 by dvyukov
tsan: add a stress test

The stress test does various assorted things
(memory accesses, function calls, atomic operations,
thread creation/join, intercepted libc calls)
in multiple threads just to stress various parts
of the runtime.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D110416
The file was modifiedcompiler-rt/test/tsan/test.h
The file was addedcompiler-rt/test/tsan/stress.cpp
Commit 3c5500907b1089f4b274b09a195ee0685d51f9e2 by spatel
Revert "[InstCombine] fold cast of right-shift if high bits are not demanded (2nd try)"

This reverts commit bb9333c3504a4a02b982526ad8264d14c6ec1ad4.

This exposes another existing bug that causes an infinite loop as shown in
D110170
...so reverting while I look at another fix.
The file was modifiedllvm/test/Transforms/InstCombine/trunc-demand.ll
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
Commit 1376ae909431b78bee35899f301d1ab2f53cc1ba by paul.robinson
[TargetLibraryInfo][AMDGPU] Minor cleanup, NFC
The file was modifiedllvm/lib/Analysis/TargetLibraryInfo.cpp
Commit 6dda6c49ce4b67840c4f38d51111278b4b64c1bf by ikudrin
[llvm-objcopy][NFC] Add a helper method RelocationSectionBase::getNamePrefix()

Refactor handleArgs() to use that method.

Differential Revision: https://reviews.llvm.org/D110350
The file was modifiedllvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp
The file was modifiedllvm/tools/llvm-objcopy/ELF/Object.cpp
The file was modifiedllvm/tools/llvm-objcopy/ELF/Object.h
Commit c597594461bb3ba34a9699b744be09135635cbc7 by kazu
[Transforms/Utils] Remove redundant declaration computeSyntheticCounts (NFC)
The file was modifiedllvm/include/llvm/Transforms/Utils/FunctionImportUtils.h
The file was modifiedllvm/include/llvm/LTO/SummaryBasedOptimizations.h
Commit 1295694364d0698f991b458f2ea23f33a064db0a by Louis Dionne
[libc++][NFC] Add missing link to a ranges review
The file was modifiedlibcxx/docs/Status/RangesPaper.csv
Commit 638a4147fc6400b928080c6d5656fbcee707a793 by spatel
[InstCombine] add tests for lshr-trunc-lshr; NFC
The file was modifiedllvm/test/Transforms/InstCombine/lshr.ll
Commit 09e71c367af36a07cce04a812dcd9c62bebfbcdf by spatel
[x86] convert logic-of-FP-compares to FP logic-of-vector-compares

This is motivated by the examples and discussion in:
https://llvm.org/PR51245
...and related bugs.

By using vector compares and vector logic, we can convert 2 'set'
instructions into 1 'movd' or 'movmsk' and generally improve
throughput/reduce instructions.

Unfortunately, we don't have a complete vector compare ISA before
AVX, so I left SSE-only out of this patch. Ie, we'd need extra logic
ops to simulate the missing predicates for SSE 'cmpp*', so it's not
as clearly a win.

Differential Revision: https://reviews.llvm.org/D110342
The file was modifiedllvm/test/CodeGen/X86/fcmp-logic.ll
The file was modifiedllvm/test/CodeGen/X86/lzcnt-zext-cmp.ll
The file was modifiedllvm/lib/Target/X86/X86ISelLowering.cpp
Commit f881776175e97f7667ad2d32cfea0ba6f4254181 by Louis Dionne
[libc++] Require a C++20 capable compiler.

This enforces libcxx and its benchmarks are compiled by a C++20 capable
compiler. Based on review comments in D103413.

Differential Revision: https://reviews.llvm.org/D110338
The file was modifiedlibcxx/CMakeLists.txt
The file was modifiedlibcxx/benchmarks/CMakeLists.txt
Commit d8fc9f87270146e271eddd551ea98580bef15e82 by llvm-dev
[X86][SSE] combineMulToPMADDWD - replace sext(v8i16) -> zext(v8i16)

As suggested on D108522, if we're sign extending a v4i16 source before multiplying as a v4i32, then we can replace that with a zero extension and rely on the implicit sign-extension of PMADDWD.
The file was modifiedllvm/lib/Target/X86/X86ISelLowering.cpp
The file was modifiedllvm/test/CodeGen/X86/madd.ll
Commit 34412cea5c247e30e49958213df10dd8f128d7e5 by dvyukov
tsan: don't use pipe2 in tests

MacOS buildbots failed:
stress.cpp:57:7: error: use of undeclared identifier 'pipe2'
https://green.lab.llvm.org/green//job/clang-stage1-RA/24209/consoleFull#-3468768778254eaf0-7326-4999-85b0-388101f2d404

Fix the test to not use pipe2.

Differential Revision: https://reviews.llvm.org/D110423
The file was modifiedcompiler-rt/test/tsan/stress.cpp
Commit e2546525902de18bb66a0c46ad3517d9f389fa47 by fraser
[MC][NFC] Add end-of-namespace comments
The file was modifiedllvm/include/llvm/MC/MCInstrDesc.h
Commit 6f28fb708149e9db8d077e65fcc9f87d566e824a by flo
Recommit "[DSE] Track earliest escape, use for loads in isReadClobber."

This reverts the revert commit df56fc6ebbee6c458b0473185277b7860f7e3408.

This version of the patch adjusts the location where the EarliestEscapes
cache is cleared when an instruction gets removed. The earliest escaping
instruction does not have to be a memory instruction.

It could be a ptrtoint instruction like in the added test
@earliest_escape_ptrtoint, which subsequently gets removed. We need to
invalidate the EarliestEscape entry referring to the ptrtoint when
deleting it.

This fixes the crash mentioned in
https://bugs.chromium.org/p/chromium/issues/detail?id=1252762#c6
The file was modifiedllvm/lib/Analysis/CaptureTracking.cpp
The file was modifiedllvm/test/Transforms/DeadStoreElimination/captures-before-load.ll
The file was modifiedllvm/include/llvm/Analysis/CaptureTracking.h
The file was modifiedllvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
Commit 3b0240e6c89d9201430ee83b09fe7c94256e8838 by quinn.pham
[PowerPC] Add range check for vec_genpcvm builtins

This patch adds range checking for some Power10 altivec builtins. Range
checking is done in SemaChecking.

Reviewed By: #powerpc, lei, Conanap

Differential Revision: https://reviews.llvm.org/D109780
The file was modifiedclang/test/CodeGen/builtins-ppc-p10vector-error.c
The file was modifiedclang/lib/Sema/SemaChecking.cpp
Commit 5988a3b7a09126aff982944ecb36f533c450388e by zinenko
[mlir] Linalg: ensure tile-and-pad always creates padding as requested

Initially, the padding transformation and the related operation were only used
to guarantee static shapes of subtensors in tiled operations. The
transformation would not insert the padding operation if the shapes were
already static, and the overall code generation would actively remove such
"noop" pads. However, this transformation can be also used to pack data into
smaller tensors and marshall them into faster memory, regardless of the size
mismatches. In context of expert-driven transformation, we should assume that,
if padding is requested, a potentially padded tensor must be always created.
Update the transformation accordingly. To do this, introduce an optional
`packing` attribute to the `pad_tensor` op that serves as an indication that
the padding is an intentional choice (as opposed to side effect of type
normalization) and should be left alone by cleanups.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D110425
The file was modifiedmlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td
The file was modifiedmlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
The file was modifiedmlir/lib/Dialect/Linalg/Transforms/Transforms.cpp
The file was modifiedmlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
The file was modifiedmlir/test/Dialect/Linalg/canonicalize.mlir
The file was modifiedmlir/test/Dialect/Linalg/tile-and-pad-tensors.mlir
Commit 082e22f3d72bd63f9b388d5566064cf3736da511 by Stanislav.Mekhanoshin
[AMDGPU] Always reserve flat scratch SGPR for architected flat scratch

With architected flat scratch it becomes readonly. We must always
reserve SGPR pair for it even if we do not use scratch at all since
an attempt to write to SGPRs mapped to FLAT_SCRATCH results in
memory violation.

This is not needed since GFX10 with architected flat scratch though
since special SGPRs are not carving space from normal SGPRs.

Differential Revision: https://reviews.llvm.org/D110376
The file was modifiedllvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp
The file was modifiedllvm/test/CodeGen/AMDGPU/flat-scratch-reg.ll
The file was modifiedllvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp
Commit 321be24aa6808c5829f3433407e13603901849f4 by clementval
Revert "[flang][fir] Add support to mangle/deconstruct namelist group name"

This reverts commit 3593ae4312f6156c9ca50d46cdb55a8dfad782d0.
The file was modifiedflang/unittests/Optimizer/InternalNamesTest.cpp
The file was modifiedflang/lib/Lower/Mangler.cpp
The file was modifiedflang/lib/Optimizer/Support/InternalNames.cpp
The file was modifiedflang/include/flang/Optimizer/Support/InternalNames.h
Commit 1e9afab875696ebf1a8abb5637f04735411ee0b7 by hans
Re-apply "[JumpThreading] Ignore free instructions"

It seems the crashes we saw wasn't caused by this (see comments on the review).

> This is basically D108837 but for jump threading. Free instructions
> should be ignored for the threading decision. JumpThreading already
> skips some free instructions (like pointer bitcasts), but does not
> skip various free intrinsics -- in fact, it currently gives them a
> fairly large cost of 2.
>
> Differential Revision: https://reviews.llvm.org/D110290

This reverts commit 4604695d7c20e72b551a1a5224f3de877cb41bd3.
The file was modifiedllvm/lib/Transforms/Scalar/JumpThreading.cpp
The file was modifiedllvm/test/Transforms/JumpThreading/free_instructions.ll
The file was modifiedllvm/include/llvm/Transforms/Scalar/JumpThreading.h
The file was modifiedllvm/test/Transforms/PhaseOrdering/inlining-alignment-assumptions.ll