CodeGen: Maintain the dominator tree in MachinePipeliner
LiveIntervals computes live ranges using the dominator tree, but the
modulo schedule expanders change the CFG without updating
it. Intervals computed later in the pass therefore see a tree missing
the new prolog, kernel and epilog blocks. This is latent today, but
reachability. The unregistered blocks would be incorrectly treated as
unreachable.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[clang][CodeGen] Fix missing terminator when a new-expression initializer starts with a loop (#230902)
Fixes #175427
`EmitCXXNewExpr` marks the point where the operator delete cleanup
becomes active with a placeholder `unreachable` and erases it once the
initializer is emitted. If the initializer starts with a loop or a
label, `EmitBlock` takes that terminator as the end of the block and
emits no fall-through branch, so erasing the placeholder leaves the
block unterminated and valid code fails with "Broken module found".
The marker only has to be an instruction that the deactivation can
insert a store before, while the rest of CodeGen assumes the current
block has no terminator until a real one is written. The placeholder is
now the `i1` load from null that the other cleanup markers already use,
so the block stays open and `EmitBlock` branches normally. The same
marker in `EmitDelegateCallArg` is switched for consistency.
LLM tools were used for this contribution.
[VPlan] Replace first lane for single-scalars in replicateByVF. (#237472)
If DefR is a single scalar, all lanes are equal and all scalar users can
use lane 0.
This fixes a crash due when trying to match an extract from a
single-scalar.
Fixes https://github.com/llvm/llvm-project/issues/237456
[RISCV][P-ext] Add isel pattern for maccu.w01/maccu.w11 (#237122)
`maccu.w01` multiplies the zero-extended lower word of rs1 by the
zero-extended upper word of rs2 and adds the product to rd. `maccu.w11`
does the same with the zero-extended upper words of both. Both are
RV64 only.
Previously, (srl X, 32) was selected as a separate srli feeding
`maccu.w00`. Match it directly so the shift is folded. As with
`maccu.w00`, the patterns require the multiply to have a single use.
[Clang][OpenMP] Fix crash on failed type substitution in declare reduction/mapper (#230059)
Fixes #223366
`VisitOMPDeclareReductionDecl` passed the substituted reduction type to
`ActOnOpenMPDeclareReductionType` without checking it, so a failed
substitution (null type) hit `assert(ParsedType.isUsable())`.
`-fms-compatibility` is not needed: `typename T::type` with `T = int`
crashes too. `declare mapper` had the same bug.
Both visitors now return early when the substituted type is null. The
error is already reported by `SubstType`.
I used AI tools for assistance!
RuntimeLibcalls: Add signatures for more runtime functions
Add type missing signatures for assorted functions which were missing
type information.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
RuntimeLibcalls: Use the correct target C long width for Long
Long and ULong were mapped to the int width, which is wrong on LP64
targets (e.g. scalbln was declared taking i32 on x86_64 linux) and on
16-bit targets where long is 32 bits.
Also fix strtoul, strtoull, and the unsigned long operator new/delete
variants to use the unsigned types.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
RuntimeLibcalls: Add signext/zeroext attributes to libcall signatures
Try to match TargetLibraryInfo's behavior. Integer types narrower than
int are extended according to their signedness.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
rpki-client: sync wth libcrypto bytestring.h r1.11
Provide CBS_ASN1_IA5_STRING
This will soon be needed in rpki-client for: fileName in Manifest fileList,
cPSuri in certificate policy qualifiers and uniformResourceIdentifier in
GeneralName, to name a few.
Per X.680, section 41, table 8, the universal class number is 22 == 0x16.
The naming of the constant matches BoringSSL's.
bytestring: provide CBS_ASN1_IA5STRING
This will soon be needed in rpki-client for: fileName in Manifest fileList,
cPSuri in certificate policy qualifiers and uniformResourceIdentifier in
GeneralName, to name a few.
Per X.680, section 41, table 8, the universal class number is 22 == 0x16.
The naming of the constant matches BoringSSL's.
ok kenjiro
[clang][DepScan] Introduce API to find modulemaps without loading (#235845)
Introduce a way to batch look up the modulemap that defines each of a
set of module names.
`getModuleMapsForModules` builds a compiler instance from the same
command line as a by-name scan, then does every lookup in a separate
header search with lazy modulemap loading turned on and diagnostics
ignored.
* Modulemaps passed with `-fmodule-map-file` are parsed first, all other
modules are resolved by by-name header search.
The main use case is to let the Swift dependency scanner invalidate its
serialized dependency graph without the cost of loading the referenced
modules.
resolves clang side of: rdar://190131044
nc: do not treat tls_read() failures as fatal with -k
tls_read() can fail because the peer sends a malformed record. If -k is
given, treat the failure gracefully, warn, and allow the caller to free
the failed resources before accepting another connection.
Fixes a bug introduced in r1.203 (Feb 2019)
Simplified version of a diff by Acts1631
ok kenjiro
CodeGen: Maintain the dominator tree in MachinePipeliner
LiveIntervals computes live ranges using the dominator tree, but the
modulo schedule expanders change the CFG without updating
it. Intervals computed later in the pass therefore see a tree missing
the new prolog, kernel and epilog blocks. This is latent today, but
reachability. The unregistered blocks would be incorrectly treated as
unreachable.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[flang][Semantics] Check copy-out for each consequent-arg separately
CheckExplicitDataArg() runs once for each consequent-arg of a
conditional argument, but it decided whether copy-out is needed from the
whole argument. When the consequent-args differ in contiguity, the whole
argument needs a copy, so a contiguous VOLATILE consequent-arg got the
warning that a temporary copy is required, although passing it on its
own needs no copy.
When the whole argument needs copy-out, ask ActualArgNeedsCopy() again
for the consequent-arg being checked. The whole-argument answer, which
lowering also uses, is still checked first, so the tests for
ActualArgNeedsCopy() keep exercising it.
In ActualArgNeedsCopy(), add a TODO for the INTENT(IN) copy-out
suppression, which doesn't look into the consequent-args of a
conditional argument. Only lowering can observe that gap, and lowering
doesn't support conditional arguments yet.
[8 lines not shown]