[llubi] Add UTC helper (#180603)
This patch adds a UTC helper `llvm/utils/update_llubi_test_checks.py` to
generate check lines for the trace. Generalizer and multiple prefixes
are not supported since they are meaningless for traces. I know it is a
bit weird, but I don't have a better idea :(
I found that `llvm/utils/update_test_body.py` also works. But it is
annoying to duplicate the command twice.
[NewPM] Port x86-winehstate (#180687)
x86-winehstate has been converted to a module pass for NewPM since it
uses data from the Module by overriding `doInitialization` and
`doFinalization`.
[AMDGPU] [GlobalIsel] Enabling lit tests for new regbank select (#180680)
This patch will enable few more lit tests that depends on G_FRAME_INDEX
opcode.
[clang] Ensure -mno-outline adds attributes
Before this change, `-mno-outline` and `-moutline` only controlled the
pass pipelines for the invoked compiler/linker.
The drawback of this implementation is that, when using LTO, only the
flag provided to the linker invocation is honoured (and any files which
individually use `-mno-outline` will have that flag ignored).
This change serialises the `-mno-outline` flag into each function's
IR/Bitcode, so that we can correctly disable outlining from functions in
files which disabled outlining, without affecting outlining choices for
functions from other files. This matches how other optimisation flags
are handled so the IR/Bitcode can be correctly merged during LTO.
[clang] Add clang::nooutline Attribute
This change:
- Adds a `[[clang::nooutline]]` function attribute for C and C++. There
is no equivalent GNU syntax for this attribute, so no `__attribute__`
syntax.
- Uses the presence of `[[clang::nooutline]]` to add the `nooutline`
attribute to IR function definitions.
- Adds test for the above.
The `nooutline` attribute disables both the Machine Outliner (enabled at
Oz for some targets), and the IR Outliner (disabled by default).
[outliners] Turn nooutline into an Enum Attribute
This change turns the `"nooutline"` attribute into an enum attribute
called `nooutline`, and adds an auto-upgrader for bitcode to make the
same change to existing IR.
This IR attribute disables both the Machine Outliner (enabled at Oz for
some targets), and the IR Outliner (disabled by default).
[CIR] Add static_local attribute to GlobalOp and GetGlobalOp
This attribute marks function-local static variables that require
guarded initialization (e.g., C++ static local variables with
non-constant initializers). It is used by CIRGen to communicate
to LoweringPrepare which globals need guard variable emission.
[flang] Don't do actual concatenation when computing LEN() of concatenated strings (#180676)
For cases like the following don't actually compute concatenation of
`str // "abc"`, because we only need final length:
```
character(len=*), intent(in) :: str
character(len=len(str // "abc")) :: res
```
For such cases, don't emit hlfir.concat.
Fixes #157763
[CIR] Add ASTVarDeclInterface for AST attribute access
Add the ASTVarDeclInterface which provides methods to access clang AST
VarDecl information from CIR attributes. This interface enables:
- mangleStaticGuardVariable: Mangle guard variable names using clang's
MangleContext
- isLocalVarDecl: Check if a variable is function-local
- getTLSKind: Get thread-local storage kind
- isInline: Check if the variable is inline
- getTemplateSpecializationKind: Get template specialization info
- getVarDecl: Direct access to the underlying VarDecl pointer
This infrastructure is needed for proper handling of static local
variables with guard variables in LoweringPrepare.
[SimplifyCFG][PGO] Add missing overflow check to ConstantFoldTerminator (#178964)
Branch weight metadata can overflow when folding large branch weights.
Updated branch weights to uint64_t, added check for overflow, and then
set branch weights using setFittedBranchWeights to ensure branch weight
metadata is not lost.
[mlir][shape] Fix crash in ShapeOfOpToConstShapeOp (#180737)
This PR fixes a crash when `shape.shape_of` op has static arg and shape
result type. Fixes #180719.
[mlir][sparse] Fix a crash if block not have terminator (#180741)
This PR fixes a crash in `verifyNumBlockArgs` if region not end with a
terminator. Fixes #180720.
Clang: Add nsz to llvm.minnum and llvm.maxnum emitted from fmin and fmax (#113133)
See: https://github.com/llvm/llvm-project/pull/112852
We will define llvm.minnum and llvm.maxnum with +0.0>-0.0, by default,
while libc doesn't require it.
[CIR][X86] Add support for vpshl/vpshr builtins (#179538)
This patch also adds support for fshl/fshr operations so that
vpshl/vpshr intrinsics can lower to them
Part of: #167765
[FlowSensitive] [StatusOr] Add test fixture target to Bazel (#180302)
This can be used to make sure downstream extensions to the model still
pass the unit tests.
[CodeGen] Expand power-of-2 div/rem at IR level in ExpandIRInsts.
Previously, power-of-2 div/rem operations wider than
MaxLegalDivRemBitWidth were excluded from IR expansion and left for
backend peephole optimizations. Some backends can fail to process such
instructions in case we switch off DAGCombiner.
Now ExpandIRInsts expands them into shift/mask sequences:
- udiv X, 2^C -> lshr X, C
- urem X, 2^C -> and X, (2^C - 1)
- sdiv X, 2^C -> bias adjustment + ashr X, C
- srem X, 2^C -> X - (((X + Bias) >> C) << C)
Special cases handled:
- Division/remainder by 1 or -1 (identity, negation, or zero)
- Exact division (sdiv exact skips bias, produces ashr exact)
- Negative power-of-2 divisors (result is negated)
- INT_MIN divisor (correct via countr_zero on bit pattern)
[mlir][acc] Fixed side effects for [first]private/reduction. (#180791)
This patch moves the definitions of memory effects for the data
entry/exit operations into C++ code. The main reason for this
is to modify the effects of [first]private and reduction
operations: they should not access `CurrentDeviceIdResource`
when they are located inside a compute construct.
The ODS to C++ migration was done with AI assistance. I reviewed
these changes and made sure it was an NFC change. After that
I modified [first]private and reduction implementations.
[libc] Add option to disable printf bit int (#180832)
Requested as a binary size optimization. Updates the parser, converter
utils, config, tests, and docs.
[llvm][cas] Validate OnDiskKeyValueDB against the corresponding OnDiskGraphDB (#180852)
We were previously using the primary OnDiskGraphDB when validating the
upstream OnDiskKeyValueDB, which is incorrect since the values being
stored are direct offsets and therefore cannot be used across DBs
without translating to a hash value first.
rdar://170067863