519314 Commits

Author SHA1 Message Date
Fangrui Song
c790d6f53f [ELF] isCompatile: avoid a toStr and 2 ErrAlways 2024-11-24 11:30:21 -08:00
Fangrui Song
360718fb90 [test] Improve symbol-location.s to check --defsym 2024-11-24 11:22:19 -08:00
Fangrui Song
d8495ede01 [ELF] Change getLocation to use ELFSyncStream. NFC 2024-11-24 11:16:52 -08:00
Florian Hahn
0dbdc6dc35
[VPlan] Simplify code to re-use existing basic blocks (NFCI).
Restructure and slightly simplify code to re-use existing basic blocks.
2024-11-24 19:14:29 +00:00
Kazuki Sakamoto
c2ffb42893
[lldb] Fix TestLoadUnload.py (#117416)
ELF core debugging fix #117070 broke TestLoadUnload.py tests due to
GetModuleSpec call, ProcessGDBRemote fetches modules from remote. Revise
the original PR, renamed FindBuildId to FindModuleUUID.
2024-11-24 11:04:47 -08:00
Fangrui Song
ff97b28334 [ELF] Simplif reportUndefinedSymbol. NFC 2024-11-24 10:34:11 -08:00
Simon Pilgrim
0a6d797c20 [X86] Improve F16C CVT schedules on SNB/HSW/BDW
Add complete IvyBridge schedule (which is included in the SandyBridge model, IvyBridge was the first to support F16C) - split rr/rm schedules as they usually have very different port usage.

Haswell/Broadwell use Port1 not Port0.

Confirmed with a mixture of Agner + uops.info comparisons.
2024-11-24 17:04:53 +00:00
Simon Pilgrim
6cfaddfd52
[X86] Split rr/rm CVT schedules on SNB/HSW/BDW (#117494)
The folded load variants almost never require Port5 for length changing conversions (just for SNB ymm cases), and don't typically use an extra uop for the load.

Confirmed with a mixture of Agner + uops.info comparisons.
2024-11-24 16:19:34 +00:00
Brian Cain
aafe934c0c
[hexagon] Require "asserts" build for widen-not-load test (#117414)
This test fails on the `clang-x64-windows-msvc` builder:

      .---command stderr------------
|
C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\CodeGen\Hexagon\widen-not-load.ll:7:16:
error: CHECK-LABEL: expected string not found in input
      | ; CHECK-LABEL: test1
      |                ^
      | <stdin>:1:1: note: scanning from here
| llc.exe: Unknown command line argument
'-debug-only=hexagon-load-store-widening'. Try:
'c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\llc.exe --help'
      | ^
      | <stdin>:1:35: note: possible intended match here
| llc.exe: Unknown command line argument
'-debug-only=hexagon-load-store-widening'. Try:
'c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\llc.exe --help'
      |                                   ^
2024-11-24 09:35:40 -06:00
Kazu Hirata
63d9ef5e37
[AST] Migrate away from PointerUnion::{is,get} (NFC) (#117469)
Note that PointerUnion::{is,get} have been soft deprecated in
PointerUnion.h:

  // FIXME: Replace the uses of is(), get() and dyn_cast() with
  //        isa<T>, cast<T> and the llvm::dyn_cast<T>

I'm not touching PointerUnion::dyn_cast for now because it's a bit
complicated; we could blindly migrate it to dyn_cast_if_present, but
we should probably use dyn_cast when the operand is known to be
non-null.
2024-11-24 07:28:20 -08:00
Xing Xue
08bf901ed4
Revert "[AIX] Fix AIX BuildBot failure as AIX linker doesn't support version script." (#117444)
Commit
eaa0a21d21
has fixed the build problem already so the change in
llvm/llvm-project#117342 does not make sense any more. I am reverting
it.
2024-11-24 10:28:02 -05:00
Fabian Mora
7498eaa9ab
[mlir][LLVM] Add the ConvertToLLVMAttrInterface and ConvertToLLVMOpInterface interfaces (#99566)
This patch adds the `ConvertToLLVMAttrInterface` and
`ConvertToLLVMOpInterface` interfaces. It also modifies the
`convert-to-llvm` pass to use these interfaces when available.

The `ConvertToLLVMAttrInterface` interfaces allows attributes to
configure conversion to LLVM, including the conversion target, LLVM type
converter, and populating conversion patterns. See the `NVVMTargetAttr`
implementation of this interface for an example of how this interface
can be used to configure conversion to LLVM.

The `ConvertToLLVMOpInterface` interface collects all convert to LLVM
attributes stored in an operation.

Finally, the `convert-to-llvm` pass was modified to use these interfaces
when available. This allows applying `convert-to-llvm` to GPU modules
and letting the `NVVMTargetAttr` decide which patterns to populate.
2024-11-24 10:09:43 -05:00
Congcong Cai
0c21ed48f4
[clang-tidy][NFC] fix release note order (#117484) 2024-11-24 21:46:39 +08:00
Jacek Caban
f942949a7c
[LLD][COFF] Require explicit specification of ARM64EC target (#116281)
Inferring the ARM64EC target can lead to errors. The `-machine:arm64ec`
option may include x86_64 input files, and any valid ARM64EC input is
also valid for `-machine:arm64x`. MSVC requires an explicit `-machine`
argument with informative diagnostics; this patch adopts the same
behavior.
2024-11-24 14:33:14 +01:00
Benjamin Kramer
c4d656a4e9 [bazel] Add missing dependencies for a0ef12c64284abf59bc092b2535cce1247d5f9a4 2024-11-24 11:27:37 +01:00
Benjamin Kramer
bd7d6c8066 [bazel] Port 776476c282bca71d5b856e80e0a88fbd6f3ccdd2 2024-11-24 11:21:04 +01:00
Théo Degioanni
2af6ddb8a2
[mlir][ods] Fix missing property elision for variadic segment properties (#115930)
This fixes a bug where variadic segment properties would not be elided
when printing `prop-dict`.
2024-11-24 10:57:08 +01:00
gbMattN
4d4a353b8e
[TSan] Increase the number of simultaneously locked mutexes that a thread can hold (#116409)
I've run into an issue where TSan can't be used on some code without
turning off deadlock detection because a thread tries to hold too many
mutexes. It would be preferable to be able to use deadlock detection as
that is a major benefit of TSan.

Its mentioned in https://github.com/google/sanitizers/issues/950 that
the 64 mutex limit was an arbitrary number. I've increased it to 128 and
all the tests still pass. Considering the increasing number of cores on
CPUs and how programs can now use more threads to take advantage of it,
I think raising the limit to 128 would be some good future proofing

---------

Co-authored-by: Vitaly Buka <vitalybuka@google.com>
2024-11-24 00:58:39 -08:00
Vitaly Buka
5fa0345d90
[tsan] Unwind for CHECK according to fast_unwind_on_fatal (#117470)
It's needed for #116409, which hangs with slow
unwind.
2024-11-24 00:25:06 -08:00
Fangrui Song
eb4d2f24a7 [ELF] Simplify reportMissingFeature. NFC 2024-11-23 22:49:28 -08:00
Congcong Cai
68a48ec90f
[clang][analysis][NFC]place the comment to correct position (#117467) 2024-11-24 14:45:59 +08:00
Sergei Barannikov
c85c77c054
[AVR] Fix shift node descriptions (#117456)
Wide shift nodes produce two results, not one.
Reuse the added type profile to define the standard "shift parts" nodes.
2024-11-24 09:26:52 +03:00
Sergei Barannikov
8d650736c1
[AMDGPU] Fix AMDGPUISD::TRAP description (#117453)
Glue operand is only present if there are variadic register operands,
which makes it optional.
Also, change the number of fixed operands to 1 (the trap ID).
2024-11-24 09:25:15 +03:00
Vitaly Buka
215f3dd5f6
[nfc][sancov] Remove unnecessary default argument (#117464) 2024-11-23 22:16:00 -08:00
Vitaly Buka
ae01e3a7c6
[nfc][sancov] Remove unnecessary default argument (#117463) 2024-11-23 22:09:38 -08:00
Fangrui Song
1a2cc2bce8 [ELF] Exclude sizeof(InputSection) to _WIN32
Structs with delicate packing are often larger in MSVC than Itanium.
099a52fd2f3723db6b0550c99a1adc12d2d8d909 did not make
sizeof(InputSection) smaller for MSVC. Just exclude MSVC.
2024-11-23 21:42:22 -08:00
Matthias Springer
a0ef12c642
[mlir][LLVM] LLVMTypeConverter: Tighten materialization checks (#116532)
This commit adds extra checks to the MemRef argument materializations in
the LLVM type converter. These materializations construct a
`MemRefType`/`UnrankedMemRefType` from the unpacked elements of a MemRef
descriptor or from a bare pointer.

The extra checks ensure that the inputs to the materialization function
are correct. It is possible that a user added extra type conversion
rules that convert MemRef types in a different way and the extra checks
ensure that we construct a MemRef descriptor only if the inputs are what
we expect.

This commit also drops a check around bare pointer materializations:
```
// This is a bare pointer. We allow bare pointers only for function entry
// blocks.
```
This check should not be part of the materialization function. Whether a
MemRef block argument is converted into a MemRef descriptor or a bare
pointer is decided in the lowering pattern. At the point of time when
materialization functions are executed, we already made that decision
and we should just materialize regardless of the input format.
2024-11-24 12:20:09 +09:00
Congcong Cai
ed1d90ca11
[clang][NFC] simplify the unset check in ParseLabeledStatement (#117430)
`!isInvalid && !isUsable -> !isInvalid && !(!isInvalid && !isUnset) ->
isUnset`
It is more simple to understand.
2024-11-24 10:59:41 +08:00
NAKAMURA Takumi
c894d3a846 Fixup a test for #116330, to make REQUIRES:asserts
`-debug-only` is available only in +Asserts.
2024-11-24 11:43:44 +09:00
Fangrui Song
a87f776c1c [ELF] Avoid make in elf::writeARMCmseImportLib 2024-11-23 17:28:28 -08:00
LiqinWeng
48b13ca48b
[RISCV][CostModel] cost of vector cttz/ctlz under ZVBB (#115800) 2024-11-24 09:18:18 +08:00
Fangrui Song
e4e5206050 [ELF] Make OutputDesc unique_ptr
Store them in LinkerScript::descPool. This removes a SpecificAlloc
instantiation, makes lld smaller, and drops the small memory waste due
to the separate BumpPtrAllocator.
2024-11-23 17:14:43 -08:00
LiqinWeng
042a1cc553
[VPlan] Generalize type inference for binary/cast/shift/logic. NFC (#116173) 2024-11-24 09:14:14 +08:00
Louis Dionne
afae1a5f32
[libc++] Remove _LIBCPP_DISABLE_AVAILABILITY macro (#112952)
This was slated for removal years ago, so now's a good time to remove it.
2024-11-23 20:02:15 -05:00
Sergei Barannikov
cf9b4281c1
[ARC] Fix ARCISD::BRcc description (#117454)
Follow-up to #117375.
2024-11-24 04:01:26 +03:00
Fangrui Song
099a52fd2f [ELF] Reorder SectionBase/InputSectionBase members
Move `sectionKind` outside the bitfield and move bss/keepUnique to
InputSectionBase.

* sizeof(InputSection) decreases from 160 to 152 on 64-bit systems.
* The numerous `sectionKind` accesses are faster.
2024-11-23 16:34:21 -08:00
Fangrui Song
a5af6214dd [ELF] Make SyntheticSection parameter order match InputSection
And rename `/*alignment=*/` to `/*addralign=*/`
2024-11-23 15:16:36 -08:00
Fangrui Song
d4bed617f4 [ELF] -r: keep sh_entsize for SHF_MERGE sections with relocations
Follow-up to the NFC refactoring
43e3871a327b8e2ff57e16b46d5bc44beb430d91 and test cleanup
3cecf17065919da0a7fa9b38f37592e5462c2f85.

SHF_MERGE sections with relocations are handled as InputSection (without
duplicate elimination). The output section retains the original
sh_entsize in non-relocatable links. This patch ports the behavior for
relocatable links as well.

https://github.com/ClangBuiltLinux/linux/issues/2057
2024-11-23 14:32:32 -08:00
Kazu Hirata
d6e6478e95
[memprof] Remove a dead constructor in AllocationInfo (NFC) (#117427)
This patch removes a dead constructor in AllocationInfo.  We used to
use it for MemProf Version 1 deserialization purposes via
MemProfRecord::MemProfRecord.
2024-11-23 14:31:44 -08:00
Fangrui Song
43e3871a32 [ELF] Make section member orders consistent
SectionBase, InputSectionBase, InputSection, MergeInputSection, and
OutputSection have different member orders. Make them consistent and
adopt the order similar to the raw Elf64_Shdr.
2024-11-23 14:22:24 -08:00
Fangrui Song
3cecf17065 [ELF] Refactor merge-* tests 2024-11-23 12:46:35 -08:00
Helena Kotas
dc4c8de179
Revert "[HLSL] Add Increment/DecrementCounter methods to structured buffers (#114148)" (#117448)
This reverts commit 94bde8cdc39ff7e9c59ee0cd5edda882955242aa.
2024-11-23 12:02:07 -08:00
Craig Topper
213b849c5e [RISCV][GISel] Use libcalls for some FP instructions when F/D aren't present.
This is based on what fails when adding integer only RUN lines to
float-intrinsics.ll and double-intrinsics.ll.

We're still missing a lot of test cases that SelectionDAG has. These
will be added in future patches.
2024-11-23 11:43:14 -08:00
Mehdi Amini
c8b837ad8c
[MLIR][Python] Add the --mlir-print-ir-tree-dir to the C and Python API (#117339) 2024-11-23 20:17:25 +01:00
Florian Hahn
e2519b674c
[VPlan] Print incoming VPBB for Phi VPIRInstruction (NFC).
Print the incoming block for Phi VPIRInstructions, for better debugging
& testing.
2024-11-23 19:06:58 +00:00
David Green
28064bfad1 [AArch64][GlobalISel] Update and cleanup a number of gisel tests. NFC
Mostly removing unnecessary -global-isel-abort=2 or adding fallback messages
2024-11-23 18:58:55 +00:00
M. Zeeshan Siddiqui
5f9db0876a
Allow SymbolUserOpInterface operators to be used in RemoveDeadValues Pass (#117405)
This change removes the restriction on `SymbolUserOpInterface` operators
so they can be used with operators that implement `SymbolOpInterface`,
example:

`memref.global` implements `SymbolOpInterface` so it can be used with
`memref.get_global` which implements `SymbolUserOpInterface`

```
// Define a global constant array
memref.global "private" constant @global_array : memref<10xi32> = dense<[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]> : tensor<10xi32>

// Access this global constant within a function
func @use_global() {
  %0 = memref.get_global @global_array : memref<10xi32>
}
```

Reference: https://github.com/llvm/llvm-project/pull/116519 and
https://discourse.llvm.org/t/question-on-criteria-for-acceptable-ir-in-removedeadvaluespass/83131

---------

Co-authored-by: Zeeshan Siddiqui <mzs@ntdev.microsoft.com>
2024-11-23 19:37:29 +01:00
Kazu Hirata
14b9ca3f38 [Sema] Fix a warning
This patch fixes:

  clang/lib/Sema/SemaHLSL.cpp:2225:32: error: absolute value function
  'abs' given an argument of type 'int64_t' (aka 'long') but has
  parameter of type 'int' which may cause truncation of value
  [-Werror,-Wabsolute-value]
2024-11-23 10:29:11 -08:00
Sergei Barannikov
b3363104d3
[UTC] Add support for Xtensa (#117441)
Regenerate the failing test as well.
2024-11-23 20:43:05 +03:00
Helena Kotas
94bde8cdc3
[HLSL] Add Increment/DecrementCounter methods to structured buffers (#114148)
Introduces `__builtin_hlsl_buffer_update_counter` clang buildin that is
used to implement the `IncrementCounter` and `DecrementCounter` methods
on `RWStructuredBuffer` and `RasterizerOrderedStructuredBuffer` (see
Note).

The builtin is translated to LLVM intrisic `llvm.dx.bufferUpdateCounter`
or `llvm.spv.bufferUpdateCounter`.

Introduces `BuiltinTypeMethodBuilder` helper in `HLSLExternalSemaSource`
that enables adding methods to builtin types using builder pattern like
this:
```
   BuiltinTypeMethodBuilder(Sema, RecordBuilder, "MethodName", ReturnType)
       .addParam("param_name", Type, InOutModifier)
       .callBuiltin("buildin_name", { BuiltinParams })
       .finalizeMethod();
```

Fixes #113513
2024-11-23 09:33:38 -08:00