512256 Commits

Author SHA1 Message Date
Matheus Izvekov
e0ad34e565
[clang] Use canonical type for substitution which might be incomplete (#109065)
When checking deduction consistency, a substitution can be incomplete
such that only sugar parts refer to non-deduced template parameters.

This would not otherwise lead to an inconsistent deduction, so this
patch makes it so we canonicalize the types before substitution in order
to avoid that possibility, for now.

When we are able to produce substitution failure diagnostics for partial
ordering, we might want to improve the TemplateInstantiator so that it
does not fail in that case.

This fixes a regression on top of #100692, which was reported on the PR.
This was never released, so there are no release notes.
2024-09-18 18:22:14 -03:00
Kazu Hirata
abb317ff9a
[clang-tidy] Fix performance-unnecessary-value-param (#109145)
This patch essentially reverts #108674 while adding a testcase that
triggers a crash in clang-tidy.

Fixes #108963.
2024-09-18 14:18:04 -07:00
Craig Topper
644899addd [RISCV][GISel] Port portions of float-intrinsics.ll and double-intrinsics.ll. NFC
Remove the legalizer test for the same intrinsics as it is no longer
interesting with end to end tests.
2024-09-18 13:13:34 -07:00
Xing Xue
bde51d9b0d
[libomp][AIX] Ensure only libomp.a is published on AIX (#109016)
For `libomp` on AIX, we build shared object `libomp.so` first and then
archive it into `libomp.a`. Due to a CMake for AIX problem, the install
step also tries to publish `libomp.so`. While we use a script to build
`libomp.a` out-of-tree for Clang and avoided the problem, this chokes
the in-tree build for Flang. The issue will be reported to CMake but
before a fixed CMake is available, this patch ensures only `libomp.a` is
published.
2024-09-18 16:12:39 -04:00
Rahul Joshi
9ddb1cd564
[LLVM][TableGen] Change DFAPacketizerEmitter to use const RecordKeeper (#109044)
Change DFAPacketizerEmitter to use const RecordKeeper.

This is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-09-18 13:07:09 -07:00
Rahul Joshi
9284e1870d
[LLVM][TableGen] Change DAGISel code to use const RecordKeeper (#109038)
Change DAGISel code to use const RecordKeeper.

This is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-09-18 13:06:41 -07:00
Andrea Faulds
a800ffac41
[mlir][gpu] Disjoint patterns for lowering clustered subgroup reduce (#109158)
Making the existing populateGpuLowerSubgroupReduceToShufflePatterns()
function also cover the new "clustered" subgroup reductions is proving
to be inconvenient, because certain backends may have more specific
lowerings that only cover the non-clustered type, and this creates pass
ordering constraints. This commit removes coverage of clustered
reductions from this function in favour of a new separate function,
which makes controlling the lowering much more straightforward.
2024-09-18 15:55:53 -04:00
Peter Klausler
1e19e1e1a4
[flang] Catch untyped entities in interfaces with IMPLICIT NONE (#109018)
The order of operations in name resolution wasn't converting named
entities to objects by the time that they were subjected to the implicit
typing rules in the case of interface blocks. This led to entities
remaining untyped without error, leading to a crash in module file
generation.

Fixes https://github.com/llvm/llvm-project/issues/108975.
2024-09-18 12:20:39 -07:00
Peter Klausler
5f11d38d01
[flang] Fix code that deletes unit from bad OPEN (#108994)
When an OPEN statement fails, a unit that was created for the OPEN needs
to be removed from the unit map. The code that tried to do this was
incorrect -- it needs to re-acquire the unit via LookUpForClose as a
CLOSE statement does. (The failure to do this completely was leaving a
zombie unit active that could break a later OPEN on the same unit
number.)
2024-09-18 12:19:18 -07:00
Peter Klausler
b0bdc7fcc9
[flang] Fix subtle type naming bug in module file output (#108892)
A derived type specification in semantics holds both its source name
(for location purposes) and its ultimate derived type symbol. But for
correct module file generation of a structure constructor using that
derived type spec, the original symbol may be needed so that USE
association can be exposed.

Save both the original symbol and its ultimate symbol in the
DerivedTypeSpec, and collect the right one when traversing expressions
(specifically for handling initialization in module files).

Fixes https://github.com/llvm/llvm-project/issues/108827.
2024-09-18 12:18:50 -07:00
Craig Topper
d5d1417659
[RISCV][GISel] Use libcalls for rint, nearbyint, trunc, round, and roundeven intrinsics. (#108779) 2024-09-18 12:07:44 -07:00
Nicolas van Kempen
1be4c9710b
[clang-tidy][readability-container-contains] Extend to any class with contains (#107521)
This check will now work out of the box with other containers that have a
`contains` method, such as `folly::F14` or Abseil containers.

It will also work with strings, which are basically just weird containers.
`std::string` and `std::string_view` will have a `contains` method starting with
C++23. `llvm::StringRef` and `folly::StringPiece` are examples of existing 
implementations with a `contains` method.
2024-09-18 14:57:31 -04:00
LLVM GN Syncbot
51df8a3327 [gn build] Port 71e434d30280 2024-09-18 18:36:55 +00:00
Jorge Gorbe Moya
71e434d302
[SandboxVec] Reapply "Add barebones Region class. (#108899)" (#109059)
A `#ifndef NDEBUG` in the wrong place caused an error in release builds.
2024-09-18 11:36:45 -07:00
Youngsuk Kim
84d7f294c4 [flang] Tidy uses of raw_string_ostream (NFC)
As specified in the docs,
1) raw_string_ostream is always unbuffered and
2) the underlying buffer may be used directly

( 65b13610a5226b84889b923bae884ba395ad084d for further reference )

Avoid unneeded calls to raw_string_ostream::str(), to avoid excess indirection.
2024-09-18 13:26:29 -05:00
Slava Zakharin
36192fdfb9
Revert "[flang][runtime] Use cuda::std::complex in F18 runtime CUDA build." (#109173)
Reverts llvm/llvm-project#109078
2024-09-18 11:22:31 -07:00
Noah Goldstein
37932643ab [SimplifyCFG] Deduce paths unreachable if they cause div/rem UB
Same we way mark a path unreachable if it may cause a nullptr
dereference, div/rem by zero or signed div/rem of INT_MIN by -1 cause
immediate UB.

Closes #109008
2024-09-18 12:59:52 -05:00
Noah Goldstein
f5d62d7647 [SimplifyCFG] Add tests for deducing paths unreachable if they cause div/rem UB; NFC 2024-09-18 12:59:52 -05:00
Slava Zakharin
be187a6812
[flang][runtime] Use cuda::std::complex in F18 runtime CUDA build. (#109078)
`std::complex` operators do not work for the CUDA device compilation
of F18 runtime. This change makes use of `cuda::std::complex` from
`libcudacxx`.
`cuda::std::complex` does not have specializations for `long double`,
so the change is accompanied with a clean-up for `long double` usage.
2024-09-18 10:59:05 -07:00
Henrik G. Olsson
13502c7f2c
Revert update-verify-tests.py (#109171)
This reverts commits c96ee0ffaf5ee7afa1f4b0be0662852f57b47244 and
9ceb9676678ad979a0b767450855d7852ce6a553.

Discussion in github PR #108658.
2024-09-18 10:51:53 -07:00
Helena Kotas
f2128267c2
[HLSL][NFC] Remove RegisterBindingFlags struct (#108924)
When diagnosing register bindings we just need to make sure there is a
resource that matches the provided register type. We can emit the
diagnostics right away instead of collecting flags in the
RegisterBindingFlags struct. That also enables early exit when scanning
user defined types because we can return as soon as we find a matching
resource for the given register type.
2024-09-18 10:51:30 -07:00
Jacek Caban
86d2abefcb
[LLD][COFF] Store __imp_ symbols as Defined in InputFile (#109115) 2024-09-18 19:49:06 +02:00
Fangrui Song
e06f32114d [CSKY,M68k,Xtensa] Update function names after #108643 2024-09-18 10:48:45 -07:00
Rahul Joshi
2c966709b7
[LLVM][TableGen] Change CompressInstEmitter to use const RecordKeeper (#109035)
Change CompressInstEmitter to use const RecordKeeper.

This is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-09-18 10:42:51 -07:00
Rahul Joshi
80aa4dab1e
[LLVM][TableGen] Change X86FoldTablesEmitter to use const RecordKeeper (#109070)
Change X86FoldTablesEmitter to use const RecordKeeper.

This is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-09-18 10:41:57 -07:00
Rahul Joshi
1a793a8ca0
[LLVM][TableGen] Change X86InstrMapping to use const RecordKeeper (#109066)
Change X86InstrMappingEmitter to use const RecordKeeper.

This is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-09-18 10:41:21 -07:00
Joseph Huber
5f02558d82
[OpenMP] Fix not linking C libraries when enabled (#109168)
Summary:
We used to do this automatically, add it back in to do it manually.
2024-09-18 10:02:16 -07:00
Rahul Joshi
b18190ebfc
[LLVM][TableGen] Change MacroFusionPredicator to use const RecordKeeper (#109064)
Change MacroFusionPredicator to use const RecordKeeper.

This is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-09-18 09:59:24 -07:00
Rahul Joshi
47d76a9910
[LLVM][TableGen] Change InstrDocsEmitter to use const RecordKeeper (#109061)
Change InstrDocsEmitter to use const RecordKeeper.

This is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-09-18 09:58:36 -07:00
Rahul Joshi
ab2b333f0d
[LLVM][TableGen] Change FastISelEmitter to use const RecordKeeper (#109060)
Change FastISelEmitter to use const RecordKeeper.

This is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-09-18 09:58:04 -07:00
Rahul Joshi
74335fb7ae
[LLVM][TableGen] Change X86MnemonicTables to use const RecordKeeper (#109053)
Change X86MnemonicTables to use const RecordKeeper.

This is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-09-18 09:57:31 -07:00
Rahul Joshi
4fbac52841
[LLVM][TableGen] Change DXILEmitter to use const RecordKeeper (#109045)
Change DXILEmitter to use const RecordKeeper.

This is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-09-18 09:56:56 -07:00
Craig Topper
06048aaa73
[Target] Use 'unsigned' as the underlying type for the tablegened physical register enums. (#109086)
Otherwise, the enum defaults to 'int'. Update a few places that used
'int' for registers that now need to change to avoid a signed/unsigned
compare warning.

I was hoping this would allow us to remove the 'int' comparison
operators in Register.h and MCRegister.h, but compares with literal 0
still need them.
2024-09-18 09:54:21 -07:00
Rahul Joshi
0545e9f5b6
[LLVM][TableGen] Change DFAEmitter to use const Record pointers (#109042)
Change DFAEmitter to use const Record pointers.

This is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-09-18 09:52:50 -07:00
Rahul Joshi
87da9e2fac
[LLVM][TableGen] Change CodeEmitterGen to use const RecordKeeper (#109025)
Change CodeEmitterGen to use const RecordKeeper.

This is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-09-18 09:44:57 -07:00
Craig Topper
8e4909aa19
[RISCV] Remove unnecessary vand.vi from vXi1 and nvXvi1 VECTOR_REVERSE codegen. (#109071)
Use a setne with 0 instead of a trunc. We know we zero extended the node
so we can get by with a non-zero check only. The truncate lowering
doesn't know that we zero extended so has to mask the lsb.

I don't think DAG combine sees the trunc before we lower it to RISCVISD
nodes so we don't get a chance to use computeKnownBits to remove the
AND.
2024-09-18 09:43:48 -07:00
Craig Topper
292ee93a87
[CodeGen] Use Register in SwitchLoweringUtils. NFC (#109092)
Use an empty Register() instead of -1U.
2024-09-18 09:43:21 -07:00
weiguozhi
6b3c9e5c20
[X86] Speed up X86 Domain Reassignment pass by early return (#108108)
Current implementation of X86 Domain Reassignment pass is finding out
the complete closure of a general register, then check if it's possible
to change the domain. It causes compile time issue when compiling large
functions. This patch checks the possibility of change domain in the
process of constructing closure, if it's illegal to change domain, we
can return immedietely.

For one of our large files, it reduced X86 Domain Reassignment pass time
from 200+ seconds to less than 1s.
2024-09-18 09:12:04 -07:00
Rahul Joshi
2731be7ac5
[Support] Add helper struct indent for adding indentation (#108966)
Add helper struct indent() for adding indentation to raw_ostream.
2024-09-18 08:54:11 -07:00
Vakhurin Sergei
eda72fac54
Fix OOM in FormatDiagnostic (2nd attempt) (#108866)
Resolves: #70930 (and probably latest comments from clangd/clangd#251)
by fixing racing for the shared DiagStorage value which caused messing with args inside the storage and then formatting the following message with getArgSInt(1) == 2:

def err_module_odr_violation_function : Error<
  "%q0 has different definitions in different modules; "
  "%select{definition in module '%2'|defined here}1 "
  "first difference is "

which causes HandleSelectModifier to go beyond the ArgumentLen so the recursive call to FormatDiagnostic was made with DiagStr > DiagEnd that leads to infinite while (DiagStr != DiagEnd).

The Main Idea:
Reuse the existing DiagStorageAllocator logic to make all DiagnosticBuilders having independent states.
Also, encapsulating the rest of state (e.g. ID and Loc) into DiagnosticBuilder.

The last attempt failed -
https://github.com/llvm/llvm-project/pull/108187#issuecomment-2353122096
so was reverted - #108838
2024-09-18 11:46:25 -04:00
Jay Foad
2c85fe9689 [AMDGPU] Remove miscellaneous unused code. NFC. 2024-09-18 16:45:08 +01:00
Lei Huang
4b524088a8
[NFC] Update function names in MCTargetAsmParser.h (#108643)
Update function names to adhere to LLVM coding standard.
2024-09-18 11:43:49 -04:00
Jordan Rupprecht
afce1b1014
[bazel] Remove empty Rename tests for now-deleted clang-rename (#109162)
Removed in #108988, the tool is fine but the glob for tests is now empty
because all the tests were deleted.
2024-09-18 10:42:03 -05:00
Luc Blaeser
6ce14099ff
[lld][WebAssembly] Report unsupported PIC relocations as errors (#104926)
`WASM_MEMORY_ADDR_REL_` and `WASM_TABLE_INDEX_REL_` relocations against
**undefined symbols** are not supported and, except for
`UnresolvedPolicy::ReportError`, lead to incorrect Wasm code, such as
invalid data address or invalid table index that cannot be patched
during later dynamic Wasm linking with modules declaring those symbols.
This is different to other relocations that support undefined symbols by
declaring correspond Wasm imports.

For more robust behavior, `wasm-ld` should probably report an error for
such unsupported PIC relocations, independent of the `UnresolvedPolicy`.
2024-09-18 08:40:30 -07:00
Aaron Ballman
3f0dfab541
Revert "[clang] Increase VecLib bitfield size to 4 bits in CodeGenOptions.def" (#109161)
Reverts llvm/llvm-project#108804

Bots are failing:
https://lab.llvm.org/buildbot/#/builders/140/builds/6859
2024-09-18 11:34:09 -04:00
Mainak Sil
475ceca859
[clang] Increase VecLib bitfield size to 4 bits in CodeGenOptions.def (#108804)
Summary:
This PR fixes the issue where the VecLib bitfield in CodeGenOptions.def
is too small to accommodate the increasing number of vector libraries.
Specifically, the bitfield size was previously set to 3, but with the
introduction of more vector libraries (currently 9), the bitfield needed
to be expanded to avoid potential issues in vectorization.

In this PR, I have increased the size of the VecLib bitfield from 3 to 4
to account for the additional libraries. This ensures that all 9 vector
libraries are correctly encoded and available for use without errors.

Changes Made:
Modified: Increased the VecLib bitfield size from 3 to 4 in
clang/include/clang/Basic/CodeGenOptions.def.

Motivation:
This change is necessary to ensure that all vector libraries are
properly represented and selectable. The current limitation of the
VecLib bitfield size was causing some vectorization opportunities to be
lost when more than 3 bits were needed to represent the library options.

Closes:
Fixes https://github.com/llvm/llvm-project/issues/108704
2024-09-18 11:29:49 -04:00
Sarah Spall
67518a44fe
[HLSL] Implement elementwise popcount (#108121)
Add new elementwise popcount builtin to support HLSL function
'countbits'.
elementwise popcount only accepts integer types.
Add hlsl intrinsic 'countbits'
Closes #99094
2024-09-18 08:19:52 -07:00
Shilei Tian
b334ca6739 [NFC] Remove trailing whitespaces in llvm/docs/LangRef.rst 2024-09-18 10:26:40 -04:00
Rahul Joshi
47c3df2a7f
[LLVM][TableGen] Change CallingConvEmitter to use const RecordKeeper (#108955)
Change CallingConvEmitter to use const RecordKeeper.

This is a part of effort to have better const correctness in TableGen
backends:


https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
2024-09-18 07:19:40 -07:00
Adrian Vogelsgesang
620738e662
[lldb-dap][test] Fix readMemory test (#109057)
So far, the test case was also testing the offset -1. This test cases
failed if the string is immediately at the beginning of the memory
region, though, and the offset -1 hence belonged to a different memory
region.

The fix is rather straightforward:
Passing an offset of -1 is not used by any actual clients of lldb-dap,
anyway. As such, this commit simply removes the corresponding test case.
2024-09-18 16:16:31 +02:00