515554 Commits

Author SHA1 Message Date
Max191
2bff9d9ffe
[mlir] Don't hoist transfers from potentially zero trip loops (#112752)
The hoistRedundantVectorTransfers function does not verification of loop
bounds when hoisting vector transfers. This is not safe in general,
since it is possible that the loop will have zero trip count. This PR
uses ValueBounds to verify that the lower bound is less than the upper
bound of the loop before hoisting. Trip count verification is currently
behind an option `verifyNonZeroTrip`, which is false by default.

Zero trip count loops can arise in GPU code generation, where a loop
bound can be dependent on a thread id. If not all threads execute the
loop body, then hoisting out of the loop can cause these threads to
execute the transfers when they are not supposed to.

---------

Signed-off-by: Max Dawkins <max.dawkins@gmail.com>
2024-10-18 16:11:21 -04:00
Max191
98e838a890
[mlir] Do not bufferize parallel_insert_slice dest to read for full slices (#112761)
In the insert_slice bufferization interface implementation, the
destination tensor is not considered read if the full tensor is
overwritten by the slice. This PR adds the same check for
tensor.parallel_insert_slice.

Adds two new StaticValueUtils:
- `isAllConstantIntValue` checks if an array of `OpFoldResult` are all
equal to a passed `int64_t` value.
- `areConstantIntValues` checks if an array of `OpFoldResult` are all
equal to a passed array of `int64_t` values.

fixes https://github.com/llvm/llvm-project/issues/112435

---------

Signed-off-by: Max Dawkins <max.dawkins@gmail.com>
2024-10-18 16:02:03 -04:00
Alexey Bataev
f148d5791b
[LV]Initial support for safe distance in predicated DataWithEVL vectorization mode.
Enabled initial support for max safe distance in DataWithEVL mode. If
max safe distance is required, need to emit special code:
CMP = icmp ult AVL, MAX_SAFE_DISTANCE
SAFE_AVL = select CMP, AVL, MAX_SAFE_DISTANCE
EVL = call i32 @llvm.experimental.get.vector.length(i64 SAFE_AVL)

while vectorize the loop in DataWithEVL tail folding mode.

Reviewers: fhahn

Reviewed By: fhahn

Pull Request: https://github.com/llvm/llvm-project/pull/102897
2024-10-18 15:51:49 -04:00
Alexey Bataev
7f2e937469 [SLP]Initial non-power-of-2 support (but still whole register) for reductions
Enables initial non-power-of-2 support (but still requires number of
elements, forming whole registers) for reductions.
Enables extra vectorization for
MultiSource/Benchmarks/7zip/7zip-benchmark, CINT2006/464.h264ref and
CFP2017rate/526.blender_r (checked for SSE2)

Reviewers: RKSimon

Reviewed By: RKSimon

Pull Request: https://github.com/llvm/llvm-project/pull/112361
2024-10-18 12:50:11 -07:00
Vitaly Buka
9a4661cf31 [nfc][ubsan] Fix case of UNSUPPORTED: 2024-10-18 12:39:24 -07:00
Vitaly Buka
203b972289
[ubsan] Disable test on Darwin
Broken after #111497
2024-10-18 12:38:07 -07:00
Vitaly Buka
53e85d44ad
[nfc][ubsan] Reorder RUNs and preconditions in test 2024-10-18 12:35:59 -07:00
Max191
1ae24460d2
[mlir] Add forall canonicalization to replace constant induction vars (#112764)
Adds a canonicalization pattern for scf.forall that replaces constant
induction variables with a constant index. There is a similar
canonicalization that completely removes constant induction variables
from the loop, but that pattern does not apply on foralls with mappings,
so this one is necessary for those cases.

---------

Signed-off-by: Max Dawkins <max.dawkins@gmail.com>
2024-10-18 15:21:01 -04:00
lntue
952dafb08e
[libc][math] Add test and fix atan2f crashing when flush-denorm-to-zero (FTZ) and denorm-as-zero (DAZ) modes are set. (#112828) 2024-10-18 14:56:23 -04:00
alx32
caa9e41814
[lld-macho] Fix category merging sed issue (#112955)
Fix 'sed' spacing to ensure compatibility with all platforms. 

Original failure:
https://lab.llvm.org/buildbot/#/builders/190/builds/7903
```
RUN: at line 33: sed -E '/^__OBJC_\$_CATEGORY_MyBaseClass_\$_Category01:/ { n; s/^[ \t]*\.quad[ \t]+l_OBJC_CLASS_NAME_$/\t.quad\tL_OBJC_IMAGE_INFO+3/ }' merge_cat_minimal.s > merge_cat_minimal_bad_name.s
+ sed -E '/^__OBJC_\$_CATEGORY_MyBaseClass_\$_Category01:/ { n; s/^[ \t]*\.quad[ \t]+l_OBJC_CLASS_NAME_$/\t.quad\tL_OBJC_IMAGE_INFO+3/ }' merge_cat_minimal.s
sed: 1: "/^__OBJC_\$_CATEGORY_My ...": bad flag in substitute command: '}'
```
2024-10-18 11:51:21 -07:00
Vitaly Buka
d60fdc1ca3
[nfc][lsan] Parametrize ScanForPointers with loader (#112803)
Use `DirectLoader` which is equivalent to existing
behaviour of loading pointers directly from memory.
2024-10-18 11:42:13 -07:00
Brandon Wu
e3b22dcedb
[clang][RISCV] Extend intrinsic size check variable from 16 -> 32 bits. NFC (#111481)
We currently have over 67000 intrinsics, uint16_t will overflow.
2024-10-18 11:36:19 -07:00
lntue
170dab9972
[libc][math] Fix signed zeros for powf when underflow happens. (#112601) 2024-10-18 14:26:05 -04:00
HighW4y2H3ll
629a182282
Full path names are used in several unittests instead of the binary name. Fix up the testcase failures (#107974)
Encountered several testcase failures when running `ninja check-all`. It
was due to the full path name were shown in the error message instead of
the binary name, and therefore causing the check string mismatch.

The machine was running CentOS 9 with binfmt_misc setup that uses
qemu-aarch64 (8.1.2). Built and ran the unittest as aarch64 host
(through qemu user).

Co-authored-by: h2h <h2h@meta.com>
2024-10-18 11:16:57 -07:00
David Blaikie
266154a59b
[ADT] Make concat able to handle ranges with iterators that return by value (such as zip) (#112783)
If any iterator in the concatenation returns by value, the result must
return by value otherwise it'll produce dangling references.

(some context that may or may not be relevant to this part of the code
may be in
981ce8fa15
)

An alternative to #112441
2024-10-18 11:15:02 -07:00
David Green
7e87c2ae5d [AArch64] Add some qshrn test cases. NFC 2024-10-18 19:05:57 +01:00
alx32
f9d3e98207
[lld-macho] Improve robustness of ObjC category merging (#112618)
This patch enhances the robustness of lld's Objective-C category
merging. Currently, the category merger assumes it can fully parse and
understand the format of all categories in the input, triggering an
assert if any invalid category data is encountered.

This will end up causing asserts in certain rare corner cases that are
difficult to reproduce in small test cases. The proposed changes modify
the behavior so that if invalid category data is detected, category
merging is skipped for that specific class and all other categories
sharing the same base class. This approach allows the linker to continue
processing other categories without failing entirely due to a single
problematic input.

We also add a LIT test to where we corrupt category data and check that
category merging for that class was skipped but the link was successful.
2024-10-18 11:03:16 -07:00
Teresa Johnson
5995e4b97b
[MemProf] Disable memprof ICP support by default (#112940)
A failure showed up after this was committed, rather than revert simply
disable this new support to simplify investigation and further testing.
2024-10-18 10:40:27 -07:00
Kazu Hirata
a01d7df090
[lldb] Avoid repeated map lookups (NFC) (#112823) 2024-10-18 10:40:13 -07:00
Daniel Paoliello
9120adea50
Fix build break in SemaHLSL.cpp on MSVC 2022: warning C4715: 'getResourceClass': not all control paths return a value (#112767)
Moves the existing `llvm_unreachable` statement to the bottom of the
function and changes the case statement to deliberately fall through to
it.

Build break was introduced by #111203

It was not caught by the builders as they use Visual Studio 2019,
whereas this warning only appears in 2022.

---------

Co-authored-by: Matheus Izvekov <mizvekov@gmail.com>
2024-10-18 10:19:48 -07:00
Teresa Johnson
6264288d70
[MemProf] Fix the option to disable memprof ICP (#112917)
The -enable-memprof-indirect-call-support meant to guard the recently
added memprof ICP support was not used in enough places. Specifically,
it was not checked in mayHaveMemprofSummary, which is called from the
ThinLTO backend applyImports. This led to failures when checking the
callsite records, as we incorrectly expected records for indirect calls.

Fix the option to be checked in all necessary locations, and add
testing.
2024-10-18 10:12:23 -07:00
Jinsong Ji
6c60ead15a
[NFC] Fix Werror=extra warning related to mismatched enum type (#112808)
This is one of the many PRs to fix errors with LLVM_ENABLE_WERROR=on.
Built by GCC 11.

Fix warnings:

llvm-project/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp: In member
function ‘void llvm::AsmPrinter::emitJumpTableSizesSection(const
llvm::MachineJumpTableInfo*, const llvm::Function&) const’:
llvm-project/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:2852:31: error:
enumerated and non-enumerated type in conditional expression
[-Werror=extra]
 2852 |     int Flags = F.hasComdat() ? ELF::SHF_GROUP : 0;
      |                 ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
2024-10-18 13:07:37 -04:00
vporpo
a24a420c2b
[SandboxIR] Implement FPMathOperator (#112921)
This patch implements sandboxir::FPMathOperator mirroring
llvm::FPMathOperator
2024-10-18 10:02:16 -07:00
Jinsong Ji
6a623e8484
[NFC] add DiagnosticsTestHelper decl (#112820)
This is one of the many PRs to fix errors with LLVM_ENABLE_WERROR=on.
Built by GCC 11.

Fix warning

llvm-project/clang/unittests/Basic/DiagnosticTest.cpp:19:6: error: ‘void
clang::DiagnosticsTestHelper(clang::DiagnosticsEngine&)’ has not been
declared within ‘clang’ [-Werror]
   19 | void clang::DiagnosticsTestHelper(DiagnosticsEngine &diag) {
      |      ^~~~~
In file included from
llvm-project/clang/unittests/Basic/DiagnosticTest.cpp:9:
llvm-project/clang/include/clang/Basic/Diagnostic.h:567:15: note: only
here as a ‘friend’
  567 |   friend void DiagnosticsTestHelper(DiagnosticsEngine &);
2024-10-18 12:53:59 -04:00
Jinsong Ji
8182f8176e
[NFC] Fix c++ style comment in c file (#112814)
This is one of the many PRs to fix errors with LLVM_ENABLE_WERROR=on.
Built by GCC 11.

Fix warnings:
llvm-project/clang/include/clang-c/Index.h:2983:3: error: C++ style
comments are not allowed in ISO C90 [-Werror]
 2983 |   // HLSL Types
2024-10-18 12:51:29 -04:00
Simon Pilgrim
7da0a69852 [X86] andnot-patterns.ll - add non-BMI test coverage
Extra test coverage for #112547 to test cases where we don't create a ANDNOT instruction
2024-10-18 17:43:57 +01:00
Simon Pilgrim
3a91611f3b [X86] Ensure the AVX1-only broadcast-load patterns are in the same place. NFC. 2024-10-18 17:43:57 +01:00
David Green
0f3ed9c650 [ARM] Use ARM::NoRegister in more places. NFC
Similar to #112507, this uses ARM::NoRegister in a few more places, as opposed
to the constant 0.
2024-10-18 17:39:21 +01:00
Jinsong Ji
9d7b35d4e1
[NFC][GOFF] Fix char overflow (#112826)
This is one of the many PRs to fix errors with LLVM_ENABLE_WERROR=on.
Built by GCC 11.

Fix warnining:

llvm/unittests/Object/GOFFObjectFileTest.cpp:511:17: error: overflow in
conversion from ‘int’ to ‘char’ changes value from ‘240’ to
‘'\37777777760'’ [-Werror=overflow]
  511 |   GOFFData[1] = 0xF0;
2024-10-18 12:16:28 -04:00
knickish
e13f1d1daf
[M68k] ARII atomic load/store (#108982)
Only ARI was supported, this PR adds ARII support for atomic
loads/stores (also with zero displacement). Closes #107939
2024-10-18 23:49:26 +08:00
Mohammed Keyvanzadeh
721b796809
[llvm] prefer isa_and_nonnull over v && isa (#112541)
Use `isa_and_nonnull<T>(v)` instead of `v && isa<T>(v)`, where `v` is
evaluated twice in the latter.
2024-10-18 19:12:04 +03:30
Kazu Hirata
a99bf0f6c9
[llvm-readtapi] Simplify code with StringMap::operator[] (NFC) (#112824) 2024-10-18 08:40:05 -07:00
Kazu Hirata
9f264e4d2f
[BOLT] Avoid repeated hash lookups (NFC) (#112822) 2024-10-18 08:39:31 -07:00
A. Jiang
397707f718
[libc++] __uglify non-conforming member typedef base (#112843)
Currently, libc++'s `bitset`, `forward_list`, and `list` have
non-conforming member typedef name `base`. The typedef is private, but
can cause ambiguity in name lookup.

Some other classes in libc++ that are either implementation details or
not precisely specified by the standard also have member typdef `base`.
I think this can still be conforming.

Follows up #80706 and #111127.
2024-10-18 23:27:12 +08:00
LLVM GN Syncbot
dbe47c2a06 [gn build] Port 54566ba52304 2024-10-18 15:14:44 +00:00
vporpo
54566ba523
[SandboxIR] Implement Operator (#112805)
This patch implements sandboxir::Operator mirroring llvm::Operator.
2024-10-18 08:14:14 -07:00
Joseph Huber
00d30bd61e [libc] Commit document formatting change someone left 2024-10-18 10:09:28 -05:00
Jay Foad
922992a22f
Fix typo "instrinsic" (#112899) 2024-10-18 15:58:33 +01:00
Rahul Joshi
62e2c7fb2d
[LLVM][TableGen] Change all Init pointers to const (#112705)
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-10-18 07:50:22 -07:00
Joseph Huber
c27aae0035 [Offload] Fix not copying the buffer identifier of offloading files
Summary:
This caused an error when copying a file of the same name when multiple
architectures needed the file. The buffer identifier which we use for
the name in `-save-temps` mode would be empty and create in invalid
filename. Copy this correctly now.
2024-10-18 09:47:34 -05:00
Jay Foad
68efaaafe4 [TableGen] Remove unused tokens FalseKW and TrueKW
These were introduced in https://reviews.llvm.org/D90635 but never used.
2024-10-18 15:41:22 +01:00
Andrzej Warzyński
0a3347dc63
[mlir][linalg] Fix idx comparison in the vectorizer (#112900)
Fixes loop comparison condition in the vectorizer.

As that logic is used specifically for vectorising `tensor.extract`, I
also added a test that violates the assumptions made inside
`getTrailingNonUnitLoopDimIdx`, namely that Linalg loops are non-empty.
Vectorizer pre-conditions will capture that much earlier making sure
that `getTrailingNonUnitLoopDimIdx` is only run when all the assumptions
are actually met.

Thank you for pointing this out, @pfusik !
2024-10-18 15:27:43 +01:00
tltao
783901bd20
[SystemZ] Rename SystemZ ATT Asm dialect to GNU Asm dialect (#112800)
The ATT assembler dialect on SystemZ seems to have been taken from the
existing ATT/Intel code. However, on SystemZ, ATT does not hold any
meaning. In reality, we are splitting the difference between GNU Asm
syntax and HLASM Asm syntax, so it makes sense to rename ATT to GNU
instead.

Co-authored-by: Tony Tao <tonytao@ca.ibm.com>
2024-10-18 10:26:50 -04:00
wldfngrs
803220db43
[libc] changed the return cast from static_cast<float16> to fputil::cast<float16> in exp10f16.cpp. (#112889)
switch to fputil::cast to fix rounding with compiler-rt
2024-10-18 10:24:19 -04:00
Balazs Benics
1b49ee73fc
[analyzer][Solver][NFC] Cleanup const-correctness inside range-based solver (#112891) 2024-10-18 16:16:29 +02:00
Balazs Benics
67e84213f5
[analyzer][Solver] Teach SymbolicRangeInferrer about commutativity (2/2) (#112887)
This patch should not introduce much overhead as it only does one more
constraint map lookup, which is really quick.

Depends on #112583
2024-10-18 16:15:33 +02:00
Louis Dionne
90bc60c5a8
[libc++] Re-add attribute macro to clang-format (#112746)
That macro was removed incorrectly from the clang-format file because it
had a typo in its name. However, the macro with the right name is still
being used in the library (sadly, in a single place).
2024-10-18 16:11:07 +02:00
lntue
b0dbd2ca5b
[libc][math] Add option to set a specific exponent for frexp with Inf/NaN inputs. (#112387)
In IEEE 754 and C standards, when calling `frexp` with Inf/Nan inputs,
the exponent result is unspecified. In this case, FreeBSD libc and musl
just passthrough `exp`, while glibc, FreeBSD libm set exp = 0, and MSVC
set exp = -1.

By default, LLVM libc will passthrough `exp` just as FreeBSD libc and
musl, but we also allow users to explicitly choose the return exp value
in this case for compatibility with other libc.

Notice that, gcc did generate passthrough `exp` for `frexp(NaN/Inf,
exp)`: https://godbolt.org/z/sM8fEej4E
2024-10-18 09:58:15 -04:00
cor3ntin
af90e7c516
[Clang] Fix an assertion in expression recovery (#112888)
Explicit object member function calls are not modelled as member calls

Fixes #112559
2024-10-18 15:42:54 +02:00
Jay Foad
b7bc1d07d3 [CodeGen] Fix return type of PHI_iterator::getIncomingValue. NFC.
This is supposed to match ValT aka Register.
2024-10-18 14:33:45 +01:00