[libc] Include correct headers in type_traits (#197691)
Otherwise we end up with errors like the following when building with
bazel:
```c++
In file included from external/+_repo_rules+llvm-project/libc/src/__support/CPP/type_traits/is_move_constructible.h:12:
external/+_repo_rules+llvm-project/libc/src/__support/CPP/type_traits/is_constructible.h:32:14: error: no template named 'bool_constant'
32 | : public bool_constant<__is_constructible(T, Args...)> {};
```
[DAG] SimplifyMultipleUseDemandedBits - fold (mul X, 1) -> X (#197677)
Use DemandedElts + KnownBits to match hidden identity patterns - helps
especially with reduction patterns padded by legalisation
Once #197455 has landed, I'm intending to convert this (plus
SMIN/SMAX/UMIN/UMAX and the existing ISD::ADD case) to use
isIdentityElement directly.
[LV][NFC] Remove instcombine from RUN lines in AArch64 tests (#197448)
This PR continues other work I've been doing trying to remove
unnecessary extra passes from the RUN lines in order to make it easier
to map the expected vectoriser output to the CHECK lines. As a result it
has exposed some potential optimisations that we may be able to perform
in VPlan.
Here is a summary of the changes I've noticed:
1. instcombine likes to canonicalise GEPs into certain forms. I'm not
sure if there is value in VPlan trying to guess what the canonical form
should be.
2. In tests like sve-cond-inv-loads.ll, etc. the pattern sub(urem) is
often replaced with and(sub). This is potentially something the
vectoriser could improve although I don't know if it would change the
cost model.
3. There is poor codegen in gather_nxv4i32_ind64_stride2 in the file
sve-gather-scatter.ll, which is due to
[19 lines not shown]
[PowerPC] Update base crypto builtins and intrinsics (#197017)
Update the base crypto builtins and LLVM intrinsics to drop the mma_
prefix. Also fix the builtin definitions for dmsha2hash, dmsha3hash,
and dmxxshapad to use the correct immediate constraints.
[CodeGen] Debug insns must not affect liveness analysis (#193104)
Register references in debug instructions can affect LiveRegUnits
analysis. Skip over debug instructions.
Tests in this PR would fail due to calls to LiveRegUnits::stepBackward
in RegisterScavenging, DeadMachineInstructionElim, and
AArch64InstrInfo.cpp getOutlinableRanges().
Other call-sites to stepBackward may also pass debug instructions to
LiveRegUnits::stepBackward, but LIT testing did not fail when
-debugify-and-strip-all-safe was enabled by default.
---------
Signed-off-by: John Lu <John.Lu at amd.com>
[clang] NFC: add asserts enforcing template parameters have valid positions
Some tests are violating these assertions, so they are commented out.
For the test in `clang/test/SemaTemplate/concepts.cpp`, that was broken by #195995
and needs a partial revert at least.
[clang] CTAD: fix transformation of template template parameters (#197611)
This fixes the CTAD template parameter transforms so they produce
template template parameters which have correct depth for their own
template parameters.
This also stops calling SubstDecl directly on the non-type template
parameters, so that a template parameter with correct position is
produced directly, instead of manually fixing that up later. This helps
#197598 by making it possible to add assertions that the positions are
always valid.
[AArch64][GlobalISel] Add always legal action builders. (#197238)
This defined some always legal actions, removing our dependency on the
Legacy ruleset in aarch64.
[AMDGPU][NFC] Remove redundant hasMadU64U32NoCarry helper
Use hasMadNC64_32Insts() (backed by SubtargetFeature) for MAD 64_32
no-carry and drop the old helper.
[NFC] Format two AMDGPU files (#197672)
- `llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp`
- `llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp`
[UniformityAnalysis] Fix nodivergencesource calls (#197656)
NFC #168903 introduced a subtle behavior change for calls with the
nodivergencesource attribute and divergent operands.
Calls with the nodivergencesource attribute are *not* always uniform.
They just do not introduce any new divergence. If any operand is
divergent,
the result must still be reported as divergent.
Revert to pre-#168903 behavior by allowing the standard propagation to
work for target's NeverUniform while keeping Default and AlwaysUniform
unchanged.
AMDGPU/GlobalISel: Legalize scalar extloads with large memory type (#197648)
Add narrowScalar for scalar sext/zextload when the memory type is
larger then 32 bits. There is no narrow scalar implementation when
NarrowSize < MemSize (split load) but we don't want that anyway.
Narrow scalar to MemSize creates large normal load + extension to dst.
[NFC][Analysis] Use `isa<ConstantPointerNull>` for null pointer checks (#197544)
Make Analysis null pointer checks use `isa<ConstantPointerNull>` rather
than generic null value checks (`isNullValue()`).
[libc] Fix shared math for gcc-7 or older compatibility. (#197476)
- Add gcc-7 or older compatibility for cpp::is_assignable and
cpp::is_constructible.
- Apply LIBC_CONSTEXPR to FPUtil/rounding_mode.h
[RISCV] Check SP-relative offset in needsFrameBaseReg when FP offset overflows (#197368)
When a frame pointer is present, `needsFrameBaseReg` previously only
checked the FP-relative offset to decide if a virtual base register was
needed. If the worst-case FP offset exceeded the 12-bit immediate range,
a base register was always materialized, even when the SP-relative
offset would fit.
Since `getFrameIndexReference` can now select SP over FP when the offset
fits in the compressed instruction immediate range, also check the
SP-relative offset before deciding a base register is needed. This
avoids unnecessary base register materialization and results in some
code size savings.
[libc] prefer *at syscalls in sys/stat wrappers (#195792)
- so the changes flips the #ifdef order to prefer the *at syscalls over normal ones.
- In modern architectures, *at system calls are preferred over normal
system calls.
- so by checking for "*at" sys calls first, we ensure better
compatibility with modern systems.
- then normal syscalls moved to else for support of older ones.
Signed-off-by: udaykiriti <udaykiriti624 at gmail.com>
[libc] Remove legacy SYS_socketcall fallbacks (#197189)
This patch removes legacy SYS_socketcall fallback paths from all Linux
socket entry points. The individual syscall entry points were
[added](https://github.com/torvalds/linux/commit/9dea5dc921b5f4045a18c63eb92e84dc274d17eb)
in linux 4.3 (on x86, other architectures have had them even sooner).
Our policy is to support the lowest kernel version on
https://kernel.org/, which is 5.10 as of this writing.
This is motivated by the problems in
[testing](https://github.com/llvm/llvm-project/pull/196903#pullrequestreview-4263553670)
the fallback paths -- to make sure this even builds, one needs to get a
hold of very old kernel headers, or otherwise hack its build to force it
to select the fallback path.
New ABIs don't have the accept syscall (only accept4), so I've added an
accept->accept4 fallback.
Assisted by Gemini.
[libc][math] Fix exp10m1f(-0) in SKIP_ACCURATE_PASS mode (#197650)
exp10m1f(-0) should return -0, just like expm1f does. But if you build
with the LIBC_MATH_SKIP_ACCURATE_PASS flag, it accidentally returned +0,
and failed the src.math.smoke.exp10m1f_test test.
The check for -0 is normally done by EXP10M1F_EXCEPTS_LO, a list of
cases that are misrounded by the calculation in the branch for small
input values. In SKIP_ACCURATE_PASS, that list is omitted, trading off
accuracy for code size. But the check for -0 went with them. The fix is
to reinsert that in a `#else` clause, if the list isn't included.
[lldb] Member initialise hardware breakpoint structures (#197127)
These are delcared in NativeRegisterContextDBReg so we should zero-init
them there rather than have everyone memset them later.
ppc64le has its own equivalent that I've made the same change to.