SuccessChanges

Summary

  1. [TargetMachine] Move X86 specific shouldAssumeDSOLocal logic to X86Subtarget::classifyGlobalFunctionReference (details)
  2. [llvmbuildectomy] removed vestigial LLVMBuild.txt files (details)
  3. [X86] Emit @PLT for x86-64 and keep unadorned symbols for x86-32 (details)
  4. [debugserver] Use dlsym for posix_spawnattr_setarchpref_np (details)
  5. [BasicAA] Fix a bug with relational reasoning across iterations (details)
  6. [test] Add explicit dso_local to function declarations in static relocation model tests (details)
  7. [TargetMachine] Don't imply dso_local on function declarations in Reloc::Static model for ELF/wasm (details)
  8. [TargetMachine] Clean up TargetMachine::shouldAssumeDSOLocal after x86-32 specific hack is moved to X86Subtarget (details)
  9. Remove memory allocation with string (details)
Commit db13a138bdad3aae1f0f387c871c43729badbc69 by i
[TargetMachine] Move X86 specific shouldAssumeDSOLocal logic to X86Subtarget::classifyGlobalFunctionReference
The file was modifiedllvm/lib/Target/TargetMachine.cpp
The file was modifiedllvm/lib/Target/X86/X86Subtarget.cpp
Commit 9737c128f14d60f73b1d198453801a05b37c6b28 by sguelton
[llvmbuildectomy] removed vestigial LLVMBuild.txt files

LLVMBuild has been removed from the build system. However, three LLVMBuild.txt
files remain in the tree. This patch simply removes them.

llvm/lib/ExecutionEngine/Orc/TargetProcess/LLVMBuild.txt
llvm/tools/llvm-jitlink/llvm-jitlink-executor/LLVMBuild.txt
llvm/tools/llvm-profgen/LLVMBuild.txt

Differential Revision: https://reviews.llvm.org/D92693
The file was removedllvm/lib/ExecutionEngine/Orc/TargetProcess/LLVMBuild.txt
The file was removedllvm/tools/llvm-jitlink/llvm-jitlink-executor/LLVMBuild.txt
The file was removedllvm/tools/llvm-profgen/LLVMBuild.txt
Commit 37f0c8df47d84ba311fc9a2c1884935ba8961e84 by i
[X86] Emit @PLT for x86-64 and keep unadorned symbols for x86-32

This essentially reverts the x86-64 side effect of r327198.

