SuccessChanges

Summary

  1. [tsan] Fix "failed to intercept sysctlnametomib" on FreeBSD (details)
  2. x87 FPU state instructions do not use an f32 memory location (details)
  3. [GlobalISel] Fold xor(cmp(pred, _, _), 1) -> cmp(inverse(pred), _, _) (details)
  4. [flang] Fix integer CASE constant typing (details)
Commit 7be86829216698b6f4d0e083d48d7095898fc9c8 by Alexander.Richardson
[tsan] Fix "failed to intercept sysctlnametomib" on FreeBSD

The sysctlnametomib function is called from __tsan::Initialize via
__sanitizer::internal_sysctlbyname (see stack trace below). This results
in a fatal error since sysctlnametomib has not been intercepted yet.
This patch allows internal_sysctlbyname to be called before
__tsan::Initialize() has completed. On FreeBSD >= 1300045 sysctlbyname()
is a real syscall, but for older versions it calls sysctlnametomib()
followed by sysctl(). To avoid calling the intercepted version, look up
the real sysctlnametomib() followed by internal_sysctl() if the
syscall is not available.

This reduces check-sanitizer failures from 62 to 11 for me.

==34433==FATAL: ThreadSanitizer: failed to intercept sysctlnametomib
    at /exports/users/alr48/sources/upstream-llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_termination.cpp:51
    name=0x7fffffffce10, namelenp=0x7fffffffce08)
    at /exports/users/alr48/sources/upstream-llvm-project/compiler-rt/lib/tsan/../sanitizer_common/sanitizer_common_interceptors.inc:7908
    oldp=0x7fffffffcf2c, oldlenp=0x7fffffffcf20, newp=0x0, newlen=0)
    at /exports/users/alr48/sources/upstream-llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:803
    at /exports/users/alr48/sources/upstream-llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:2152
    at /exports/users/alr48/sources/upstream-llvm-project/compiler-rt/lib/tsan/rtl/tsan_rtl.cpp:367
    fname=0x21c731 "readlink", pc=34366042556)
    at /exports/users/alr48/sources/upstream-llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:255
    bufsiz=1024)
    at /exports/users/alr48/sources/upstream-llvm-project/compiler-rt/lib/tsan/../sanitizer_common/sanitizer_common_interceptors.inc:7151

Reviewed By: #sanitizers, vitalybuka

Differential Revision: https://reviews.llvm.org/D85292
The file was modifiedcompiler-rt/lib/sanitizer_common/sanitizer_linux.cpp (diff)
Commit a57fdcdd404bd9fa69463c587ee7915dde8541a2 by epastor
x87 FPU state instructions do not use an f32 memory location

These instructions actually use a 512-byte location, where bytes 464-511 are ignored.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D86942
The file was modifiedllvm/lib/Target/X86/X86InstrFPStack.td (diff)
Commit 8ad8f484b63ca507417b58c9016d2761f2b1a1a8 by Amara Emerson
[GlobalISel] Fold xor(cmp(pred, _, _), 1) -> cmp(inverse(pred), _, _)

This is needed for an upcoming change to how we translate conditional branches
which might generate these.

Differential Revision: https://reviews.llvm.org/D86383
The file was modifiedllvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp (diff)
The file was modifiedllvm/include/llvm/CodeGen/GlobalISel/Utils.h (diff)
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/sdiv.i64.ll (diff)
The file was modifiedllvm/lib/CodeGen/GlobalISel/Utils.cpp (diff)
The file was modifiedllvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h (diff)
The file was modifiedllvm/include/llvm/CodeGen/GlobalISel/MIPatternMatch.h (diff)
The file was addedllvm/test/CodeGen/AArch64/GlobalISel/prelegalizercombiner-invert-cmp.mir
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/srem.i64.ll (diff)
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/divergent-control-flow.ll (diff)
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/urem.i64.ll (diff)
The file was modifiedllvm/include/llvm/Target/GlobalISel/Combine.td (diff)
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/udiv.i64.ll (diff)
Commit 11ddb84b69e928aa396b28ce6b5baf8bbbdd6c43 by pklausler
[flang] Fix integer CASE constant typing

Don't use just 128-bit integer as the type for integer
CASE statement constants.  Use the actual type of the
literal constants that appeared.

Differential Review: https://reviews.llvm.org/D86875
The file was modifiedflang/lib/Semantics/check-case.cpp (diff)
The file was modifiedflang/test/Semantics/case01.f90 (diff)