[all-commits] [llvm/llvm-project] e7f794: Revert "[asan] Enable StackSafetyAnalysis by default"

Amir Ayupov via All-commits all-commits at lists.llvm.org
Thu Jan 11 18:38:53 PST 2024


  Branch: refs/heads/users/aaupov/spr/main.bolt-add-callsiteinfo-entries-in-yamlbat-1
  Home:   https://github.com/llvm/llvm-project
  Commit: e7f794875169811f3801fad6d40bb9fe833e1a69
      https://github.com/llvm/llvm-project/commit/e7f794875169811f3801fad6d40bb9fe833e1a69
  Author: Zequan Wu <zequanwu at google.com>
  Date:   2024-01-11 (Thu, 11 Jan 2024)

  Changed paths:
    M compiler-rt/test/asan/TestCases/alloca_vla_interact.cpp
    M compiler-rt/test/asan/TestCases/scariness_score_test.cpp
    M llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
    M llvm/test/Instrumentation/AddressSanitizer/asan-stack-safety.ll
    M llvm/test/Instrumentation/AddressSanitizer/debug_info.ll
    M llvm/test/Instrumentation/AddressSanitizer/lifetime-uar-uas.ll
    M llvm/test/Instrumentation/AddressSanitizer/lifetime.ll
    M llvm/test/Instrumentation/AddressSanitizer/local_stack_base.ll
    M llvm/test/Instrumentation/AddressSanitizer/stack_dynamic_alloca.ll
    M llvm/test/Instrumentation/AddressSanitizer/stack_layout.ll

  Log Message:
  -----------
  Revert "[asan] Enable StackSafetyAnalysis by default"

This reverts commit 51fbab134560ece663517bf1e8c2a30300d08f1a.
This causes the compiler to crash. Will file a issue to track the status.


  Commit: 75efddba0f507282df479a6e296d67fd88aed489
      https://github.com/llvm/llvm-project/commit/75efddba0f507282df479a6e296d67fd88aed489
  Author: Tacet <advenam.tacet at trailofbits.com>
  Date:   2024-01-11 (Thu, 11 Jan 2024)

  Changed paths:
    M libcxx/include/string

  Log Message:
  -----------
  [ASan][libc++] Initialize `__r_` variable with lambda (#77394)

This commit is a refactor (increases readability) and optimization fix.

This is a fixed commit of
https://github.com/llvm/llvm-project/pull/76200 First reverthed here:
https://github.com/llvm/llvm-project/commit/1ea7a56057492d9da1124787a9855cc2edca7df9

Please, check original PR for details.

The difference is a return type of the lambda.

Original description:

This commit addresses optimization and instrumentation challenges
encountered within comma constructors.
1) _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS does not work in comma
constructors.
2) Code inside comma constructors is not always correctly optimized.
Problematic code examples:
- `: __r_(((__str.__is_long() ? 0 : (__str.__annotate_delete(), 0)),
std::move(__str.__r_))) {`
- `: __r_(__r_([&](){ if(!__s.__is_long()) __s.__annotate_delete();
return std::move(__s.__r_);}())) {`

However, lambda with argument seems to be correctly optimized. This
patch uses that fact.

