[flang][OpenMP] Support user-defined declare reduction with derived types (#190288)
Fix lowering of `!$omp declare reduction` for intrinsic operators
applied
to user-defined derived types (e.g., `+` on `type(t)`). Previously, this
hit a TODO in `ReductionProcessor::getReductionInitValue` because the
code
tried to compute an init value for a non-predefined type, when it should
instead use the initializer region from the `DeclareReductionOp`.
This fixes the issue #176278: [Flang][OpenMP] Compilation error when
type-list in declare reduction directive is derived type name.
The root cause was a naming mismatch: `genOMP` for
`OpenMPDeclareReductionConstruct` used a raw operator string (e.g.,
"Add")
as the reduction name, while `processReductionArguments` at the use site
computed a canonical name via `getReductionName` (e.g.,
"add_reduction_byref_rec__QFTt"). The `lookupSymbol` in
[76 lines not shown]
[CIR] Fix lowering of strings in constant array attributes (#193553)
There was code in the CIR CXXABILowering pass that was assuming
ConstArrayAttr::getElts() would return an ArrayAttr. This isn't true in
the case of string constants with trailing zeros, so we had a crash in a
mlir::cast<> call. The problem only appeared when a string array
appeared in the same initializer as a type that required CXXABI-specific
lowering, such as a member pointer.
This change fixes the CXXABILowering to simply keep the existing string
attribute, which is known to be legal for the purposes of that pass.
Assisted-by: Cursor / claude-4.7-opus-high
[LangRef] inline asm: the instructions are treated opaquely (#157080)
This wasn't true until recently, but
https://github.com/llvm/llvm-project/issues/156571 got fixed to make it
true.
I was not entirely sure where to put this; for now I made it a new
paragraph fairly early on in the inline asm docs.
IR: Allow !fpmath metadata on homogeneous float structs (#193537)
This matches the logic for fast math flags / nofpclass, and allows
marking llvm.sincos calls with !fpmath.
[SLP]Fix scheduling of copyable bundle with commutative op used outside parent PHI
The previous (V, Op) pair insert was a no-op since V is unique per iteration.
Replace it with a hasOneUse() fast path plus a check that bails only when I
has a user outside the grandparent PHI's Scalars. Uses within the same
vectorized PHI are tracked by the existing dep machinery; an external user
(e.g. a scalar PHI in a different block) is what trips scheduleBlock's
"must be scheduled at this point" assertion.
Fixes #193315.
Reviewers:
Pull Request: https://github.com/llvm/llvm-project/pull/193566
[CIR] Support guard COMDAT for weak linkage in LoweringPrepare (#193274)
Static locals inside inline functions get `linkonce_odr` linkage, and
their guard variables need their own COMDAT groups so the linker can
deduplicate them across TUs. We were hitting an NYI error for this case
in `LoweringPrepare`.
The fix is straightforward: set `guard.setComdat(true)`, which makes
`LowerToLLVM` create a per-symbol COMDAT selector — the same thing
classic codegen does at `ItaniumCXXABI.cpp:2798`.
I ran into this while trying to compile the Bullet physics engine
through CIR. Functions like `btMatrix3x3::getIdentity()` use this
pattern (return a reference to a function-local static from an inline
member function), and 6 of the 121 source files were failing because of
it. With this fix, all 121 compile cleanly.
Made with [Cursor](https://cursor.com)
Reland: [MemProf] Dump inline call stacks as optimization remarks (#193545)
This iteration limits the test case to x86_64-linux to prevent bot
failures.
---
This patch teaches the MemProf matching pass to dump inline call
stacks as analysis remarks like so:
frame: 704e4117e6a62739 main:10:5
frame: 273929e54b9f1234 foo:2:12
inline call stack: 704e4117e6a62739,273929e54b9f1234
The output consists of two types of remarks:
- "frame": Acts as a dictionary mapping a unique MD5-based FrameID
to source information (function name, line offset, and column).
[5 lines not shown]
Revert "[clang] fix matching constrained out-of-line definitions of class specialization member function templates" (#193558)
Reverts llvm/llvm-project#192806 , which is causing the compiler to
reject some valid code.
Loosen check for clang version string in test to work when setting CLANG_VENDOR. (#192961)
We are trying to update our buildbot to use the `-DCLANG_VENDOR` and
`-DCLANG_VENDOR_UTI` options, but need to fix some tests first. This is
one of them.
---------
Co-authored-by: Jannick Kremer <jannick.kremer at mailbox.org>
Co-authored-by: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
IR: Allow !fpmath metadata on homogeneous float structs
This matches the logic for fast math flags / nofpclass, and allows
marking llvm.sincos calls with !fpmath.
[GlobalISel] Change SSUBO to do (LHS < RHS) XOR (RESULT < 0) (#191744)
Refactor lowerSADDO_SSUBO in LegalizerHelper so addition and subtraction
use separate, clearly named paths.
SADDO: unchanged meaning: overflow when (result < LHS) disagrees with
(RHS < 0) (signed compares).
SSUBO: use the equivalent formulation: overflow when (LHS < RHS)
disagrees with (result < 0) instead of (result < LHS) vs (RHS > 0).
[libc] Replace check-libc with lit-based test execution (#184163)
Now that check-libc-lit has been validated alongside check-libc, make
lit the default test runner by renaming check-libc-lit to check-libc.
Remove the old CMake-driven check-libc custom target.
[VPlan] Use MaxRuntimeStep in materializeVectorTC to simplify middle br. (#193067)
For scalable vectors, pass the maximum runtime step to
materializeVectorTripCount. Use it to simplify the vector trip count to
the original trip count directly, if MaxRuntimeSteps divides the
original trip count without remainder.
In those cases, all lower power-of-2 vscales will divide the rip count
without remainder.
PR: https://github.com/llvm/llvm-project/pull/193067
[compiler-rt] [Darwin] Enable arm64e tests on macOS (#193391)
This enables compiler-rt tests on Darwin arm64e (when supported by the
linker).
Note that arm64e is not enabled for sanitizers yet, but this does add
test coverage for builtins.
rdar://175303507
[NFC][MachineBlockHashInfo] Add static asserts to guard agains hash_16_bytes changes (#192862)
`hashing::detail::hash_16_bytes` is not guaranteed to be stable across
different versions of LLVM, it can change any time.
We put asserts here, so if it changed, author don't forget to work
around them here.
Revert "[SelectionDAG] Salvage debuginfo when combining load and z|s ext instrs. (#188544)" (#193554)
This reverts commit fe5d5b762ab3b92b18b56f413965abb81a459ac6.
Reverted because of https://github.com/llvm/llvm-project/issues/193475
clang crashes on valid code at -O{2,3} on x86_64-linux-gnu: Assertion
`N->getOpcode() != ISD::DELETED_NODE && "DELETED_NODE in CSEMap!"'
failed
[lldb] Scope symbol lookups to specific modules in ObjC/SystemRuntime plugins (#193379)
This narrows `FindSymbolsWithNameAndType` calls from searching all
loaded images to the specific module that owns the symbol (Foundation,
CoreFoundation, libBacktraceRecording.dylib).
The arclite fallback in `CalculateHasNewLiteralsAndIndexing` still
searches all images because libarclite is a static library linked into
the main executable.
[Runtimes] Allow HandleLibc.cmake to be called multiple times (#193540)
Summary:
This needs to check to see if it's already been called now that we want
to use it more places than just libcxx.
[LegalizeTypes][DAG] Use SHL(X,1) instead of ADD(X,X) for variable vector indices for extraction/insertion legalization (#188277)
Avoid ADD(X,X) as it doesn't correctly handle undef elements and helps avoid some FREEZE() fold headaches
Resurrects #86857
[lldb] Decorate tests that use threading (#193117)
Add a new decorator `skipIfTargetDoesNotSupportThreads` to skip tests
that use threading. This is motivated by running the test suite
targeting WebAssembly, where `wasip1` does not support threads. There
are variants that do support threading (e.g. `wasip1-threading`) that
the current implementation accounts for.
[libc][NFC] Fix minor RPC warnings (#192997)
Summary:
Fix some warnings that show up with strict warnings set, reduces noise
when used as a header onyl library in projects.