Commit Graph

411020 Commits

Author SHA1 Message Date
Florian Hahn 1ef9bfa013
[InstSimplify] Pass pointer and indices separately to SimplifyGEPInst.
This doesn't require callers to put the pointer operand and the indices
in a container like a vector when calling the function. This is not
really an issue with the existing callers. But when using it from
IRBuilder the inputs are available as separate pointer value and indices
ArrayRef.

Reviewed By: lebedev.ri

Differential Revision: https://reviews.llvm.org/D117038
2022-01-14 09:59:52 +00:00
Caroline Concatto 8e5a5b619d [InstCombine] Fold for masked scatters to a uniform address
When masked scatter intrinsic does a uniform store to a destination
address from a source vector, and in this case, the mask is all one value.
This patch replaces the masked scatter with an extracted element of the
last lane of the source vector and stores it in the destination vector.
This patch also folds when the value in the masked scatter is a splat.
In this case, the mask cannot be all zero, and it folds to a scalar store
of the value in the destination pointer.

Differential Revision: https://reviews.llvm.org/D115724
2022-01-14 09:44:34 +00:00
Nikita Popov 20d9c51dc0 [ConstantFold] Check for uniform value before reinterpret load
The reinterpret load code will convert undef values into zero.
Check the uniform value case before it to produce a better result
for all-undef initializers.

However, the uniform value handling will return the uniform value
even if the access is out of bounds, while the reinterpret load
code will return undef. Add an explicit check to retain the
previous result in this case.
2022-01-14 10:18:02 +01:00
Nikita Popov e7ce6acc83 [InstSimplify] Add test for load from undef (NFC)
If we're loading from an all-undef value, we sometimes still
return zero rather than undef.
2022-01-14 10:18:02 +01:00
Nikita Popov be219323a2 [GlobalOpt] Add test for SRA with i8 array type (NFC) 2022-01-14 10:18:02 +01:00
Fangrui Song 8dbc6a23bb [CMake] Do not override user specified CMAKE_{C,CXX}_ARCHIVE_FINISH on Linux
Respect the user choice, e.g. -DCMAKE_CXX_ARCHIVE_FINISH=: (to skip the
(usually) no-op step).
2022-01-14 01:10:24 -08:00
Sam McCall bba729af3e [clang-check] Adjust argument adjusters for clang-check to strip options blocking the static analyzer
Output generation options (like `-save-temps`) will make the analyzer not executed even `--analyze` option is provided in the driver arguments.
Besides, the original approach of adding `--analyze` option will not work when (more than one) `-fsyntax-only` options are provided in the driver arguments.

This patch fixes these two problems by using the syntax-only adjuster to remove output generation options and manually filter out redundant `-fsyntax-only` options.

In the new implementation, the adjusters added by `ClangTool` will not be removed but used as dependencies for clang-check adjusters for analyzer options.

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D116329
2022-01-14 10:05:47 +01:00
Zi Xuan Wu 263d1986e3 [NFC][CSKY] Remove duplicate setOperationAction in CSKYTargetLowering constructor 2022-01-14 17:01:43 +08:00
Kevin Athey a0458b531c Add -fsanitize-address-param-retval to clang.
With the introduction of this flag, it is no longer necessary to enable noundef analysis with 4 separate flags.
(-Xclang -enable-noundef-analysis -mllvm -msan-eager-checks=1).
This change only covers the introduction into the compiler.

This is a follow up to: https://reviews.llvm.org/D116855

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D116633
2022-01-14 00:41:28 -08:00
Marek Kurdej 3cf86c3611 Revert unrelated change from: [clang-format] Fix break being added to macro define with ColumnLimit: 0 2022-01-14 08:43:59 +01:00
Armen Khachkinaev 47a9eb2117 [clang-format] Fix break being added to macro define with ColumnLimit: 0
Fix for #[[ https://github.com/llvm/llvm-project/issues/49164 | 49164 ]] issue.

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, curdeius, owenpan

Differential Revision: https://reviews.llvm.org/D116859
2022-01-14 08:42:22 +01:00
Chuanqi Xu 4f4340ee2a [NFC] [Coroutines] Refactor implementation in checkFinalSuspendNoThrow
Now when we are checking if the expression `co_await
promise.final_suspend()` is not throw, we would check unconditionally
for its child expressions recursively. It takes unnecessary time. And
the compiler would complains if the implementation in final_suspend()
may throw even if the higher level function signature marked noexcept
already.

