[clang][test] Add more tests for __builtin_clear_padding (#205813)
Follow-up to https://github.com/llvm/llvm-project/pull/201102 which
fixed Clang's `__builtin_clear_padding` treatment of unnamed bitfields.
This patch adds some more test coverage (more layouts, and verifies IR).
Used Claude to generate the layouts. Manually ran
`llvm/utils/update_cc_test_checks.py` to generate the `CHECK` directives
and confirmed that the bit-masks in the IR match the expected
`__builtin_clear_padding` behaviour.
Assisted-by: claude
Fix cir vec cmp fold (#202502)
Fixes #202431
This PR fixes two bugs in `VecCmpOp::fold` that caused incorrect
constant folding of vector comparisons.
1. Wrong result value: True comparison results were folded to 1, but the
SIMD convention and `VecCmpOp`'s own documentation require 0 (false) or
-1 / all-ones (true). For example, a `ne` comparison where all elements
differ should produce [`-1, -1, -1, -1]`, not `[1, 1, 1, 1]`.
2. Unsigned comparisons treated as signed: Ordered comparisons `(lt, le,
gt, ge)` always used `getSInt()`, treating unsigned element types as
signed. This produced wrong results for values whose high bit is set,
e.g., for `u8`, the value 255 was interpreted as -1, so 0 > 255
(unsigned: false) was incorrectly folded to true.
Fix: Dispatch to `getUInt()` or `getSInt()` based on the input element
[2 lines not shown]
[flang][cuda] Exclude non-variable actuals from unified-memory CUDA data attribute relaxation (#206121)
Under -gpu=mem:unified, the CUDA data attribute compatibility check
(AreCompatibleCUDADataAttrs) allows an unattributed actual argument to
bind to a Device/Managed/Unified dummy. This relaxation is correct for
variables whose storage is accessible from device code under unified
memory, but not for non-variable expression results (e.g. intrinsic call
results like RESHAPE(...)), which are host temporaries.
Without this fix, a generic SUM call like sum(reshape(hostArray, ...),
dim=2) could resolve to a device-specific overload instead of the
intrinsic, because the RESHAPE result was incorrectly considered
compatible with a DEVICE-attributed dummy.
This patch:
- Adds an actualIsVariable parameter to AreCompatibleCUDADataAttrs
(defaulting to true for backward compatibility) and gates the
unified-memory relaxation for Device/Managed/Unified dummies on it.
[3 lines not shown]
[docs] Register MLIR lexer for Sphinx docs
Register the in-tree MLIR Pygments lexer from the shared llvm_sphinx configuration so all llvm-project Sphinx builds can highlight fenced mlir blocks.
Also teach the MLIR lexer to consume top-level whitespace. Without this, Sphinx reports a lexer warning after the lexer is registered, and docs-clang-html fails because Sphinx warnings are treated as errors.
This makes docs-clang-html build with CLANG_ENABLE_CIR=ON.