[DA] Delete early return in accumulateCoefficientsGCD (NFCI) (#197935)
This patch resolved one TODO comment in `accumulateCoefficientsGCD`
regarding an early return. I think this early return doesn't change the
final result because:
- The presence/absence of this early return can only affect whether
`CurLoopCoeff` is set.
- Regardless the value of `CurLoopCoeff`, if `RunningGCD` equals 1, the
result of caller side while loop doesn't change.
Deleting this early return is somewhat beneficial, because it allows us
to merge `analyzeCoefficientsForGCD` into this function.
[MemoryBuiltins][NFC] Allow users to retrieve detailed (de)allocation info
There are some helpers to inspect a value or call but not all
information about the (de)allocation are made available outside of
MemoryBuiltins.cpp. The two new functions allow users a more in-depth
view of (de)allocations through a single API. To help with this, we now
read the alloc_align attribute to provide better alignment information
to users. alloc-family is used as well. Two new helpers provide argument
numbers, rather than values.
[MemoryBuiltins] Consistently infer and use MallocFamily
MallocFamily (the enum and StringRef) are used alongside AllocFnsTy.
The latter is picked up from the tables while the former is encoded in
the IR. While they should be merged at some point (see TODO), this
commit makes sure we consistently initialize the MallocFamily String and
pass it to users.
[MemoryBuiltins][NFC] Allow users to retrieve detailed (de)allocation info
There are some helpers to inspect a value or call but not all
information about the (de)allocation are made available outside of
MemoryBuiltins.cpp. The two new functions allow users a more in-depth
view of (de)allocations through a single API. To help with this, we now
read the alloc_align attribute to provide better alignment information
to users. alloc-family is used as well. Two new helpers provide argument
numbers, rather than values.
[clang-tidy] Fix crash in misc-static-initialization-cycle (#198155)
This commit fixes `misc-static-initialization-cycle` crashing on `catch
(...)`.
Catch-all handlers have no exception declaration, so traversal of
`CXXCatchStmt` can call `TraverseDecl(nullptr)`. The check previously
passed that null pointer to `DeclContext::containsDecl`. This commit
fixes the problem by adding a null guard.
Closes #198150
[compiler-rt] Fix StackDepot benchmark thread barrier (#197633)
Use Param.Threads (number of worker threads) as barrier threshold
instead of Param.UniqueThreads (boolean that controls input generation).
This also silences
[-Wbool-integral-comparison](https://github.com/llvm/llvm-project/pull/194180)
warning I'm working on.
[LV] Move isMoreProfitable to LoopVectorizationPlanner.cpp (NFC). (#195269)
isMoreProfitable does not depend on anything in LoopVectorize.cpp, move
it to the recently added LoopVectorizationPlanner.cpp.
PR: https://github.com/llvm/llvm-project/pull/195269
Add clang warning if fp exception functions are called without appropriate flags/pragmas (#187860)
Fixes https://github.com/llvm/llvm-project/issues/128239
The implementation adds warnings for floating-point exception function
calls (fenv.h) made without enabling floating-point exception behavior
via `-ffp-exception-behavior=maytrap/strict` or `#pragma STDC
FENV_ACCESS ON`. To support recognition of all fenv.h builtins,
`fexcept_t` and `fenv_t` were added as builtin types.
[VPlan] Use ResumeForEpilogue to get epilogue vector trip count (NFC). (#198210)
Use ResumeForEpilogue to look up the vector trip count instead of plain
IR lookup. Also prepares for non-phi resume values.
[LV] Extract helper to simplify phi removal in connectEpiVectorL (NFC) (#198203)
Extract the repeated edge-redirect + DomTree update pattern into a
RedirectEdge lambda, and convert the separate removeIncomingValue calls
for check blocks into a loop.
[JTS] Readd assertion
Now that VP metadata has been cleaned up a little bit, we can reenable
this assertion.
Reviewers: alexander-shaposhnikov, mtrofin
Pull Request: https://github.com/llvm/llvm-project/pull/198141
[InstCombine] Convert logical and/or with trunc nuw to i1 into bitwise ops (#198178)
if it is know that `trunc nuw to i1 ` can not be poison logical and/or
can be folded to bitwise ops.
proof https://alive2.llvm.org/ce/z/xQ2Sj-
[libc++] Require the exact assignment expression to be trivial in __uninitialized_allocator_copy_impl
__uninitialized_allocator_copy_impl has an optimization that replaces allocator_traits::construct with std::copy for raw pointer ranges when the element type is trivially copy constructible and trivially copy assignable.
The copy-assignment trait only checks whether assignment from const T& is trivial. That is weaker than the expression used by std::copy, which evaluates *out = *in. If overload resolution selects a different non-trivial assignment operator for that expression, std::copy can call that operator on uninitialized storage.
Check is_trivially_assignable<_Out&, _In&> instead in both header copies. This matches the assignment expression used by std::copy, preserves the optimized path when that assignment is actually trivial, and avoids making non-const raw pointer callers select the generic allocator_traits::construct overload due to a qualification conversion.
Add a vector copy-constructor regression test with a type whose defaulted copy assignment is trivial but whose templated assignment operator is selected for non-const lvalue sources.
Tested with:
build-libcxx-fresh/bin/llvm-lit -q libcxx/test/std/containers/sequences/vector/vector.cons/copy.pass.cpp libcxx/test/libcxx/memory/uninitialized_allocator_copy.pass.cpp
build-libcxx-fresh/bin/llvm-lit -q --param std=c++03 libcxx/test/libcxx/memory/uninitialized_allocator_copy.pass.cpp
build-libcxx-fresh/bin/llvm-lit -q --param std=c++20 libcxx/test/std/containers/sequences/vector/vector.cons/copy.pass.cpp
build-libcxx-fresh/bin/llvm-lit -q --param std=c++11 libcxx/test/std/containers/sequences/vector/vector.cons/copy.pass.cpp
[sanitizer][test] Fix coverage-module-unloaded.cpp etc. on Solaris (#198164)
When switching `clang++` to the default Solaris 11.4 compilation
environment, XPG7 + extensions, two tests `FAIL`:
```
AddressSanitizer-i386-sunos :: TestCases/Posix/coverage-module-unloaded.cpp
AddressSanitizer-i386-sunos-dynamic :: TestCases/Posix/coverage-module-unloaded.cpp
SanitizerCommon-asan-i386-SunOS :: get_module_and_offset_for_pc.cpp
SanitizerCommon-ubsan-i386-SunOS :: get_module_and_offset_for_pc.cpp
SanitizerCommon-ubsan-x86_64-SunOS :: get_module_and_offset_for_pc.cpp
```
The failure mode is the same in both cases: the tests fail to link with
`main` undefined. This happens because `<sys/mman.h>` defines
```
#define SHARED 0x10
[13 lines not shown]
[mlir][SPIR-V] Fix math.powf lowering for non-integer exponents (#197727)
The ConvertFToS usage only works when y is an integer. Use it only for
integer constants, for others: lower as GL.Exp(y * GL.Log(x))
[AArch64] Fix handling of x29/x30 in inline assembly clobbers (#167783)
The AArch64 backend was silently ignoring inline assembly clobbers when
numeric register names (x29, x30) were used instead of their
architectural aliases (fp, lr). I found this bug via inline assembly
in Zig, which not normalize the register names the way clang does.
There is an incoplete workaround for this in Rust, but that only
handles `x30/lr`, not `x29/fp`. I thought it would make
sense to fix this properly rather than adding a workaround to Zig.
This patch adds explicit handling in getRegForInlineAsmConstraint() to
map both numeric and alias forms to the correct physical registers,
following the same pattern used by the RISC-V backend.
I've left `x31/sp` without changes, it would nice to have to have
warning when trying to clobber `x31`, just like there is for `sp`,
but that register needs different handling, so it's best done
separately.
[24 lines not shown]