[SCEV][IndVars][NFC] Add tests for x >=s 0 from x <u y with swapped operands
Let n be the bit width of x and y. If x <u y and y <=u 2^(n-1), then
x >=s 0. SCEV can't prove this yet when the operands of the compare to
prove are in the opposite order to the guard, e.g. 0 <=s x with
x <u y known.
Add tests for it.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[SCEV] Derive x >=s 0 from x <u y and y <=u 2^(n-1)
Let n be the bit width of x and y. If x <u y and y <=u 2^(n-1), then
x <u 2^(n-1), so x >=s 0. Here y <=u 2^(n-1) means y >=s 0 or
y == INT_MIN. In the same way, if x <=u y and y <u 2^(n-1), then
x >=s 0.
This lets a guard like x <u len prove x >=s 0 when len is non-negative.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[SCEV][IndVars][NFC] Add tests for x >=s 0 from x <u y and y <=u 2^(n-1)
Let n be the bit width of x and y. If x <u y and y <=u 2^(n-1), then
x >=s 0. SCEV can't prove this yet.
Add tests for it.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[SCEV][NFC] Factor isImpliedCondViaSignFlippedPred out of isImpliedCondBalancedTypes
Move the code that proves a condition from a found condition with the
other signedness into a new private function.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[SCEV][IndVars][NFC] Add tests for implied conditions with different signedness
SCEV can prove some signed conditions from unsigned ones and the other
way around. For example, it proves a <s b from a <u b and b >=s 0. But
it fails when the operands are in the opposite order, like b >s a.
Add tests for this.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[SCEV] Prove signed/unsigned implications in either operand order
SCEV could prove these implications only with the operands in the same
order:
- If a <u b and a, b have the same sign, then a <s b.
- If a <s b and a, b have the same sign, then a <u b.
- If a <u b and b >=s 0, then a <s b.
- If a <s b and b <s 0, then a <u b.
For example, it proved a <s b from a <u b and b >=s 0, but not b >s a.
Now it proves them in either order.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[SCEV] Try other implications when sign-flipped ones fail (#234594)
SCEV's `isImpliedCondBalancedTypes` tries to prove an implication
through several rules. There are rules for when a predicate to prove is
sign-flipped from the found predicate, and also there are other rules,
which, for example, try to prove the implication through ranges.
Before, if a proof for a sign-flipped rule implication returned false,
we wouldn't check other rules and just bail out with false result too.
Now make those rules fall-through - if one rule couldn't be proven, try
other rules in the function.
An example query is `x - 5 <s 5` with `x <u 10` known. The implication
`a <u b and b >=s 0 --> a <s b` matches it, but `x - 5 <u 5` with `x <u
10` known does not hold (e.g. `x = 0`), so SCEV gave up.
Now it goes on to trying to prove the query from ranges. `x <u 10` gives
`x` in `[0, 10)`, so `x - 5` is in `[-5, 5)`, and `x - 5 <s 5` holds.
Assisted-by: Claude
[CIR] Implement FlattenCFG for coroutine AwaitOp, CoroBodyOp, and CoReturnOp (#203802)
This PR implements the `FlattenCFG` pass for coroutine operations:
`cir.await`, `cir.coro.body`, and `cir.co_return`.
First, we introduce a new function attribute, `flatten_coroutine`. This
is necessary because the existing `coroutine` attribute verifies the
presence of coroutine operations such as `cir.await` and
`cir.coro.body`. After `FlattenCFG` runs, these operations are
eliminated, so the original attribute can no longer be used. The new
attribute is preserved after flattening and is later used during LLVM
lowering to emit the `presplitcoroutine` function attribute.
We also introduce a new alloca attribute, `coroutine_suspend_point`.
This attribute marks an alloca whose **use** represents the coroutine
suspension destination. Currently, the only supported suspension
destination is the return block. In the future, this mechanism can be
extended to support additional destinations such as the GRO path.
[27 lines not shown]
[lldb] Publish the attaching state when attaching to a connected process (#234059)
A process that was connected before the attach (process connect, then
process attach --waitfor) already has a private state thread, so
StartPrivateStateThread ignores the eStateAttaching it is given and the
public state stays connected. The private state thread only forwards an
interrupt to a process that is attaching, so a wait-for attach on such a
process could not be cancelled.
Publish the state in Process::Attach when the thread was already
running.
Assisted-by: Claude (on the test side)
[TableGen] Fix a strict weak ordering bug (#229955)
This is similar to #197071 in that it fixes the same strict weak
ordering check that arises with another sequence.
Before this patch, `InstructionMatcher::isHigherPriorityThan(...)` may
produce a cycle. Given:
```
| Instruction | Predicates | Operands |
|=============|============|==========|
| A | 3, 1 | 3 |
| B | 3 | 2 |
| C | 3, 2 | 1 |
```
* A beats B because we zip through predicates, determine that `3 == 3`
while ignoring the second predicate of A, so we check operands. 3 > 2 so
A beats B.
[5 lines not shown]
[CIR] Add inbounds and nuw flags to cir.get_element
CIR lowered array subscripts to a getelementptr with no no-wrap flags,
where classic codegen marks them inbounds, and also nuw when the index
is unsigned.
cir.get_element now has optional inbounds and nuw flags, and CIRGen sets
them where classic does: inbounds unless -fwrapv-pointer is given, nuw
for an unsigned index expression, and no inbounds for an OpenMP device
subscript of an array of arrays whose base is not an alloca. The flags
live on the op because both depend on language options and on the C
index type, which the lowering cannot see. LowerToLLVM maps them to the
GEP's no-wrap flags.
Assisted-by: Cursor / Claude Opus 5.5
[libc++] Download the series of a machine a few tests at a time
Downloading the whole series of a machine in a single request currently makes
LNT time out (it answers 503 after about 3 minutes), since the response is over
500 MB of uncompressed data.
Until that is fixed on the LNT side, download the series 50 tests at a time,
which keeps every request fast and its URL below the ~8 KB that LNT accepts.
Locally, this downloads the whole series of a machine in about 100 seconds.
Assisted by Claude
[SCEV][IndVars][NFC] Add tests for x >=s 0 from x <u y and y <=u 2^(n-1)
Let n be the bit width of x and y. If x <u y and y <=u 2^(n-1), then
x >=s 0. SCEV can't prove this yet.
Add tests for it.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[SCEV] Derive x >=s 0 from x <u y and y <=u 2^(n-1)
Let n be the bit width of x and y. If x <u y and y <=u 2^(n-1), then
x <u 2^(n-1), so x >=s 0. Here y <=u 2^(n-1) means y >=s 0 or
y == INT_MIN. In the same way, if x <=u y and y <u 2^(n-1), then
x >=s 0.
This lets a guard like x <u len prove x >=s 0 when len is non-negative.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[SCEV][IndVars][NFC] Add tests for x >=s 0 from x <u y with swapped operands
Let n be the bit width of x and y. If x <u y and y <=u 2^(n-1), then
x >=s 0. SCEV can't prove this yet when the operands of the compare to
prove are in the opposite order to the guard, e.g. 0 <=s x with
x <u y known.
Add tests for it.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[SCEV] Prove signed/unsigned implications in either operand order
SCEV could prove these implications only with the operands in the same
order:
- If a <u b and a, b have the same sign, then a <s b.
- If a <s b and a, b have the same sign, then a <u b.
- If a <u b and b >=s 0, then a <s b.
- If a <s b and b <s 0, then a <u b.
For example, it proved a <s b from a <u b and b >=s 0, but not b >s a.
Now it proves them in either order.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[SCEV] Try other implications when sign-flipped ones fail
SCEV's isImpliedCondBalancedTypes tries to prove an implication
through several rules. There are rules for when a predicate to prove
is sign-flipped from the found predicate, and also there are other
rules, which, for example, try to prove the implication through
ranges.
Before, if a proof for a sign-flipped rule implication returned false,
we wouldn't check other rules and just bail out with false result too.
Now make those rules fall-through - if one rule couldn't be proven,
try other rules in the function.
An example query is x - 5 <s 5 with x <u 10 known.
The implication "a <u b and b >=s 0 --> a <s b" matches it,
but x - 5 <u 5 with x <u 10 known does not hold (e.g. x = 0),
so SCEV gave up.
[5 lines not shown]