[clang-repl] Unlink the withdrawn partial translation unit on Undo (#213235)
`Interpreter::Undo()` cleared name lookup for a withdrawn input but left its `TranslationUnitDecl` in the redeclaration chain, so walking the chain still reached declarations the user had removed. `ASTContext::TUDecl` also still pointed at the withdrawn unit, so the next input chained onto it.
`IncrementalParser::CleanUpPTU` now rebuilds the redeclaration chain without the withdrawn unit and makes its predecessor current again, the way cling's `removeRedeclFromChain` does. This needs no new AST API — `Redeclarable` and `ASTContext` already declare `friend class IncrementalParser`. The declarations stay bump-allocated in the `ASTContext`; they just stop being reachable, which is what the removed `// FIXME: We should de-allocate MostRecentTU` asked for.
`CleanUpPTU` also runs on the parse-failure path, so a failed input no longer leaves its unit in the chain either.
Fixes #213230.
---------
Co-authored-by: Emery Conrad <emery.conrad at chicagotrading.com>
[lldb] Keep address operation values address-sized (#216661)
`DW_OP_addr`, `DW_OP_addrx`, and `DW_OP_GNU_addr_index` currently push
`Scalar` values constructed from 64-bit C++ types. On 32-bit targets,
subsequent generic arithmetic therefore retains a 64-bit width instead
of wrapping at the target address size.
Use the evaluator's existing `to_generic` conversion when pushing these
address values. This keeps the scalar at the target address width
without changing operand decoding or public APIs.
Add unit coverage for direct and indexed address operations that checks
both 32-bit wraparound and the resulting APSInt width.
Fixes #210972
[SCEV] Introduce getOrCreateUDivExpr (NFC) (#216832)
Avoid error-prone munging SCEVUses in place in getUDivExpr, and allocate
the operands uniformly in a new getOrCreateUDivExpr.
[IVDescriptors] Implement MonotonicDescriptor
RFC link: https://discourse.llvm.org/t/rfc-loop-vectorization-of-compress-store-expand-load-patterns/86442
"Monotonic" variable is similar to induction variable, but its value is updated under some condition, e.g.:
```
int idx = 0;
for(int i = 0; i < n; ++i) {
// some uses of idx
if (cond)
++idx;
}
```
In this example, `i` is induction variable and `idx` is monotonic variable: it's updated only when cond == true. In LLVM IR, this looks like:
```
loop_header:
%monotonic_phi = [%start, %prehader], [ %chain_phi0, %latch]
step_bb:
[26 lines not shown]