Reapply "[clang] Fix sema on ObjCLifetime conversion (#178524)" (#180817)
Clang can't handle objc lifetime correctly when casting We reuse the
approach similar to lifetime: First remove it before the conversion,
then add it back.
Add a test
Fixes https://github.com/llvm/llvm-project/issues/177478
[lldb/Breakpoint] Fix condition hash after updating condition text (#181409)
StopCondition::SetText was computing the hash from the moved-from text
parameter instead of the stored m_text member. After std::move(text),
the source parameter becomes empty, causing the hash to always be
computed from an empty string.
This caused breakpoint condition updates to fail silently. When a user
modified a condition (e.g., from "x == y" to "x > y"), the hash remained
unchanged. Breakpoint locations use this hash to detect when conditions
need re-evaluation, so with a stale hash they would continue using
cached state for the old condition, triggering at incorrect locations.
The patch fixes this issue by computing the hash from m_text after the
move operation, ensuring it reflects the actual stored condition text.
It also adds API test that updates a breakpoint condition and verifies
the new condition is properly evaluated.
[2 lines not shown]
[GISel][RISCV] Simplify the generated code for narrowScalarCTLS. (#180827)
Instead of trying to make CTLS work for the Lo part, conditionally
invert Lo using the Hi sign bit, then do a CTLZ. If the CTLZ is
zero, then the Lo sign bit differs from the Hi sign bit. Otherwise,
each leading zero represents an additional sign bit.
This generates better code when CTLS and CTLZ are both supported.
I've added Zbb to the P extension command line for RISC-V since
P is likely to imply Zbb when it is ratified, but that isn't written
in the spec yet. If that doesn't happen, I expect CLZ would get
added back to the P extension.
[RISCV] In tryWideningMulAcc, check multiple users before checking operand 1. (#181321)
If both operands are WMUL, we should still consider the second one if
the first one has multiple users.
[mlir][xegpu] Add support for `vector.reduction` and `vector.multi_reduction` subgroup to work-item distribution. (#180308)
This PR adds support for lowering of `vector.reduction` and
`vector.multi_reduction` ops in subgroup to work-item distribution.
Following cases are considered currently (more support will be added
later):
* `vector.reduction` : This assumes the source vector is distributed to
all lanes and lanes must shuffle data to do a collaborative reduction.
result is shared among all lanes. This is done by emitting
`gpu::ShuffleOp` s and doing a butterfly reduction. Refer
`VectorDistribution` for more details.
* `vector.multi_reduction`: 2 cases are considered,
1. **Reduction is lane-local**: simply lower to a lane local multi
reduction op. each lane does its own reduction. result is distributed.
2. **Reduction is not lane-local:** This one is handled indirectly. In
this case, we rewrite the reduction in terms of `vector.reduction` ops
[2 lines not shown]
[Thread Analysis] Fix a bug in context update in alias-analysis (#178952)
[Thread Analysis] Fix a bug in context update in alias-analysis
Previously, in 'updateLocalVarMapCtx', context was updated to the one
immediately after the provided statement 'S'. It is incorrect,
because 'S' hasn't been processed at that point. This issue could
result in false positives. For example,
```
void f(Lock_t* F)
{
Lock_t* L = F; // 'L' aliases with 'F'
L->Lock(); // 'L' holds the lock
// Before the fix, the analyzer saw the definition of 'L' being cleared before 'L' was unlocked.
unlock(&L); // unlock (*L)
}
```
This commit fixes the issue.
rdar://169236809
[SystemZ][z/OS] Migrate most test case to use HLASM syntax (#181222)
This PR migrates all but two test cases to use HLASM syntax. It also
flips the default for the command line option, making HLASM output the
default.
The missing test cases requires some more support in the HLASM streamer,
which I will add separately.
[MLIR][Presburger] Fix full dimension check (#175422)
Currently, the code mistakenly thinks `(x): (1 >= 0)` as
non-full-dimensional.
The code determines full-dimensionality by testing whether an inequality
is flat, i.e. takes the same value regardless of variable assignments.
However, `1 >= 0` is obviously flat, and this case should be ignored
since it didn't involve any variables.
To remove these inequalities, we can call `removeTrivialRedundancy`.
[CIR][NFC] Fix try-catch-tmp.cpp test (#181402)
This test was failing due to its CI having been run before another
change was committed that added attributes to return values. This
removes unnecessary checks to make the test pass again.
workflows/commit-access-review: Use a GitHub App access token instead of llvmbot (#179364)
This replaces the use of an access token associated with the llvmbot
account with one that is generated by a GitHub App. This is slightly
better, because it eliminates the need to periodically rotate the
llvmbot tokens, which is difficult to do, since it requires sharing a
password and 2fa code among all the admins.
The tokens generated by the app automatically expire after an hour, and
the private key that is used to request it can be easily rotated by an
LLVM Organization owner. Also, since a single private key can be used to
generate many tokens, there is only one secret to rotate instead of
many.
Revert "workflows: Use main-branch-only environment when using ISSUE_SUBSCRIBER_TOKEN (#179990)" (#181352)
This reverts commit 31f31dd9d0460834f2ae67247d3886fec4931d6d.
This commit was causing PRs to be spammed with messages like:
"llvmbot temporarily deployed to main-branch-only — with GitHub Actions
Inactive"
This was causing confusion, and is not worth the marginal security
benefit. I also think this can be avoided by using called workflows, but
I still need to investigate this.
[libc++] Remove hardcoded -O3 from adjacent_view benchmark (#181376)
We don't hardcode optimization flags in the benchmarks, because we want
to be able to run the benchmarks with any optimization level. Instead,
we set the optimization level when running Lit via the --param
optimization=<speed|size|...> flag.
[CIR] Simplify try-catch handling (#180857)
With the new exception handling device, we no longer need to track the
location of potential catch blocks, and so we no longer need to
represent catch handlers on the EH stack. This allows us to
significantly simplify the generation of try-catch blocks.
This change emits catch blocks directly when visiting the try operation
and removes unnecessary EH management code.
This is not an exhaustive cleanup of the EH management code. Some things
that may appear to be obvious simplifications (such as removing the
union of bitfields in EHScope, and possibly making EHScopeStack just a
stack of EHCleanups) are deferred until we have a better idea of how
things like EH filters will be implemented.
This change breaks lowering of cir.try operations to LLVM IR in a
somewhat trivial way. Even before this PR, lowering of `cir.try` ops
with catch handlers was not implemented. However, we had one test case
[6 lines not shown]
[libc] Implement lit-based test execution for Libc (#178746)
This provides optional lit-based test execution for the LLVM Libc tests,
alongside the existing CMake-based test execution.
Usage:
ninja -C build check-libc-lit
cd build && bin/llvm-lit libc/test/src/
Partially addresses
[#118694](https://github.com/llvm/llvm-project/issues/118694). A future
PR once this lands will flip the default (per suggestion in the RFC)
[flang] Let FIR AA:getModRef recognize Fortran user procedures late. (#181295)
In order to use FIR AA::getModRef() after `ExternalNameConversion`
pass we have to teach it to recognize Fortran user procedures
that have already been renamed.
[Clang] eliminate -Winvalid-noreturn false positive after throw + unreachable try/catch blocks (#175443)
Fixes #174822
---
This PR fixes a false `-Winvalid-noreturn` positive when an
unconditional `throw` is followed by an unreachable `try`/`catch` block.
The false positive occurred because reachability analysis marked
`try`/`catch` regions as live even when unreachable via normal control
flow. The following logic
https://github.com/llvm/llvm-project/blob/1c0c9aeae681dbed90fcb19edd8a41e10a17f867/clang/lib/Sema/AnalysisBasedWarnings.cpp#L573-L589
that adjusted for missing `EH` call edges, treated disconnected `try` as
reachable.
[11 lines not shown]
[SPIRV] Extend lowering of variadic functions (#178980)
Variadic function lowering for SPIR-V was initially added in
https://github.com/llvm/llvm-project/pull/175076.
However, I tried a full OpenMP offloading example that includes a vararg
call and hit a few issues:
1) The OpenMP Deivce library function `ompx::printf` was incorrectly
being considered a builtin `printf` function that would be handled
specifically by the SPIR-V backend.
The fix here is to remove the `printf` special handling.
2) We were getting an assert in ModuleVerifier saying the LLVM lifetime
intrinsics were being called with an argument that was neither an
`alloca` ptr or `poison`. The problem is the `alloca` was replaced with
a SPIR-V intrinsic `alloca` in `SPIRVPrepareFunctions`, but the lifetime
intrinsic added in `ExpandVariadics` was not lowered to the SPIR-V
[14 lines not shown]
[Sema][NFC] simplify deduceOpenCLAddressSpace (#181253)
All callers of deduceOpenCLAddressSpace passed some sort of VarDecl
(such as a ParmVarDecl), so the dynamic cast and indentation was
unnecessary.
[NFC] [IndVars] test for multiple bounds for predicate-loop-traps
This can come from loops like
```
for (int i = 0; i < X; ++i) {
if (i < N)
__builtin_trap();
if (i < M)
__builtin_trap();
x[i] = y[i];
}
```
Reviewers: nikic
Reviewed By: nikic
Pull Request: https://github.com/llvm/llvm-project/pull/181264
[ADT] Add is_sorted_constexpr, equivalent to C++20 std::is_sorted (#180867)
`std::is_sorted` is not `constexpr` until Cpp20, so need custom `is_sorted_constexpr` function.
[CIR][docs] Add cir.catch_param to ClangIR cleanup and EH design doc (#181284)
This updates the ClangIR cleanup and exception handling design document
to describe the requirement to use cir.catch_param operations to begin
the catch regions of a cir.try operation in the structured form of CIR.
This also includes minor changes to the descriptions in the CIROps.td
definitions of cir.try and cir.catch_param