[clang-scan-deps] Fixes an assertion in clang-scan-deps (#193619)
Please see ticket #191921 for detailed description of the issue and a reproducer.
clang-scan-deps crashes with an assertion failure if a compile_commands.json entry contains a depfile path (-MF) whose parent directory does not exist.
The fix is made so that clang-scan-deps tool create the directory if it doesn't exist and finish execution without failing.
[RISCV] Remove codegen for vp_fneg, vp_fma. NFC (#193214)
Part of the work to remove trivial VP intrinsics from the RISC-V
backend, see
https://discourse.llvm.org/t/rfc-remove-codegen-support-for-trivial-vp-intrinsics-in-the-risc-v-backend/87999
We began expanding these nodes in #190589 since vp_fadd/vp_fmul/vp_fsub
could be combined into them. Now that these intrinsics are expanded too,
the lowering for these is dead and can be removed.
[VPlan] Fold lhs | (headermask && rhs) -> vp.merge rhs, true, lhs, evl (#193511)
This is a combine on mask vectors that can show up with EVL tail
folding.
Split off from #190196
[OpenCL] Diagnose error for zero-length array (#193163)
OpenCL C is based on C99 and C11, which don't support zero-length array.
Update clang/docs/ReleaseNotes.rst for potential breaking change.
[Clang][CodeGen] Fix sret lifetime marker AS mismatch after #186275 (#193850)
After #186275, the sret address space can differ from the alloca address
space (e.g., AS 0 vs AS 5 on AMDGPU). In CGCall.cpp EmitCall(), when a
discarded-value sret temporary is created, SRetPtr is allocated in the
alloca AS and a lifetime.start is emitted. The pointer is then
addrspacecast'd to match the sret AS, but the CallLifetimeEnd cleanup
was using the addrspacecast'd pointer, triggering an assertion in
EmitLifetimeEnd ("Pointer should be in alloca address space").
Saves the original alloca pointer before the addrspacecast and uses it
for the lifetime-end cleanup.
Fixes buildbot failure: hip-third-party-libs-tests
[libclc] Allow testing unresolved symbols on multiple libraries (#193647)
Our downstream generates multiple libraries for a single target. This
change allows testing multiple libraries.
[libclc][CMake] Remove CMAKE_C_COMPILER_ID check (#186717)
When LLVM_TARGETS_TO_BUILD does not contain the host target, runtime
build can not identify a compatible target triple for the host compiler.
CMAKE_C_COMPILER is set to clang, and CMAKE_C_COMPILER_ID is empty
although the compiler is functional.
Remove CMAKE_C_COMPILER_ID check. CMakeTestCLCCompiler.cmake already
provides a real functional guard.
This change ensures valid configurations can proceed, e.g.:
LLVM_TARGETS_TO_BUILD=AMDGPU;
RUNTIMES_amdgcn-amd-amdhsa-llvm_LLVM_ENABLE_RUNTIMES=libclc;
LLVM_RUNTIME_TARGETS="amdgcn-amd-amdhsa-llvm".
Note CMAKE_C_COMPILER_WORKS is always true after `project(Runtimes C CXX
ASM)` in runtimes/CMakeLists.txt.
[LazyValueInfo] Support vector types in ICmp condition handling (#192900)
Use m_APInt matcher instead of ConstantInt dyn_cast so splat vector
constants are handled, and relax the integer type check to accept
integer vector types.
Fixes https://github.com/llvm/llvm-project/issues/192094
[NFC][Clang][Sema] Apply rule of three to Sema helper classes (#193835)
Static analysis flagged these classes. They declared a destructor but
not copy constructor or copy assignment. Since these classes don't need
them, this change declares them deleted.
[clang] NFC: Add test case for #178324 and mark it as fixed (#190490)
Issue #178324 was actually fixed by #187755
We lost the "declaration does not declare anything" warning since the
regression was introduced, but that was because:
1) Since #78436 we treat __builtin_FUNCSIG in a dependent context
effectivelly as if it contained a template parameter.
2) Our decltype implementation treats eexpressions containing template
parameters as if they were completely opaque (but alas this goes against
the spec, which says in [temp.type]p4 this should be looking only at
type dependence).
3) Since the decltype is opaque, we don't know what lookup will find, so
we can't issue the warning because we don't know if we are going to end
up with a type or an expression.
Fixes #178324
[CIR] Add coroutine cleanup handling and update co_return semantics (#189281)
This PR adds cleanup handling for coroutine frame destruction. The
cleanup is emitted as a conditional that checks the result of the
`coro.free` builtin, which is used to determine whether the coroutine
frame was heap-allocated, if the returned pointer is null, no
destruction is performed. Additionally, this PR changes how co_return is
represented: previously, it was lowered directly into a branch to the
block containing the final suspend logic, but now a new `cir.coro.body`
operation is introduced to represent the user-written coroutine body.
Inside this region, `cir.co_return` operations mark exits from the
coroutine body and represent structured control flow that transfers
execution to the final suspend point. The lowering of this structured
control flow into explicit branches is deferred to a future PR in the
FlattenCFG pass.
Revert "Reapply "[clang][modules-driver] Add support for C++ named modules and `import std`" (#193857)
Reverts llvm/llvm-project#193815 due to a test failure
(`clang/test/Driver/modules-driver-import-std.cpp`) on some systems.
[SLP] Fix a very long loads offset, being stored in DenseMap
Added a check for a very long offset to avoid a crash in the compiler
Fixes #181682
(cherry picked from commit 7ec7907b80f8137f06bfb84b47f4a9b4805402ba)
[HLSL][NFC] Refactor worklist loop in HLSLEmitter.cpp to use index-based iteration (#193638)
As suggested by @shafik, the worklist loop in HLSLEmitter.cpp would be
more readable as an index-based for-loop as opposed to a range-based
for-loop. This PR changes the range-based for-loop over worklist items
into an index-based for-loop.
Reapply "[clang][modules-driver] Add support for C++ named modules and `import std`" (#193815)
This reverts #193677 and relands #193312.
This adds basic support for explicit C++ named module builds, managed
natively by the Clang driver, including support for use of the Standard
library modules. This follows #187606, which adds the same for Clang
modules.
Current limitations:
- Standard library modules are still compiled to object files instead of
using the provided shared library. (This will be addressed in a
follow-up soon.)
- Caching is not supported yet (but likely to be added during the
upcoming GSoC cycle).
- Importing C++ standard library modules into Clang modules is not
supported (and not expected in the near term).
RFC:
https://discourse.llvm.org/t/rfc-modules-support-simple-c-20-modules-use-from-the-clang-driver-without-a-build-system
[CIR] Handle boolean expression as array indexes (#193814)
We were hitting a CIR verification error in some cases when a boolean
expression was used as an index to an array because the GetElementOp
verifier expected the index operand to be a fundamental integer type. To
fix this, I'm updating the emitArraySubscriptExpr to cast index values
to ptrDiffTy, which more closely matches what classic codegen does in
the corrsponding code.
The improved alignment with the classic codegen implementation caused
some minor changes in generated IR that required some tests to be
updated.
Assisted-by: Cursor / claude-4.7-opus-high