474356 Commits

Author SHA1 Message Date
Timm Baeder
fedc982731
[clang][Diagnostics] Add source range to uninitialized diagnostics (#65896)
Before:

```
array.cpp:319:10: note: read of uninitialized object is not allowed in a constant expression
  319 |    return aaa;
      |           ^
```

After:

```
array.cpp:319:10: note: read of uninitialized object is not allowed in a constant expression
  319 |    return aaa;
      |           ^~~
```
2023-09-11 07:03:18 +02:00
Phoebe Wang
8a584079de
[X86][EVEX512] Restrict attaching EVEX512 for default CPU only, NFCI (#65920)
Attaching EVEX512 is used to provide backward compatibility for legacy
LLVM IR files, which didn't set EVEX512 feature explicitly.

AVX512 and AVX10 targets have set or unset EVEX512 properly through
X86.td.

However, it's not feasible to list all AVX512 and AVX10 targets or their
complementary set here to skip/restrict such code.

Instead, we can restrict it for default CPU only. "generic" is used when
"target-cpu" is not specified in IR, while "pentium4" and "x86-64" is
the default CPU if "-march" is not specified in Clang for 32-bit and
64-bit targets respectively.

This patch is no functional change intended, though it might affect
scenarios like "-march=broadwell -mavx512bw", which looks like a misuse
of "-march" and can be solved by changing to "-mtune=broadwell
-mavx512bw".
2023-09-11 12:49:35 +08:00
Carl Ritson
1d8a94c4ff [AMDGPU] SILowerControlFlow: fix preservation of LiveIntervals
In emitElse live interval for SI_ELSE source must be recalculated
as SI_ELSE is removed, and new user is placed at block start.
In emitIfBreak live interval for new created AndReg must be
computed.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D158141
2023-09-11 13:46:28 +09:00
Shivam Gupta
7b7470600c [llvm-objdump] --adjust-vma adjust symbol table
Add a shouldAdjustVA(Section) guard on top of address update.

Update llvm-objdump file to update symbol table when --adjust-vma used.

Fixes #63203

Patch by HamidrezaSK (Hamidreza Sanaee)
2023-09-11 09:57:27 +05:30
Carl Ritson
46ee3b3914
[AMDGPU] SILowerI1Copies: clear kill flags on COPY (#65883)
Clear kill flags on COPY source as it will be reused.
2023-09-11 12:30:08 +09:00
Jan Svoboda
797cad9d32 [clang] NFCI: Use FileEntryRef in 'clang-tools-extra' 2023-09-10 19:53:54 -07:00
Jan Svoboda
b19fe81eb5 [clang][deps] NFCI: Use FileEntryRef in ModuleDepCollectorPP 2023-09-10 19:53:54 -07:00
liqin.weng
a0b49f47d4 [VP] more functional Intrinsic to definitions
1. Remove the 'experiment' of reduction's intrinsic name
2. Add functional Intrinsic for smax/smin/umax/umin/copysign/maxnum/minnum

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D159493
2023-09-11 10:26:31 +08:00
Ye Luo
c9733b8a9e
[libomptarget][NFC]Rename targetDataMapper to targetDat in interface.cpp (#65915)
In omptarget.cpp, there is a targetDataMapper which does mapper related
operations.
In interface.cpp, targetDataMapper function template is simply needed
for handling TargetAsyncInfoTy. Thus it is better to name it as simple
as targetData similar to targetKernel.
2023-09-10 21:08:11 -05:00
Johannes Doerfert
d47cf2bff3
[OpenMPOpt] Allow indirect calls in AAKernelInfoCallSite (#65836)
The Attributor has gained support for indirect calls but it is opt-in.
This patch makes AAKernelInfoCallSite able to handle multiple potential
callees.
2023-09-10 19:02:09 -07:00
Shengchen Kan
503e3a4130
[X86] Remove _REV instructions from the EVEX2VEX tables (#65752)
_REV instruction should not appear before encoding optimization, so
there is no chance to compress it during MIR optimizations.
2023-09-11 09:54:05 +08:00
Kohei Yamaguchi
ca8cf90c8c
[mlir][tensor] Check the EmptyOp's dynamicSize to be non-negative (#65577)
This patch addresses a crash that occurs when negative dynamic sizes are
provided in tensor.emptyOp by adding a check to ensure that dynamic
sizes are non-negative.

Fixes #64064
2023-09-10 18:38:54 -07:00
Vitaly Buka
2873a9ae27 [symbolizer] Check if dependecy exist
Deppending on how we build compiler-rt, as a project,
or as runtime, tools needed to build can be prebuilt or
exist as a target.
2023-09-10 16:58:49 -07:00
Vitaly Buka
8362ddb657 [test][sanitizer] Reduce output noise in test 2023-09-10 16:51:39 -07:00
Vitaly Buka
5361a0a38f [NFC][cmake] Sort COMPILER_RT_TEST_SUITES 2023-09-10 16:51:38 -07:00
Mehdi Amini
5862ed2878
Update CONTRIBUTING.md to remove the not about not accepting PR 2023-09-10 15:21:06 -07:00
Fangrui Song
0649594e24 [M68k] Swap operands of atomic_store after D123143 2023-09-10 15:17:30 -07:00
Fangrui Song
61c44f1822 [X86] FastISel -fno-pic: emit R_386_PC32 when calling an intrinsic
This matches how a SelectionDAG::getExternalSymbol node is lowered. On x86-32, a
function call in -fno-pic code should emit R_386_PC32 (since ebx is not set up).
When linked as -shared (problematic!), the generated text relocation will work.

Ideally, we should mark IR intrinsics created in
CodeGenFunction::EmitBuiltinExpr as dso_local, but the code structure makes it
not very feasible.

Fix #51078
2023-09-10 15:03:36 -07:00
Tianlan Zhou
057564fec5
Fix some typos in comments: evalute -> evaluate (NFC) (#65906) 2023-09-11 04:11:06 +08:00
Fangrui Song
9f77facfce [Driver] Properly report error for unsupported powerpc darwin/macos triples
The removal started at https://reviews.llvm.org/D50989 and
https://reviews.llvm.org/D75494 removed the Triple support. Without recognizing
Darwin triples as Mach-O, we will get assertion error in ToolChains/Darwin.h due
to the universal binary mechanism.

Fix #47698
2023-09-10 13:06:27 -07:00
Billy Laws
97fe519dd2
[Clang][AArch64] Define x86_64 macros for ARM64EC targets (#65420)
The ARM64EC ABI requires that struct layouts match between regular
x86_64 code and ARM64EC code. Ensure this is always the case by defining
the same set of macros as are set when targeting x86_64 but with the
addition of `__arm64ec__/_M_ARM64EC` macros that can be used for any
ARM64EC specific code.

More details can be found here:
https://techcommunity.microsoft.com/t5/windows-os-platform-blog/getting-to-know-arm64ec-defines-and-intrinsic-functions/ba-p/2957235
2023-09-10 23:06:08 +03:00
Owen Pan
9ae41a1472 [clang-format][doc] Fix a '' (in c669541c969c) that meant to be `` 2023-09-10 12:52:49 -07:00
Fangrui Song
8d7a523923 [Driver] Remove remnant PowerPC Darwin code
Continue the work started at https://reviews.llvm.org/D50989
2023-09-10 12:37:06 -07:00
Yingwei Zheng
821c332b53
[ConstraintElim] Add missing checks in test_overflow_in_negate_constraint (#65841)
This patch adds missing checks in the function
`test_overflow_in_negate_constraint`.
Related commit: 0a0181dc2061fc60b309f231a5b2f6251046c552
2023-09-11 02:52:26 +08:00
Simon Pilgrim
63af54a84e [AArch64] ushl_sat.ll - regenerate checks. NFC.
Add missing asm comments to reduce a future diff.
2023-09-10 19:45:20 +01:00
Yingwei Zheng
44e5afdb91
[InstCombine] Generalize foldICmpWithMinMax
This patch generalizes the fold of `icmp pred min/max(X, Y), Z` to address the issue https://github.com/llvm/llvm-project/issues/62898.

For example, we can fold `smin(X, Y) < Z` into `X < Z` when `Y > Z` is implied by constant folds/invariants/dom conditions.

Alive2 (with `--disable-undef-input` due to the limitation of --smt-to=10000): https://alive2.llvm.org/ce/z/rB7qLc
You can run the standalone translation validation tool `alive-tv` locally to verify these transformations.
```
alive-tv transforms.ll --smt-to=600000 --exit-on-error
```

Reviewed By: goldstein.w.n

Differential Revision: https://reviews.llvm.org/D156238
2023-09-11 02:26:48 +08:00
Yingwei Zheng
32ad45556e
[InstCombine] Add test cases from PR62898. NFC.
This patch adds some test cases from https://github.com/llvm/llvm-project/issues/62898.

As nikic noted in the issue, we should start by implementing a generalization of the fold `smin(X, Y) < Z -> X < Z` when `Y > Z` is implied by constant folds/invariants/dom conditions.
```
define i1 @src(i32 %x, i32 %y, i32 %z) {
  %cmp = icmp sgt i32 %y, %z
  br i1 %cmp, label %if, label %end
if:
  %cond = call i32 @llvm.smin.i32(i32 %x, i32 %y)
  %tobool = icmp slt i32 %cond, %z
  ret i1 %tobool
end:
  ret i1 false
}

define i1 @tgt(i32 %x, i32 %y, i32 %z) {
  %cmp = icmp sgt i32 %y, %z
  br i1 %cmp, label %if, label %end
if:
  %tobool = icmp slt i32 %x, %z
  ret i1 %tobool
end:
  ret i1 false
}

declare i32 @llvm.smin.i32(i32, i32)
```
Alive2: https://alive2.llvm.org/ce/z/dK9vXz

This patch also adds some generalized test cases like the above.

Reviewed By: goldstein.w.n

Differential Revision: https://reviews.llvm.org/D156227
2023-09-11 02:26:47 +08:00
Jay Foad
fd453e2381 [TwoAddressInstruction] Use member functions instead of static helpers
This just avoids explicitly passing around common pointers like MRI and
TII. NFC.
2023-09-10 18:33:57 +01:00
Jan Svoboda
d9c82e1919 [AIX][tests] Temporarily disable more Clang/Index tests
This extends 985dacea by XFAILing more tests that started failing after these commits:
* 14498a477ee9e00dc462779cee8cbc5846ca6d3a
* e644f5973b0b71baadc6d7b64596527a1dc49d17
* 89bacc0bb9f6aa66ca1951ec5c0e4c38cc661160

These failures need to be investigated. Possible cause is D151938.
2023-09-10 10:03:27 -07:00
Mark de Wever
2a0f2fa9d1 [libc++] Use inline instead of static in headers.
This has been tested as part of D156609.
2023-09-10 18:54:06 +02:00
Jan Svoboda
7ad5b18522 [clang] NFCI: Use FileEntryRef in ASTWriter 2023-09-10 09:36:47 -07:00
Jan Svoboda
45bf8e432b [clang] NFCI: Use FileEntryRef in ASTReader 2023-09-10 09:36:47 -07:00
Piotr Zegar
503e31528a
[clang-tidy] Exclude bitwise operators in bugprone-non-zero-enum-to-bool-conversion (#65498)
Improved bugprone-non-zero-enum-to-bool-conversion check by eliminating
false positives resulting from direct usage of bitwise operators.
2023-09-10 18:08:51 +02:00
Simon Pilgrim
76c09d9c5e [X86] matchIndexRecursively - don't peek through multiuse sext(add_nsw(x,c)) (PR65895)
Fixes #65895
2023-09-10 16:54:18 +01:00
Yingwei Zheng
780b046bd0
[InstCombine] Use m_c_And/m_c_Or instead of duplicate logic. NFC.
See also https://reviews.llvm.org/D153148#inline-1535588
2023-09-10 23:34:23 +08:00
Jan Svoboda
7560356a83 [clang] NFCI: Use FileEntryRef in FileRemapper (2/2) 2023-09-10 08:19:26 -07:00
Jan Svoboda
3817c8a4e6 [clang] NFCI: Use FileEntryRef in FileRemapper (1/2) 2023-09-10 08:19:26 -07:00
Congcong Cai
91a848bc89 Revert "[Demangle] demangle builtin type transformations"
This reverts commit 31cc069b5f4cb1b120c72f4dcbaa1b5a212120df.
2023-09-10 23:18:43 +08:00
Congcong Cai
31cc069b5f [Demangle] demangle builtin type transformations
Fixed: https://github.com/llvm/llvm-project/issues/62127
https://reviews.llvm.org/D116203 introduced several compiler builtin
equivalents of the unary type traits. In some cases (e.g. template) those
builtin will be dependent and need to be mangle.
This patch add the check for `u{builtin}I{type}E` to demangle it.

Reviewed By: rjmccall

Differential Revision: https://reviews.llvm.org/D148465
2023-09-10 23:13:26 +08:00
Alex Brachet
89471d50e8
[Fuchsia] Disable libcxx timezone database (#65870)
tzdb is currently broken when cross compiling from non Linux to Linux.
Lets just disable it totally in our toolchain for now. We should remove
this when #65859 lands.
2023-09-10 10:04:04 -04:00
Ignat Loskutov
f2e5000937 [clang-tidy] Fix DanglingHandleCheck to work in C++17 and later mode
Due to guaranteed copy elision, not only do some nodes get removed from the AST,
but also some existing nodes change the source locations they correspond to.
Hence, the check works slightly differently in pre-C++17 and C++17-and-later modes
in terms of what gets highlighted.

Reviewed By: PiotrZSL

Differential Revision: https://reviews.llvm.org/D158371
2023-09-10 12:52:47 +00:00
Piotr Zegar
01c11569fc [clang-tidy] Add IgnoreTypes option to modernize-use-nullptr
New option added and configured in a way, so types
related to std::strong_ordering would be ignored.

Fixes: #63478

Reviewed By: ccotter

Differential Revision: https://reviews.llvm.org/D158928
2023-09-10 12:22:53 +00:00
David Green
4e52fd8468 [AArch64] Add GlobalISel coverage for BIT/BIF/BSL. NFC
Some of the 1x vector types are expanded to scalar, but the others that do not
require constants looks OK.
2023-09-10 13:02:35 +01:00
David Green
41fd143244 [AArch64][GlobalISel] Fix || / && precedence warning in assert. NFC 2023-09-10 12:48:44 +01:00
Christian Sigg
710b5a1232
Fix logic to detect cl::option equality. (#65754)
This is a new attempt of https://reviews.llvm.org/D159481, this time as
GitHub PR.

`GenericOptionValue::compare()` should return `true` for a match.

- `OptionValueBase::compare()` always returns `false` and shouldn't
match anything.
- `OptionValueCopy::compare()` returns `false` if not `Valid` which
corresponds to no match.

Also adding some tests.
2023-09-10 12:25:19 +02:00
Brad Smith
18b6e2139f
[Driver] Replace usage of -Bshareable linker flag with -shared (#65842)
The two flags mean the same thing for the bfd / lld linkers so just use
the same flag consistently everywhere.
2023-09-10 04:35:58 -04:00
Younan Zhang
cbd6ac6165 [clangd] Show parameter hints for operator()
Closes https://github.com/clangd/clangd/issues/1742

Reviewed By: nridge

Differential Revision: https://reviews.llvm.org/D158926
2023-09-10 15:56:00 +08:00
Matt Arsenault
17bd80601e AMDGPU: Implement llvm.get.fpmode
Currently s_getreg_b32 is missing the possible mode use. Really we
need separate pseudos for mode-only accesses, but leave this as a
pre-existing issue.

https://reviews.llvm.org/D152710
2023-09-10 10:19:19 +03:00
Fangrui Song
21ac457f3f [ELF] Priorize the last catch-all pattern in version scripts
When there are multiple catch-all patterns (i.e. a single `*`), GNU ld and gold
select the last pattern. Match their behavior.

This change was inspired by a correction made by Michael Kerrisk to a blog post
I wrote at https://maskray.me/blog/2020-11-26-all-about-symbol-versioning ,
following the current lld rules.

Note: GNU ld prefers global: patterns to local: patterns, which might seem
awkward (https://www.airs.com/blog/archives/300). gold doesn't follow this
behavior, and we do not either.
2023-09-09 23:47:01 -07:00
Jan Svoboda
89bacc0bb9 [clang] NFCI: Use FileEntryRef in CreateHeaderMap() 2023-09-09 21:51:04 -07:00