[TTI][Inline] Define inlining behavior in SubtargetFeature (#205348)
This allows specifying the InliningBehavior as part of SubtargetFeature.
The behavior is one of InlineDefault, InlineInverse, and InlineIgnore.
* InlineDefault: A callee with this feature enabled cannot be inlined
into a caller without it enabled.
* InlineInverse: A callee without this feature enabled cannot be inlined
into a caller with it enabled.
* InlineIgnore: Arbitrary differences are allowed.
The default areInlineCompatible() implementation respects these now.
The intention behind this change is that it reduces the risk of
forgetting to update feature lists in TTI when adding a new feature,
e.g. when adding a new tuning flag that should be InlineIgnore.
Move X86 and AMDGPU ignored features, and the one inverse feature on
AArch64 to TableGen.
[2 lines not shown]
[clang-tidy] Guard `readability-identifier-naming` recursion in dependent base lookup (#204913)
Prevent `readability-identifier-naming` from recursing indefinitely in
dependent base lookup when AggressiveDependentMemberLookup` is enabled.
In #204790, `findDeclInBases()` maps a dependent template base back to
the primary template, creating a recursive cycle that crashes
clang-tidy. Add a recursion guard to stop the crash. A more complete fix
could be explored separately.
Add a regression test covering the dependent base cycle reproducer.
Closes https://github.com/llvm/llvm-project/issues/204790.
---------
Co-authored-by: EugeneZelenko <eugene.zelenko at gmail.com>
[libc++] Add implementations of `__get_locale_encoding(...)` to Fuschia and LLVM-Libc (#205716)
- These were missed in #141312 and consequently broke the Fuschia and
AMDGPU llvm-libc build bots.
- Fuschia seems to have support for `nl_langinfo_l(...)`, so we can use
that.
- However, LLVM-libc does not implement it, so for now we can do a dummy
implementation and mark `environment()` and `encoding()` as unsupported
on LLVM libc.
clang/AMDGPU: Simplify cpu name checks for __builtin_amdgcn_is_processor (#205724)
Instead of trying to figure out which TargetInfo to use, skip it and
directly use the source of truth from TargetParser. This avoids
regressions in future commits where isValidCPUName will be
conditionally filtered.
[RISCV][Zicfilp] Emit .note.gnu.property section for Zicfilp CFI unlabeled scheme (#141468)
RISC-V Zicfilp-based CFI needs to let the linker/loader know if the
binary is built with the mechanism enabled to support proper
link-time/load-time management of this feature. The information is
encoded as a bit in the `.note.gnu.property` section. This patch
implements emitting the section for RISC-V targets when Zicfilp-based
CFI with the "unlabeled" label scheme is enabled.
When Clang receives the `-fcf-protection=branch` flag, which enables
forward-edge CFI protection, it adds the `cf-protection-branch`
attribute to the LLVM module. Additionally, if a branch label scheme is
needed, another attribute (`cf-branch-label-scheme`) is added to
indicate it. For RISC-V targets, the `cf-protection-branch` attribute
indicates the adoption of Zicfilp-based forward-edge CFI protection, and
the `cf-branch-label-scheme` attribute selects how the "label" operands
of the Zicfilp `lpad` insns are produced. This patch emits the proper
`.note.gnu.property` feature bit when the RISC-V backend sees that the
LLVM module has the `cf-protection-branch` attribute set to `1`, and the
[6 lines not shown]
[libc++] Enable clang-tidy in the CI again (#195047)
clang-tidy currently doesn't run in the CI because CMake doesn't find
the appropriate `ClangConfig.cmake` anymore. This adds the path so
clang-tidy is built again and fixes most issues. Some things are
disabled for now to get most checks back. They will be re-enabled later.
[AArch64] Correct latency calculation in runSVEPseudoTestForCPU test. NFC (#205100)
It does not look like this caused problems in the pseudo scheduling
tests, but is accumulating the wrong latency. I added extra checks that
the NumWriteLatencyEntries were the same in both cases whilst I was here
too.
clang: Move __builtin_amdgcn_processor_is diagnostic test to sema
This wasn't checking the codegen result, so move it to the right place
and use -verify instead of FileChecking stderr.
Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
[clang][bytecode] Pass AccessKinds to Check{Constant,Mutable} (#205720)
So we can pass them on do `diagnoseNonConstVariable`.
This doesn't make a difference right now but is needed for a future
commit.
[Flang][Driver]Add support for option '-fpseudo-probe-for-profiling' in flang (#205046)
Added support for option `-fpseudo-probe-for-profiling` in flang.
- When the option `-fpseudo-probe-for-profiling` is passed, the compiler
sets the` PseudoProbeForProfiling` flag and triggers the
`SampleProfileProbePass`. This pass inserts `llvm.pseudoprobe(..)`
intrinsic calls and `!llvm.pseudo_probe_desc` metadata into the IR.
[flang][OpenMP] Fix declare reduction lookup for USE...ONLY imports
CheckSymbolSupportsType walked every module in the global scope to find
declare-reduction declarations. That accepted reductions from modules
that were never USE'd, or were excluded via USE...ONLY, and it still
rejected some valid imports such as a renamed operator.
Replace the global scan with FindUserReduction(), which resolves the
reduction the way name resolution resolves the operator. It checks a
directly visible reduction first, then follows the operator's USE
associations and merged-generic sources to the declaring modules,
re-deriving the source module's mangled name for renamed operators. The
search recurses through re-exporting (facade) modules and is type-aware,
so an operator that carries reductions for several types resolves to the
one supporting the requested type. A locally declared reduction is
authoritative and shadows reductions reachable through the operator.
Consolidate the duplicated GetReductionFortranId() (formerly static in
both resolve-names.cpp and mod-file.cpp) into a shared utility, fixing a
[11 lines not shown]
clang/AMDGPU: Simplify cpu name checks for __builtin_amdgcn_is_processor
Instead of trying to figure out which TargetInfo to use, skip it and
directly use the source of truth from TargetParser. This avoids regressions
in future commits where isValidCPUName will be conditionally filtered.
[NewPM][AArch64] Port AArch64SRLTDefineSuperRegs pass to NewPassManager (#202803)
Standard port for the AArch64SRLTDefineSuperRegs pass.
Assisted by Gemini
[WebAssembly] Represent reference types as TargetExtType (#203165)
Originally #71540 by Paolo Matos, I picked it up and finished it.
Resolves https://github.com/llvm/llvm-project/issues/69894.
Model WebAssembly externref and funcref as target("wasm.externref") /
target("wasm.funcref") TargetExtTypes instead of pointers in
non-integral address spaces 10 and 20.
The entire WebAssemblyLowerRefTypesIntPtrConv can be removed.
This breaks the GlobalISel handling for reference types, I just disabled
GlobalISel handling for functions that use them.
I added intrinsics for `wasm.ptr.to_funcref` and `wasm.funcref.to_ptr`.
ptr.to_funcref does a table.get from the indirect function pointer
table. As a special case, 0 is converted to the null funcref rather than
doing table.get on 0. `wasm.funcref.to_ptr` is only handled when we call
it immediately, otherwise it will fail to lower. We could dynamically
[13 lines not shown]
[clang-doc] Test more language constructs (#205585)
We're missing several different language constructs in our tests. This
patch simply adds the basic tests and captures the output without trying
to fix or adjust any behavior, and can be considered a sort of precommit
test for future fixes to the various documentation components.
[clang][bytecode] Ignore indeterminate APValues (#205555)
They don't produce a value and for us, that means we just need to ignore
them and not initialize anything.
[flang][cuda] Accept cuf kernel do without scalar (#205705)
The base compiler accept `!$cuf kernel do()` instead of raising an
error. Update the parser to accept the same syntax.
`!$cuf kernel do()` is equivalent to `!$cuf kernel do`
[AArch64] Add missing SubtargetFeature for hip12 core (#205246)
The initial patch for the hip12 core had omitted several subtarget
features:
FeatureFP16FML, FeatureFlagM, FeaturePredRes, FeatureSB, FeatureSSBS,
FeatureCCIDX, FeatureRandGen.