For x86-32, @PLT (R_386_PLT32) is not suitable in -fno-pic mode so the
code forces MO_NO_FLAG (like a forced dso_local) (https://bugs.llvm.org//show_bug.cgi?id=36674#c6).

For x86-64, both `call/jmp foo` and `call/jmp foo@PLT` emit R_X86_64_PLT32
(https://sourceware.org/bugzilla/show_bug.cgi?id=22791) so there is no
difference using @PLT. Using @PLT is actually favorable because this drops
a difference with -fpie/-fpic code and makes it possible to avoid a canonical
PLT entry when taking the address of an undefined function symbol.
The file was modifiedllvm/test/CodeGen/X86/cvt16.ll
The file was modifiedllvm/test/CodeGen/X86/fp128-extract.ll
The file was modifiedllvm/test/CodeGen/X86/powi.ll
The file was modifiedllvm/test/CodeGen/X86/half.ll
The file was modifiedllvm/test/CodeGen/X86/extract-fp.ll
The file was modifiedllvm/test/CodeGen/X86/fp128-libcalls.ll
The file was modifiedllvm/test/CodeGen/X86/pr38865.ll
The file was modifiedllvm/test/CodeGen/X86/lround-conv-i64.ll
The file was modifiedllvm/lib/Target/X86/X86Subtarget.cpp
The file was modifiedllvm/test/CodeGen/X86/llround-conv.ll
The file was modifiedllvm/test/CodeGen/X86/vector-half-conversions.ll
The file was modifiedllvm/test/CodeGen/X86/fmf-flags.ll
The file was modifiedllvm/test/CodeGen/X86/pow.ll
The file was modifiedllvm/test/CodeGen/X86/fp128-i128.ll
The file was modifiedllvm/test/CodeGen/X86/extractelement-fp.ll
The file was modifiedllvm/test/CodeGen/X86/memcpy-inline.ll
The file was modifiedllvm/test/CodeGen/X86/memcpy.ll
The file was modifiedllvm/test/CodeGen/X86/finite-libcalls.ll
The file was modifiedllvm/test/CodeGen/X86/negative-sin.ll
The file was modifiedllvm/test/CodeGen/X86/fmaxnum.ll
The file was modifiedllvm/test/CodeGen/X86/memset-nonzero.ll
The file was modifiedllvm/test/CodeGen/X86/fminnum.ll
The file was modifiedllvm/test/CodeGen/X86/lround-conv-i32.ll
Commit 13ee00d0c95a4eede96ba9520146a01930af2a0a by Jonas Devlieghere
[debugserver] Use dlsym for posix_spawnattr_setarchpref_np

The @available check did not work as I thought it did. Use good old
dlsym instead.
The file was modifiedlldb/tools/debugserver/source/MacOSX/MachProcess.mm
Commit bfda69416c6d0a76b40644b1b0cbc1cbca254a61 by listmail
[BasicAA] Fix a bug with relational reasoning across iterations

Due to the recursion through phis basicaa does, the code needs to be extremely careful not to reason about equality between values which might represent distinct iterations. I'm generally skeptical of the correctness of the whole scheme, but this particular patch fixes one particular instance which is demonstrateable incorrect.

Interestingly, this appears to be the second attempted fix for the same issue. The former fix is incomplete and doesn't address the actual issue.

Differential Revision: https://reviews.llvm.org/D92694
The file was modifiedllvm/lib/Analysis/BasicAliasAnalysis.cpp
The file was modifiedllvm/test/Analysis/BasicAA/phi-aa.ll
The file was modifiedllvm/include/llvm/Analysis/BasicAliasAnalysis.h
Commit 6b6c3aaeacfdc4a482de4af41719b0a4b50aeadf by i
[test] Add explicit dso_local to function declarations in static relocation model tests

They are currently implicit because TargetMachine::shouldAssumeDSOLocal implies
dso_local.

For such function declarations, clang -fno-pic emits the dso_local specifier.
Adding explicit dso_local makes these tests align with the clang behavior and
helps implementing an option to use GOT indirection when taking the address of a
function symbol in -fno-pic (to avoid a canonical PLT entry (SHN_UNDEF with
non-zero st_value)).
The file was modifiedllvm/test/CodeGen/X86/pr38865.ll
The file was modifiedllvm/test/CodeGen/X86/shrink-compare-pgso.ll
The file was modifiedllvm/test/CodeGen/X86/sqrt-partial.ll
The file was modifiedllvm/test/CodeGen/AArch64/extern-weak.ll
The file was modifiedllvm/test/CodeGen/X86/retpoline-external.ll
The file was modifiedllvm/test/CodeGen/X86/sibcall-win64.ll
The file was modifiedllvm/test/CodeGen/X86/fp128-i128.ll
The file was modifiedllvm/test/CodeGen/X86/cmp.ll
The file was modifiedllvm/test/CodeGen/X86/lvi-hardening-indirectbr.ll
The file was modifiedllvm/test/CodeGen/X86/statepoint-vreg-details.ll
The file was modifiedllvm/test/CodeGen/X86/shrink-compare.ll
The file was modifiedllvm/test/CodeGen/X86/add.ll
The file was modifiedllvm/test/CodeGen/X86/avx512-i1test.ll
The file was modifiedllvm/test/CodeGen/X86/pr47024.ll
The file was modifiedllvm/test/CodeGen/X86/tail-opts.ll
The file was modifiedllvm/test/CodeGen/X86/sibcall.ll
The file was modifiedllvm/test/CodeGen/X86/tailcall-assume.ll
The file was modifiedllvm/test/CodeGen/X86/fp-une-cmp.ll
The file was modifiedllvm/test/CodeGen/X86/tailcall-extract.ll
The file was modifiedllvm/test/CodeGen/X86/neg_cmp.ll
The file was modifiedllvm/test/CodeGen/X86/tail-dup-asm-goto.ll
The file was modifiedllvm/test/CodeGen/X86/mov-zero-to-xor.ll
The file was modifiedllvm/test/CodeGen/X86/rd-mod-wr-eflags.ll
The file was modifiedllvm/test/CodeGen/X86/memcmp-pgso.ll
The file was modifiedllvm/test/CodeGen/X86/tailcall-tailcc.ll
The file was modifiedllvm/test/CodeGen/X86/dagcombine-shifts.ll
The file was modifiedllvm/test/CodeGen/X86/sse-fcopysign.ll
The file was modifiedllvm/test/CodeGen/X86/musttail-tailcc.ll
The file was modifiedllvm/test/CodeGen/X86/peep-test-4.ll
The file was modifiedllvm/test/CodeGen/AArch64/funcptr_cast.ll
The file was modifiedllvm/test/CodeGen/X86/conditional-tailcall.ll
The file was modifiedllvm/test/CodeGen/X86/bmi.ll
The file was modifiedllvm/test/CodeGen/X86/bool-zext.ll
The file was modifiedllvm/test/CodeGen/X86/copy-eflags.ll
The file was modifiedllvm/test/CodeGen/X86/memcmp.ll
The file was modifiedllvm/test/CodeGen/X86/nomerge.ll
The file was modifiedllvm/test/CodeGen/SystemZ/la-01.ll
The file was modifiedllvm/test/CodeGen/X86/btq.ll
The file was modifiedllvm/test/CodeGen/X86/memcmp-minsize.ll
The file was modifiedllvm/test/CodeGen/X86/fp-strict-scalar-cmp.ll
The file was modifiedllvm/test/DebugInfo/X86/live-debug-values-remove-range.ll
The file was modifiedllvm/test/CodeGen/X86/memcmp-more-load-pairs.ll
The file was modifiedllvm/test/CodeGen/X86/statepoint-vreg-unlimited-tied-opnds.ll
The file was modifiedllvm/test/CodeGen/X86/fold-rmw-ops.ll
The file was modifiedllvm/test/CodeGen/AArch64/tagged-globals-static.ll
The file was modifiedllvm/test/CodeGen/X86/shrinkwrap-callbr.ll
The file was modifiedllvm/test/CodeGen/X86/memcmp-optsize.ll
The file was modifiedllvm/test/CodeGen/X86/tail-call-deref.ll
The file was modifiedllvm/test/CodeGen/X86/win64_sibcall.ll
The file was modifiedllvm/test/CodeGen/X86/avx-vzeroupper.ll
The file was modifiedllvm/test/CodeGen/X86/pr37063.ll
The file was modifiedllvm/test/CodeGen/X86/xor-icmp.ll
The file was modifiedllvm/test/CodeGen/X86/callbr-asm-branch-folding.ll
Commit a084c0388e2a59b9556f2de0083333232da3f1d6 by i
[TargetMachine] Don't imply dso_local on function declarations in Reloc::Static model for ELF/wasm

clang/lib/CodeGen/CodeGenModule sets dso_local on applicable function declarations,
we don't need to duplicate the work in TargetMachine:shouldAssumeDSOLocal.
(Actually the long-term goal (started by r324535) is to drop TargetMachine::shouldAssumeDSOLocal.)

By not implying dso_local, we will respect dso_local/dso_preemptable specifiers
set by the frontend. This allows the proposed -fno-direct-access-external-data
option to work with -fno-pic and prevent a canonical PLT entry (SHN_UNDEF with non-zero st_value)
when taking the address of a function symbol.

This patch should be NFC in terms of the Clang emitted assembly because the case
we don't set dso_local is a case Clang sets dso_local. However, some tests don't
set dso_local on some function declarations and expose some differences. Most
tests have been fixed to be more robust in the previous commit.
The file was modifiedllvm/lib/Target/X86/X86Subtarget.cpp
The file was modifiedllvm/test/CodeGen/X86/absolute-cmp.ll
The file was modifiedllvm/test/CodeGen/X86/tailcall.ll
The file was modifiedllvm/test/CodeGen/X86/absolute-constant.ll
The file was modifiedllvm/test/CodeGen/X86/retpoline.ll
The file was modifiedllvm/test/CodeGen/ARM/fast-isel-call.ll
The file was modifiedllvm/test/CodeGen/X86/fp-stack-direct-ret.ll
The file was modifiedllvm/test/CodeGen/X86/linux-preemption.ll
The file was modifiedllvm/lib/Target/TargetMachine.cpp
The file was modifiedllvm/test/CodeGen/X86/csr-split.ll
The file was modifiedllvm/test/CodeGen/AArch64/tiny_model.ll
The file was modifiedllvm/test/CodeGen/X86/abi-isel.ll
The file was modifiedllvm/test/CodeGen/X86/conditional-tailcall-pgso.ll
The file was modifiedllvm/test/CodeGen/X86/no-plt.ll
The file was modifiedllvm/test/CodeGen/X86/code-model-elf.ll
The file was modifiedllvm/test/CodeGen/X86/jump_sign.ll
The file was modifiedllvm/test/CodeGen/X86/slow-incdec.ll
The file was modifiedllvm/test/CodeGen/X86/or-branch.ll
The file was modifiedllvm/test/CodeGen/RISCV/mir-target-flags.ll
Commit 930b3398c7e4b3b15a9f262a2856d11fb2071eb7 by i
[TargetMachine] Clean up TargetMachine::shouldAssumeDSOLocal after x86-32 specific hack is moved to X86Subtarget

With my previous commit, X86Subtarget::classifyGlobalReference has learned to
use MO_NO_FLAG for 32-bit ELF -fno-pic code, the x86-32 special case in
TargetMachine::shouldAssumeDSOLocal can be removed. Since we no longer imply
dso_local for function declarations, we can drop the ppc64 special case as well.

This is NFC in terms of Clang emitted assembly.
The file was modifiedllvm/lib/Target/TargetMachine.cpp
The file was modifiedllvm/test/CodeGen/X86/abi-isel.ll
Commit c4e327a960d20e18f3a8116da51a5686c628d51b by 1894981+hiraditya
Remove memory allocation with string

Differential Revision: https://reviews.llvm.org/D92506
The file was modifiedllvm/lib/Option/OptTable.cpp