This fixes bug48453 too.
2022-01-14 15:37:01 +08:00
Mehdi Amini 8d20d83dd7 Fix a comment in CMake (NFC) 2022-01-14 07:33:06 +00:00
Mehdi Amini 46b1e83716 Do not build llc and mlir-cpu-runner to run MLIR tests with the native target isn't configured (NFC)
The relevant tests are already disabled in this case.
2022-01-14 07:30:34 +00:00
Alexander Belyaev 436d17a8e9 [mlir] Expose a function to get vector::CombiningKind from Operation*.
Differential Revision: https://reviews.llvm.org/D117283
2022-01-14 08:28:18 +01:00
Mehdi Amini 5a68a85d85 Mark some MLIR tests as requiring the native target to be configured
This makes `ninja check-mlir` work without the host targets configured.
2022-01-14 07:23:14 +00:00
Bryce Wilson 28b6e2cb3d
[Attributor] [NFC] Use canonical variable name
Differential Revision: https://reviews.llvm.org/D117241
2022-01-13 23:06:00 -08:00
Amir Ayupov d914486a9a [BOLT][NFC] Refactor reset-release to move assignment
Summary:
Follow the clang-tidy suggestion to replace reset-release with move assignment.

Move assignment's effect for unique_ptr:
> Effects: Transfers ownership from `u` to `*this` as if by calling `reset(u.release())`
followed by an assignment from `std::forward<D>(u.get_deleter())`.
2022-01-13 22:47:15 -08:00
Amir Ayupov 18bc405a09 [BOLT][NFC] Remove uses of `std::vector<bool>`
Summary:
LLVM Programmer’s Manual strongly discourages the use of `std::vector<bool>`
and suggests `llvm::BitVector` as a possible replacement.
2022-01-13 22:46:34 -08:00
Mehdi Amini dc9f18da86 Partially revert cac7aabbd82: some APIs don't have in-tree users and some build breaks weren't caught 2022-01-14 06:16:38 +00:00
Stella Laurenzo b93eded7b9 [bazel] Separate capi_deps from deps in mlir_c_api_cc_library.
This is important because *Objects targets need to only depend on other *Objects targets, not on the unsuffixed CAPI rules. Depending on how it is linked in the current setup, it can cause duplicate symbols.

Differential Revision: https://reviews.llvm.org/D117176
2022-01-14 06:08:01 +00:00
jacquesguan 88c0e0806b [RISCV] Improve i64 splat vector lowering in RV32.
We could use vmv.v.i/vmv.v.x whose eew is 32 to lower the i64 splat vector if the i64 constant scalar could be splitted into two same i32 scalar.

Differential Revision: https://reviews.llvm.org/D117079
2022-01-14 14:06:01 +08:00
jacquesguan 3e241353e1 [RISCV] Add more i64 splat vector test.
Precommit test for D117079.

Differential Revision: https://reviews.llvm.org/D117081
2022-01-14 14:04:01 +08:00
Craig Topper 7b7210291a [RISCV] Remove unused check prefixes. NFC 2022-01-13 22:02:16 -08:00
Vitaly Buka 71a4fde397 [NFC][msan] Init few vars later 2022-01-13 22:00:37 -08:00
Craig Topper d72ebafda0 [RISCV] Add basic Zfh inline assembly tests. NFC
The abi name test shows incorrect fcvt.d.h, fcvt.h.d, fcvt.f.h,
and fcvt.h.f instructions around the inline assembly.
2022-01-13 21:52:46 -08:00
Craig Topper 3174525516 [RISCV] Add inline asm f32 test cases with D extension. NFC
Using named registers as input or output constraints creates fcvt.d.s
and fcvt.s.d instructions around the inline assembly.

This makes the data unusable by the inline assembly and corrupts
the results of the inline assembly.
2022-01-13 21:52:46 -08:00
Nenad Mikša 0c391133c9 Fix registers for Windows on ARM64
Reviewed By: #sanitizers, vitalybuka

Differential Revision: https://reviews.llvm.org/D116376
2022-01-13 21:39:01 -08:00
Vitaly Buka 36138d8252 [NFC][msan] Declare some getShadow vars later 2022-01-13 21:36:37 -08:00
John Ericson e68215c0c1 [Polly][CMake] Make PollyConfig.cmake relocatable like other projects'
This builds on D116521 to add this functionality to Polly without more copy-pasted code.

Reviewed By: beanz

Differential Revision: https://reviews.llvm.org/D116555
2022-01-14 05:27:21 +00:00
Maurice Heumann 072e2a7c67 [MS] Implement on-demand TLS initialization for Microsoft CXX ABI
TLS initializers, for example constructors of thread-local variables, don't necessarily get called. If a thread was created before a module is loaded, the module's TLS initializers are not executed for this particular thread.

This is why Microsoft added support for dynamic TLS initialization. Before every use of thread-local variables, a check is added that runs the module's TLS initializers on-demand.

To do this, the method `__dyn_tls_on_demand_init` gets called. Internally, it simply calls `__dyn_tls_init`.

No additional TLS initializer that sets the guard needs to be emitted, as the guard always gets set by `__dyn_tls_init`.
The guard is also checked again within `__dyn_tls_init`. This makes our check redundant, however, as Microsoft's compiler also emits this check, the behaviour is adopted here.

Reviewed By: majnemer