Use of lambda based on idea from @ldionne.


  Commit: 37c1a5e3f56a287703426da6c2c8cb998e28ca7c
      https://github.com/llvm/llvm-project/commit/37c1a5e3f56a287703426da6c2c8cb998e28ca7c
  Author: Joseph Huber <huberjn at outlook.com>
  Date:   2024-01-11 (Thu, 11 Jan 2024)

  Changed paths:
    M openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
    M openmp/libomptarget/plugins-nextgen/common/include/PluginInterface.h
    M openmp/libomptarget/plugins-nextgen/cuda/src/rtl.cpp

  Log Message:
  -----------
  [Libomptarget] Fix GPU Dtors referencing possibly deallocated image (#77828)

Summary:
The constructors and destructors look up a symbol in the ELF quickly to
determine if they need to be run on the GPU. This allows us to avoid the
very slow actions required to do the slower lookup using the vendor API.

One problem occurs with how we handle the lifetime of these images.
Right now there is no invariant to specify the lifetime of the
underlying binary image that is loaded. In the typical case, this comes
from the binary itself in the `.llvm.offloading` section, meaning that
the lifetime of the binary should match the executable itself. This
would work fine, if it weren't for the fact that the plugin is loaded
via `dlopen` and can have a teardown order out of sync with the main
executable.

This was likely what was occuring when this failed on some systems but
not others. A potential solution would be to simply copy images into
memory so the runtime does not rely on external references. Another
would be to manually zero these out after initialization as to prevent
this mistake from happening accidentally. The former has the benefit of
making some checks easier, and allowing for constant initialization be
done on the ELF itself (normally we can't do this because writing to a
constant section, e.g. .llvm.offloading is a segfault.). The downside
would be the extra time required to copy the image in bulk (Although we
are likely doing this in the vendor runtimes as well).

This patch went with a quick solution to simply set a boolean value at
initialization time if we need to call destructors.

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


  Commit: 40f5f90507725c1f93779c0e6e8d5a13854b4a3f
      https://github.com/llvm/llvm-project/commit/40f5f90507725c1f93779c0e6e8d5a13854b4a3f
  Author: Valentin Clement (バレンタイン クレメン) <clementval at gmail.com>
  Date:   2024-01-11 (Thu, 11 Jan 2024)

  Changed paths:
    M flang/test/Lower/OpenACC/acc-kernels-loop.f90
    M flang/test/Lower/OpenACC/acc-loop.f90
    M flang/test/Lower/OpenACC/acc-parallel-loop.f90
    M flang/test/Lower/OpenACC/acc-serial-loop.f90
    M mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
    M mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp
    M mlir/test/Dialect/OpenACC/ops.mlir

  Log Message:
  -----------
  [mlir][openacc][flang] Simplify gang, vector and worker representation (#77667)

The IR representation for gang, vector and worker has grown with the
support for device_type. This patch simplify the IR representation for
gang, vector and worker information on the acc.loop operation.

When the only the keyword is present without any values, the information
is printed at the same place than when there is values. The device_type
is omitted if there is no values and it is equal to None. Otherwise the
full information is displayed. First the keyword only device_type
information and then the values with their device_type.


  Commit: d447304768221b2ebd2dcf60b37c93fbf29d9129
      https://github.com/llvm/llvm-project/commit/d447304768221b2ebd2dcf60b37c93fbf29d9129
  Author: Krzysztof Parzyszek <Krzysztof.Parzyszek at amd.com>
  Date:   2024-01-11 (Thu, 11 Jan 2024)

  Changed paths:
    M flang/lib/Parser/CMakeLists.txt

  Log Message:
  -----------
  Revert "[Flang][Parser] Add missing dependencies to CMakeLists.txt (#77483)"

This reverts commit cc53ec82ea6df6e7602510fa1bf5b8a991b3bc39.

This commit hasn't accomplished anything. The original issue was that
`DumpTree`, when called from lowering, caused linker errors due to some
directive-naming functions being absent. Adding FrontendOpenMP to the
parser library didn't fix that problem, and according to the notes in
PR #77483, calling `DumpTree` from lowering isn't really supported.


  Commit: bdfe5d69dee7baa0a54cddca8a99e0fdaeded4a2
      https://github.com/llvm/llvm-project/commit/bdfe5d69dee7baa0a54cddca8a99e0fdaeded4a2
  Author: Valentin Clement (バレンタイン クレメン) <clementval at gmail.com>
  Date:   2024-01-11 (Thu, 11 Jan 2024)

  Changed paths:
    M flang/lib/Semantics/check-acc-structure.cpp
    M flang/lib/Semantics/check-directive-structure.h
    M flang/test/Semantics/OpenACC/acc-routine.f90

  Log Message:
  -----------
  [flang][openacc] Apply mutually exclusive clauses restriction to routine (#77802)

this patch enforce or fix the enforcement of two restrictions from
section 2.15.1:

> Only the gang, worker, vector, seq and bind clauses may follow a
device_type clause.

`seq` was not allowed after `device_type` with the current
implementation.

> Exactly one of the gang, worker, vector, or seq clauses must appear.

This was not properly checked. This patch check correctly for mutually
exclusion as described in section 2.4. Mutually exclusive clauses may
appear on the same directive if they apply for different device_type.


  Commit: 5ce067d592b78fd3142364e06bae4da2a3a1e944
      https://github.com/llvm/llvm-project/commit/5ce067d592b78fd3142364e06bae4da2a3a1e944
  Author: Philip Reames <preames at rivosinc.com>
  Date:   2024-01-11 (Thu, 11 Jan 2024)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
    M llvm/test/CodeGen/RISCV/branch-on-zero.ll
    M llvm/test/CodeGen/RISCV/riscv-codegenprepare-asm.ll
    M llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fp-buildvec.ll
    M llvm/test/CodeGen/RISCV/rvv/fixed-vectors-strided-load-store-asm.ll
    M llvm/test/CodeGen/RISCV/rvv/sink-splat-operands-i1.ll
    M llvm/test/CodeGen/RISCV/rvv/sink-splat-operands.ll
    M llvm/test/CodeGen/RISCV/rvv/vsetvli-insert-crossbb.ll
    M llvm/test/Transforms/LoopStrengthReduce/RISCV/lsr-cost-compare.ll

  Log Message:
  -----------
  Revert "[LSR][TTI][RISCV] Disable terminator folding for RISC-V."

This reverts commit fdb87640ee2be63af9b0e0cd943cb13d79686a03, and thus
re-enables terminator folding for RISCV.  The reported miscompile has
been fixed in f5dd70c58277d925710e5a7c25c86d7565cc3c6c.


  Commit: 69bc30b91e41d3ba12e0244251abeff03555e87b
      https://github.com/llvm/llvm-project/commit/69bc30b91e41d3ba12e0244251abeff03555e87b
  Author: Daniel Thornburgh <dthorn at google.com>
  Date:   2024-01-11 (Thu, 11 Jan 2024)

  Changed paths:
    M clang/cmake/caches/Fuchsia.cmake

  Log Message:
  -----------
  [Fuchsia] Add stage2 cmake options


  Commit: 8b61fc7181c06dbe907c67b49c75d59ae1595eb5
      https://github.com/llvm/llvm-project/commit/8b61fc7181c06dbe907c67b49c75d59ae1595eb5
  Author: Andy Kaylor <andrew.kaylor at intel.com>
  Date:   2024-01-11 (Thu, 11 Jan 2024)

  Changed paths:
    M llvm/docs/GettingInvolved.rst

  Log Message:
  -----------
  Add sync-up for floating-point working group (#71885)

Adding a new working group to discuss floating-point issues


  Commit: 238b5790ba2027a88706a320fe61bd21601b788b
      https://github.com/llvm/llvm-project/commit/238b5790ba2027a88706a320fe61bd21601b788b
  Author: Valentin Clement (バレンタイン クレメン) <clementval at gmail.com>
  Date:   2024-01-11 (Thu, 11 Jan 2024)

  Changed paths:
    M flang/lib/Semantics/check-acc-structure.cpp
    M flang/test/Semantics/OpenACC/acc-routine.f90

  Log Message:
  -----------
  [flang][openacc] Do not accept static and num for gang clause on routine dir (#77673)

Only the dim argument is allowed on the gang clause for the routine
directive. Reject static and num arguments in the semantic check.


  Commit: a6d401703b7542e00c85767513be0851df6c67cf
      https://github.com/llvm/llvm-project/commit/a6d401703b7542e00c85767513be0851df6c67cf
  Author: Fangrui Song <i at maskray.me>
  Date:   2024-01-11 (Thu, 11 Jan 2024)

  Changed paths:
    M llvm/lib/Analysis/StackSafetyAnalysis.cpp
    M llvm/test/Analysis/StackSafetyAnalysis/memintrin.ll

  Log Message:
  -----------
  [StackSafetyAnalysis] Bail out if MemIntrinsic length is -1 (#77837)

Clang generates llvm.memset.p0.i64 with a length of -1 for the following
code in
`-stdlib=libc++ -std=c++20` mode

(https://github.com/llvm/llvm-project/pull/77210#issuecomment-1887650010)
```cpp
bool strtof_clamp(const std::string &str);
void floatsuffix_check(char *yytext_r) {
  std::string text = yytext_r;
  text.resize(text.size() - 1);
  strtof_clamp(text);
}
```

`Sizes = [0xffffffffffffffff, 0)`. `SizeRange = [0, 0-1)`, leading to
`assert(!isUnsafe(SizeRange));` failure. Bail out if the length is -1.
Other negative values are handled by the existing condition.


  Commit: c8ad8024435df43a0811edb51be6ee517c44d332
      https://github.com/llvm/llvm-project/commit/c8ad8024435df43a0811edb51be6ee517c44d332
  Author: Valentin Clement <clementval at gmail.com>
  Date:   2024-01-11 (Thu, 11 Jan 2024)

  Changed paths:
    M flang/include/flang/Common/Fortran.h
    M flang/include/flang/Parser/dump-parse-tree.h
    M flang/include/flang/Parser/parse-tree.h
    M flang/include/flang/Semantics/symbol.h
    M flang/lib/Lower/OpenACC.cpp
    M flang/lib/Parser/openacc-parsers.cpp
    M flang/lib/Semantics/mod-file.cpp
    M flang/lib/Semantics/resolve-directives.cpp
    M flang/test/Semantics/OpenACC/acc-module.f90

  Log Message:
  -----------
  [flang][openacc] Carry device dependent info for routine in the module file


  Commit: 7740565f56ce888f5c60d986476185477c911b25
      https://github.com/llvm/llvm-project/commit/7740565f56ce888f5c60d986476185477c911b25
  Author: Fangrui Song <i at maskray.me>
  Date:   2024-01-11 (Thu, 11 Jan 2024)

  Changed paths:
    M compiler-rt/test/asan/TestCases/alloca_vla_interact.cpp
    M compiler-rt/test/asan/TestCases/scariness_score_test.cpp
    M llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
    M llvm/test/Instrumentation/AddressSanitizer/asan-stack-safety.ll
    M llvm/test/Instrumentation/AddressSanitizer/debug_info.ll
    M llvm/test/Instrumentation/AddressSanitizer/lifetime-uar-uas.ll
    M llvm/test/Instrumentation/AddressSanitizer/lifetime.ll
    M llvm/test/Instrumentation/AddressSanitizer/local_stack_base.ll
    M llvm/test/Instrumentation/AddressSanitizer/stack_dynamic_alloca.ll
    M llvm/test/Instrumentation/AddressSanitizer/stack_layout.ll

  Log Message:
  -----------
  [asan] Enable StackSafetyAnalysis by default

StackSafetyAnalysis determines whether stack-allocated variables are
guaranteed to be safe from memory access bugs and enables the removal of
certain unneeded instrumentations.
(hwasan enables StackSafetyAnalysis in https://reviews.llvm.org/D108381)

In a release build of clang, text sections are 9% smaller.

Test updates:

* asan-stack-safety.ll: test the -asan-use-stack-safety=1 default
* lifetime-uar-uas.ll: switch to an indexed store to prevent
  StackSafetyAnalysis from optimizing out instrumentation for %c
* alloca_vla_interact.cpp: add a load to prevent StackSafetyAnalysis
  from optimizing out `__asan_alloca_poison` for the VLA `array`
* scariness_score_test.cpp: add -asan-use-stack-safety=0 to make a load
  of a `__asan_poison_memory_region`-poisoned local variable fail as
  intended.
* other .ll tests: add -asan-use-stack-safety=0

Reviewed By: kstoimenov

Pull Request: https://github.com/llvm/llvm-project/pull/77210


  Commit: b3981edb51bf36480b8b2c9d6969725ddbcadcfb
      https://github.com/llvm/llvm-project/commit/b3981edb51bf36480b8b2c9d6969725ddbcadcfb
  Author: a-n-n-a-l-e-e <150648636+a-n-n-a-l-e-e at users.noreply.github.com>
  Date:   2024-01-11 (Thu, 11 Jan 2024)

  Changed paths:
    M libcxx/src/CMakeLists.txt

  Log Message:
  -----------
  [libc++] Re-export libc++abi symbols on Apple platforms when using system-libcxxabi (#77218)

When using LIBCXX_CXX_ABI=system-libcxxabi on Apple platforms, we would not
re-export the libc++abi symbols unlike when LIBCXX_CXX_ABI=libcxxabi. This
was caused by overly strict string matching in CMake.

https://github.com/NixOS/nixpkgs/issues/269548


  Commit: bbe07989d7225aaff9613b71dbd7f00e8d738b22
      https://github.com/llvm/llvm-project/commit/bbe07989d7225aaff9613b71dbd7f00e8d738b22
  Author: Amir Ayupov <aaupov at fb.com>
  Date:   2024-01-11 (Thu, 11 Jan 2024)

  Changed paths:
    M bolt/docs/BAT.md
    M bolt/lib/Profile/BoltAddressTranslation.cpp
    M bolt/test/X86/bolt-address-translation.test

  Log Message:
  -----------
  [BOLT] Delta-encode offsets in BAT (#76900)

This change further reduces the size of BAT:
- large binary: to 13073904 bytes (0.34x original),
- medium binary: to 1703116 bytes (0.29x original),
- small binary: to 436 bytes (0.30x original).

Test Plan: Updated bolt/test/X86/bolt-address-translation.test


  Commit: 8fb8ad66c95a51b82e5c2876ed925b5512ce6b83
      https://github.com/llvm/llvm-project/commit/8fb8ad66c95a51b82e5c2876ed925b5512ce6b83
  Author: Amir Ayupov <aaupov at fb.com>
  Date:   2024-01-11 (Thu, 11 Jan 2024)

  Changed paths:
    M bolt/docs/BAT.md
    M bolt/lib/Profile/BoltAddressTranslation.cpp
    M bolt/test/X86/bolt-address-translation.test

  Log Message:
  -----------
  [BOLT] Delta-encode function start addresses in BAT (#76902)

Further reduce the size of BAT section:
- large binary: to 12716312 bytes (0.33x original),
- medium binary: to 1649472 bytes (0.28x original),
- small binary: to 428 bytes (0.30x original).

Test Plan: Updated bolt/test/X86/bolt-address-translation.test


  Commit: 11607fa8b67458d244ab1669567b3e6758525e53
      https://github.com/llvm/llvm-project/commit/11607fa8b67458d244ab1669567b3e6758525e53
  Author: Amir Ayupov <aaupov at fb.com>
  Date:   2024-01-11 (Thu, 11 Jan 2024)

  Changed paths:
    M bolt/include/bolt/Profile/BoltAddressTranslation.h
    M bolt/lib/Profile/BoltAddressTranslation.cpp
    M clang/cmake/caches/Fuchsia.cmake
    M flang/include/flang/Common/Fortran.h
    M flang/include/flang/Parser/dump-parse-tree.h
    M flang/include/flang/Parser/parse-tree.h
    M flang/include/flang/Semantics/symbol.h
    M flang/lib/Lower/OpenACC.cpp
    M flang/lib/Parser/CMakeLists.txt
    M flang/lib/Parser/openacc-parsers.cpp
    M flang/lib/Semantics/check-acc-structure.cpp
    M flang/lib/Semantics/check-directive-structure.h
    M flang/lib/Semantics/mod-file.cpp
    M flang/lib/Semantics/resolve-directives.cpp
    M flang/test/Lower/OpenACC/acc-kernels-loop.f90
    M flang/test/Lower/OpenACC/acc-loop.f90
    M flang/test/Lower/OpenACC/acc-parallel-loop.f90
    M flang/test/Lower/OpenACC/acc-serial-loop.f90
    M flang/test/Semantics/OpenACC/acc-module.f90
    M flang/test/Semantics/OpenACC/acc-routine.f90
    M libcxx/include/string
    M libcxx/src/CMakeLists.txt
    M llvm/docs/GettingInvolved.rst
    M llvm/lib/Analysis/StackSafetyAnalysis.cpp
    M llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
    M llvm/test/Analysis/StackSafetyAnalysis/memintrin.ll
    M llvm/test/CodeGen/RISCV/branch-on-zero.ll
    M llvm/test/CodeGen/RISCV/riscv-codegenprepare-asm.ll
    M llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fp-buildvec.ll
    M llvm/test/CodeGen/RISCV/rvv/fixed-vectors-strided-load-store-asm.ll
    M llvm/test/CodeGen/RISCV/rvv/sink-splat-operands-i1.ll
    M llvm/test/CodeGen/RISCV/rvv/sink-splat-operands.ll
    M llvm/test/CodeGen/RISCV/rvv/vsetvli-insert-crossbb.ll
    M llvm/test/Transforms/LoopStrengthReduce/RISCV/lsr-cost-compare.ll
    M mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
    M mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp
    M mlir/test/Dialect/OpenACC/ops.mlir
    M openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
    M openmp/libomptarget/plugins-nextgen/common/include/PluginInterface.h
    M openmp/libomptarget/plugins-nextgen/cuda/src/rtl.cpp

  Log Message:
  -----------
  [𝘀𝗽𝗿] changes introduced through rebase

Created using spr 1.3.4

[skip ci]


Compare: https://github.com/llvm/llvm-project/compare/8f8832f65a28...11607fa8b674


More information about the All-commits mailing list