[SystemZ][Clang] Mark clang failures for z/OS for TLS lit tests (#238354)
Mark the TLS related tests as a unsupported on z/OS (mostly by #if-ing
out the code). In addition, the current versions of z/OS have limited
support for TLS.
The support for TLS on z/OS 3.1/3.2 is limited to compile time
expressions for initialization. Eventually ctors/dtors and runtime
expressions for initializers will be supported. Until then update the
tests so the non-TLS parts are run.
[clang] Avoid a redundant missing attribute diagnostic after a nested pragma
The preceding change rejects nested pragmas during preprocessing.
Skipping a nested pragma can leave its enclosing pragma with an empty
argument list and lead to a secondary diagnostic.
For `#pragma clang attribute`, omit the missing attribute diagnostic
when rejecting a nested pragma left the argument list empty. Continue
diagnosing an ordinary empty argument list.
``` cc
#pragma clang attribute (_Pragma("clang attribute push"))
```
The preceding change reports both errors.
```text
attribute.cc:1:26: error: nested pragma is not allowed
attribute.cc:1:57: error: expected an attribute after '('
[10 lines not shown]
[clang][lex] Reject nested pragmas during preprocessing
Executing a nested pragma while reading the enclosing pragma's arguments
can inject annotation tokens where ordinary tokens are expected.
Track when a pragma is active so the preprocessor can diagnose and skip
nested pragmas. Expand deferred pragma arguments while the pragma is
active and disable macro expansion when replaying those tokens.
For example:
``` cc
#pragma clang attribute (_Pragma("clang attribute push"))
```
Clang emits:
```text
attribute.cc:1:26: error: nested pragma is not allowed
[5 lines not shown]
[BOLT][DWARF] Fix directory and MD5 of files added from another CU (#246126)
When BOLT inlines a function from a different CU, the inlined
instructions carry the callee's line info, which refers to files in the
callee's line table. Since BOLT writes these rows into the caller's line
table, `addDebugFilenameToUnit()` adds the callee's file to the caller's
line table, so that the rows can refer to it.
With DWARF 5 line tables, though, the added file comes out wrong in two
ways:
- It gets the wrong directory. In DWARF 5, directory indices start at 0
(directory #0 is the compilation directory), but
`addDebugFilenameToUnit()` assumes they start at 1 like in DWARF 4. So
for any file that is not in the compilation directory, it picks the
directory right before the correct one. In the new test, for example,
code inlined from `inc/helper.h` symbolizes to `./helper.h` instead of
`./inc/helper.h`.
[10 lines not shown]
[VectorUtils] Refine live-ins handling in computeMinimumValueSizes
Prior to this patch, instructions outside of the analyzed blocks
were visited as part of the traversal. As the result, their
function-wide demanded bits were mixed into the analyzed class
making their out-of-the-loop users broaden demanded bits.
For this reason, we were making different decisions depending
on whether a live-in is an argument (didn't participate in the
traversal) or an instruction (did participate):
https://llvm.godbolt.org/z/5haMTGrY3
This change handles live-ins separately by adding demanded
bits only for their concrete in-loop users and excluding
them from non-traversed user checks.
[MC] Replace MCAsmInfo::printSpecifierExpr with func ptr (#246714)
Avoid a virtual function by using a function pointer for printing
MCSpecifierExpr. Saves ~400B of .data.rel.ro.
[SPIRV] Enable NSDI features by default for AMD
Enable -spirv-debug-lexical-block-discriminator-scope,
-spirv-debug-scope-forward-refs and -spirv-debug-declare-untyped-variable
when the target vendor is AMD.
[SPIRV] Treat OpUntypedVariableKHR as a function-level variable (#245593)
With `SPV_KHR_untyped_pointers`, locals are `OpUntypedVariableKHR`, so
`DebugFunctionDefinition` was emitted before those variables, which is
illegal.
This change treats `OpUntypedVariableKHR` the same as `OpVariable` when
finding the last function-level variable.
[SCEV] Add recursion depth limit to isKnownPredicate (NFC). (#246438)
Add a depth limit to isKnownPredicate, to restrict the depth of
recursive reasoning. The new isKnownPredicateImpl takes the current
recurion depth and gives up once the limit is reached.
Currently this only passes the depth through to
isKnownPredicateViaSplitting. isKnownViaInduction is not as
straight-forward, as it only indirectly calls isKnownPredicate via
isLoopEntryGuardedByCond/isLoopBackedgeGuardedByCond.
Split off from https://github.com/llvm/llvm-project/pull/208546.
PR: https://github.com/llvm/llvm-project/pull/246438
[X86] Prefer 256-bit vectors for novalake (#238053)
As in title. This was missed during initial implementation. Novalake
should be inline with other arches wrt. to TuningPrefer256Bit
[offload][acc] Add the OpenACC DeviceManager
The DeviceManager maps the OpenACC device types and device numbers to the
devices of the plugin manager, and keeps the device selection ICVs of each
thread. Implement acc_get_num_devices, acc_get_device_type,
acc_set_device_type, acc_get_device_num and acc_set_device_num on top of it.
Add Fortran tests of these routines and of the ICVs being per thread. They use
the libacctarget_test module to bring the runtime up and down, until the
compiler driver does it.
Assisted-by: Claude Sonnet 5.5
[Offload][NFC] Drop redundant using-directive for offloading::sycl (#246526)
Utility.cpp already qualifies its only sycl definition as
sycl::writeSymbolTable, so the file-scope using-directive for
llvm::offloading::sycl is unnecessary.
Assisted-By: Claude Code
Reapply "[clang] Suppress -Wuninitialized for unevaluated builtin args" (#245821)
This reapplies f19973fdd2fe (#217816), reverted in 550bc0246c54, with a
different implementation.
f19973fdd2fe left the arguments of every builtin with the
`UnevaluatedArguments` attribute out of the CFG, as CFGBuilder already
did for `__builtin_object_size` and `__builtin_dynamic_object_size`.
A warning queued with DiagRuntimeBehavior is kept when its expression
has no CFG block, so warnings in branches of those arguments that fold
away were no longer dropped. This broke -Werror builds of the Linux
kernel, where MAYBE_BUILD_BUG_ON wraps ilog2() in
`__builtin_constant_p`:
__builtin_constant_p(n) ? ... : (sizeof(n) <= 4) ? __ilog2_u32(n) : ...
Now only the two object size builtins leave their arguments out of the
CFG, as before f19973fdd2fe. Instead, the uninitialized values analysis
ignores references in the arguments of any call for which
[22 lines not shown]
[Mips] Do not create MIPS16 FP call stubs for constrained intrinsics (#246086)
Mips16HardFloat creates FP call stubs for calls to functions with FP
arguments or return values, except for a list of intrinsics that are
lowered inline. Constrained FP intrinsics were not on that list, so a
stub was created with the intrinsic's signature, including its metadata
parameters, and the module failed verification.
Treat constrained FP intrinsics like the unconstrained operations they
correspond to.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[MC][NFC] Remove virtual shouldOmitSectionDirective (#246682)
Remove the virtual hook shouldOmitSectionDirective in favor of a small
string set of section names that can be used without a .section
directive in MCAsmInfo. Also fold UsesELFSectionDirectiveForBSS into
this set and require explicit addition of .bss, as most targets do not
support .bss without .section.
[KnownFPClass][NFC] Separate the negative zero deductions in sinh/tanh/asin (#246172)
Refactors `KnownFPClass::sinh/tanh/asin` so that they rule out
`fcNegZero` in a separate/dedicated clause. In general, these functions
are sign-preserving but have extra complexities when ruling out
-0.0/+0.0 (due to denormal flushing, and compensating for low quality
`libm` implementations), which is why these functions only attempt to
rule out -0.0 but not +0.0.
This also makes it more clear where `nsz` is applicable for
https://github.com/llvm/llvm-project/pull/241661
[flang] Mark all visible Cray pointer targets (#241388)
When a Cray pointer is set to a variable's address, flang gives that
variable the TARGET attribute so alias analysis knows the pointee can
modify it. It only caught `ptr = loc(x)` with nothing else on the
right-hand side, and it only marked `x`.
This patch marks anything passed to LOC or %LOC anywhere in the
procedure, its host or their internal procedures, however the result
is used. It also marks the variable behind an ASSOCIATE name,
everything that shares storage with a marked variable through
EQUIVALENCE or COMMON, and assumed-shape dummies, which were missed
before.
This fixes an EQUIVALENCE case that is already wrong at -O1 on main,
and it is needed before #230699 can remove the runtime call on
pointee references.
Assisted-by: Claude Code
[3 lines not shown]