Differential Revision: https://reviews.llvm.org/D115456
2022-01-13 21:23:23 -08:00
River Riddle 11067d711b [mlir] Optimize OperationName construction and usage
When constructing an OperationName, the overwhelming majority of
cases are from registered operations. This revision adds a non-locked
lookup into the currently registered operations, which prevents locking
in the common case. This revision also optimizes several uses of
RegisteredOperationName that expect the operation to be registered,
e.g. such as in OpBuilder.

These changes provides a reasonable speedup (5-10%) in some
compilations, especially on platforms where locking is expensive.

Differential Revision: https://reviews.llvm.org/D117187
2022-01-13 21:14:36 -08:00
James Y Knight a97e20a3a8 Revert "GlobalISel: Add G_ASSERT_ALIGN hint instruction"
This commit sometimes causes a crash when compiling a vtable thunk. E.g.:

clang '--target=aarch64-grtev4-linux-gnu' -xc++ - -c -o /dev/null <<EOF
struct a {
  virtual int f();
};
struct c {
  virtual int &g() const;
};
struct d : a, c {
  int &g() const;
};
int &d::g() const {}
EOF

Some follow-up commits have been reverted as well:
Revert "IR: Make getRetAlign check callee function attributes"
Revert "Fix MSVC "32-bit shift implicitly converted to 64 bits" warning. NFC."
Revert "Fix MSVC "32-bit shift implicitly converted to 64 bits" warning. NFC."

This reverts commit 4f414af6a7.
This reverts commit a5507d2e25.
This reverts commit 3d2d208f6a.
This reverts commit 07ddfa95e3.
2022-01-14 04:50:07 +00:00
Konstantin Varlamov b6d87773fe [libc++] LWG3171: implement operator<< for filesystem::directory_entry.
Differential Revision: https://reviews.llvm.org/D116642
2022-01-13 20:44:18 -08:00
wren romano cf35825388 [mlir][sparse] Moving the sort from factory method to the constructor.
This guarantees the preconditions of fromCOO; whereas prior to this, one could call the constructor directly with an unsorted tensor, which would cause fromCOO to misbehave.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D117167
2022-01-13 19:44:51 -08:00
Peixin-Qiao 2291413554 [NFC] Apply the fix for different signedness warning in OpenMPIRBuilderTest.cpp
Differential Revision: https://reviews.llvm.org/D116300
2022-01-14 10:49:21 +08:00
Tue Ly c386d6eb2d [libc] Fix precision constants for long double in MPFRUtils.cpp. 2022-01-13 21:33:05 -05:00
Mehdi Amini 58ec17cb4e Apply clang-tidy fixes for readability-simplify-boolean-expr to MLIR (NFC) 2022-01-14 02:26:28 +00:00
Mehdi Amini cac7aabbd8 Apply clang-tidy fixes for readability-identifier-naming to MLIR (NFC) 2022-01-14 02:26:28 +00:00
Mehdi Amini d1b63c603a Apply clang-tidy fixes for readability-avoid-const-params-in-decls to MLIR (NFC) 2022-01-14 02:26:28 +00:00
Mehdi Amini e8d073951b Apply clang-tidy fixes for performance-unnecessary-value-param to MLIR (NFC) 2022-01-14 02:26:27 +00:00
Mehdi Amini 8e5f112c05 Apply clang-tidy fixes for performance-move-const-arg to MLIR (NFC) 2022-01-14 02:26:27 +00:00
Mehdi Amini a68c8d3009 Apply clang-tidy fixes for performance-for-range-copy to MLIR (NFC) 2022-01-14 02:26:27 +00:00
Mehdi Amini 2071e7204d Apply clang-tidy fixes for modernize-use-using to MLIR (NFC) 2022-01-14 02:26:27 +00:00
Mehdi Amini bd87241c44 Apply clang-tidy fixes for modernize-use-override to MLIR (NFC) 2022-01-14 02:26:27 +00:00
Mehdi Amini 9940dcfa4a Apply clang-tidy fixes for modernize-use-equals-default to MLIR (NFC) 2022-01-14 02:26:27 +00:00
Mehdi Amini 59d8740f2f Apply clang-tidy fixes for modernize-use-default-member-init to MLIR (NFC) 2022-01-14 02:26:26 +00:00
Mehdi Amini d19f89b5d2 Apply clang-tidy fixes for llvm-qualified-auto to MLIR (NFC) 2022-01-14 02:26:26 +00:00
Chuanqi Xu 4f8916cfdd [C++20] [Modules] Exit early if export decl is not valid
This patch fixes a crash due to following simple program:
> export struct Unit {
>    bool operator<(const Unit&);
> };

It would crash since the compiler would set the module ownership for
Unit. And the declaration with a module ownership is assumed to own a
module. But here isn't one. So here is the crash.

This patch fixes this by exiting early if it finds the export decl is
already invalid.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D117093
2022-01-14 10:21:42 +08:00
LLVM GN Syncbot b8367518e7 [gn build] Port d3729bb384 2022-01-14 01:58:03 +00:00