Commit Graph

393069 Commits

Author SHA1 Message Date
Kevin Athey 1dc005aa7d Add documentation for -fsanitize-address-use-after-return.
for issue: https://github.com/google/sanitizers/issues/1394

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D104155
2021-07-08 16:44:08 -07:00
Yuanfang Chen 0eb2b13d60 Add AddDiscriminatorsPass to NPM default O0 pipeline
AddDiscriminatorsPass is in Legacy PM's O0 pipeline. This patch did the same
for NPM O0 pipeline.

Reviewed By: aeubanks, MaskRay

Differential Revision: https://reviews.llvm.org/D105650
2021-07-08 16:37:20 -07:00
Gus Smith 0d0cff3ace [mlir][sparse] Add Merger unit tests
We opt to use unit tests rather than check tests as the lattice/merger code is a small C++ component with a well-defined API. Testing this API via check tests would be far less direct and readable. In addition, as the check tests will only be able to test the API indirectly, the tests may break based on unrelated changes; e.g. changes in linalg.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D104956
2021-07-08 23:10:33 +00:00
Stanislav Mekhanoshin e5b0fe1b83 [AMDGPU] Mark more SOP instructions as rematerializable
The rest of the SOP instructions implicitly set SCC and not
suitable for the rematerialization.

Differential Revision: https://reviews.llvm.org/D105670
2021-07-08 16:00:45 -07:00
Craig Topper 631516301e [ARM] Pass 2 instead of 0 to PHINode::Create in MVEGatherScatterLowering. NFC
This parameter controls how much space is reserved for incoming
values. There are always going to be 2 incoming values in this case.

While there remove the unused std::vector right below.

Found while looking at porting this code to RISCV.
2021-07-08 15:59:33 -07:00
Yi Zhang 7c35aae35b Mark TensorDialect legal and PadTensor op illegal
`GeneralizePadTensorOpPattern` might generate `tensor.dim` op so the
TensorDialect should be marked legal. This pattern should also
transform all `linalg.pad_tensor` ops so mark those as illegal. Those
changes are missed from a previous change in
https://reviews.llvm.org/D105293

Reviewed By: silvas

Differential Revision: https://reviews.llvm.org/D105642
2021-07-08 15:02:22 -07:00
Thomas Lively 3dd75f5371 [WebAssembly] Scalarize extract_vector_elt of binops
Override the `shouldScalarizeBinop` target lowering hook using the same
implementation used in the x86 backend. This causes `extract_vector_elt`s of
vector binary ops to be scalarized if the scalarized version would be supported.

Differential Revision: https://reviews.llvm.org/D105646
2021-07-08 14:31:53 -07:00
David Green e2bc88f175 [ARM] Extra v8i16 -> i64 reduction tests with loads. NFC 2021-07-08 22:27:23 +01:00
Alexey Bataev 8af69975af [InstCombine][NFC]Use only `replaceInstUsesWith`, NFC. 2021-07-08 13:58:30 -07:00
Rob Suderman 82563d8d14 [mlir][bazel] Added missing MathDialect dep to LinalgOps target
LinalgOps needs MathDialect as a dependency for it to build correctly.

Differential Revision: https://reviews.llvm.org/D105656
2021-07-08 13:47:42 -07:00
David Blaikie c9a0e74697 Revert "PR51018: Disallow explicit construction of StringRef from SmallString due to ambiguity in C++23"
This reverts commit e2d3084632.

MSVC doesn't seem to resolve the intended ambiguity in implicit
conversion contexts correctly: https://godbolt.org/z/ee16aqv4v
2021-07-08 13:46:36 -07:00
David Blaikie e2d3084632 PR51018: Disallow explicit construction of StringRef from SmallString due to ambiguity in C++23
See bug for full details, but basically there's an upcoming ambiguity in
the conversion in `StringRef(SomeSmallString)` - either the implicit
conversion operator (SmallString::operator StringRef) could be used, or
the std::string_view range-based ctor (& then `StringRef(std::string_view)`
would be used)

To address this, make such a conversion invalid up-front - most uses are
more tersely written as `SomeSmallString.str()` anyway, or more clearly
written as `StringRef x = y;` rather than `StringRef x(y);` - so if you
hit this in out-of-tree code, please update in one of those ways.
Hopefully I've fixed everything in tree prior to this patch landing.
2021-07-08 13:37:57 -07:00
David Blaikie 1def2579e1 PR51018: Remove explicit conversions from SmallString to StringRef to future-proof against C++23
C++23 will make these conversions ambiguous - so fix them to make the
codebase forward-compatible with C++23 (& a follow-up change I've made
will make this ambiguous/invalid even in <C++23 so we don't regress
this & it generally improves the code anyway)
2021-07-08 13:37:57 -07:00
Leonard Chan a7992b43a5 [NFC][compiler-rt][fuchsia] Add InitShadowBounds declaration to header
Forgot to include this as a part of
a11aea68a4.
2021-07-08 13:19:17 -07:00
Mitch Phillips d458f37932 [GWP-ASan] Change unreachable -> trap to work around DCE bug.
trapOnAddress is designed to SEGV on a specific address. Unfortunately,
with an IR change, __builtin_unreachable() ends up doing DCE on things
that have side effects, like the load that causes the trap.

Change to __builtin_trap() to avoid the optimisation.

Root cause is still an LLVM bug, and tracked in
https://bugs.llvm.org/show_bug.cgi?id=47480.

Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D105654
2021-07-08 13:06:42 -07:00
Vitaly Buka 915e07605c [msan] Handle funnel shifts
Fixes https://bugs.llvm.org/show_bug.cgi?id=50840

Differential Revision: https://reviews.llvm.org/D105387
2021-07-08 12:49:49 -07:00
Vitaly Buka ccc6f487d8 [msan] Add funel shift tests
For https://bugs.llvm.org/show_bug.cgi?id=50840
2021-07-08 12:49:49 -07:00
Alexey Bataev c574d2fbac [SLP]Improve vectorization of stores.
Patch tries to improve the vectorization of stores. Originally, we just
check the type and the base pointer of the store.
Patch adds some extra checks to avoid non-profitable vectorization
cases. It includes analysis of the scalar values to be stored and
triggers the vectorization attempt only if the scalar values have
same/alt opcode and are from same basic block, i.e. we don't end up
immediately with the gather node, which is not profitable.
This also improves compile time by filtering out non-profitable cases.

Part of D57059.

Differential Revision: https://reviews.llvm.org/D104122
2021-07-08 12:35:39 -07:00
Nikita Popov a0ea367562 [CodeGen] Avoid nullptr arg to CreateStructGEP (NFC)
For now just make the getPointerElementType() explicit.
2021-07-08 21:21:43 +02:00
Nikita Popov 9e225a2a71 [AMDGPU] Simplify GEP construction (NFC)
Noticed while making a related change. This code was doing
something really peculiar: Creating an APInt by parsing a string.
And then creating a SmallVector with one element to create the
GEP.

Instead create the APInt from integers and directly pass the single
index to GetElementPtrInst::Create().
2021-07-08 21:21:43 +02:00
Nikita Popov cfb94212d4 [AMDGPU] Pass explicit GEP type in printf transform (NFC)
This code is working on an i8*. Avoid nullptr element type in
preparation for removing support.
2021-07-08 21:21:43 +02:00
Nikita Popov b5a7da4391 [NVPTX] Pass explicit GEP type (NFC)
Use source element type of original GEP, as we're just changing
the address space.
2021-07-08 21:21:43 +02:00
Alexey Bataev f57d396dca [OPENMP]Do no privatize const firstprivates in target regions.
No need to emit private copyfor firstprivate constants in target
regions, we can use the original copy instead.

Differential Revision: https://reviews.llvm.org/D105647
2021-07-08 11:55:37 -07:00
Alexey Bataev 0d74fd3fdf [SLP][COST][X86]Improve cost model for masked gather.
Revived D101297 in its original form + added some changes in X86
legalization cehcking for masked gathers.

This solution is the most stable and the most correct one. We have to
check the legality before trying to build the masked gather in SLP.
Without this check we have incorrect cost (for SLP) in case if the masked gather
is not legal/slower than the gather. And we're missing some
vectorization opportunities.

This can be fixed in the cost model, but in this case we need to add
special checks for the cost of GEPs for ScatterVectorize node, add
special check for small trees, etc., i.e. there are a lot of corner
cases here and there, which insrease code base and make it harder to
maintain the code.

> Can't we rely on cost model to deal with this? This can be profitable for futher vectorization, when we can start from such gather loads as seed.

The question from D101297. Actually, no, it can't. Actually, simple
gather may give us better result, especially after we started
vectorization of insertelements. Plus, like I said before, the cost for
non-legal masked gathers leads to missed vectorization opportunities.

Differential Revision: https://reviews.llvm.org/D105042
2021-07-08 11:53:30 -07:00
Craig Topper 6dd94cbff5 [ARM] Use matchSimpleRecurrence to simplify some code in MVEGatherScatterLowering. NFCI
Reviewed By: dmgreen

Differential Revision: https://reviews.llvm.org/D105262
2021-07-08 11:42:56 -07:00
Louis Dionne 74fb868942 [libc++] Add XFAIL for Clang ToT with modules
This is what I should have done instead of 6afd6e96ce.
2021-07-08 14:40:18 -04:00
Nikita Popov 693251fb2f [CodeGen] Avoid CreateGEP with nullptr type (NFC)
In preparation for dropping support for it. I've replaced it with
a proper type where the correct type was obvious and left an
explicit getPointerElementType() where it wasn't.
2021-07-08 20:38:54 +02:00
Alexey Bataev 9d826fdb28 [X86][NFC]Add run lines for AVX512VL for masked gather test, NFC. 2021-07-08 11:30:31 -07:00
Matheus Izvekov 5a1c50410c [clang] fix constexpr code generation for user conversions.
When building the member call to a user conversion function during an
implicit cast, the expression was not being checked for immediate
invocation, so we were never adding the ConstantExpr node to AST.

This would cause the call to the user conversion operator to be emitted
even if it was constantexpr evaluated, and this would even trip an
assert when said user conversion was declared consteval:
`Assertion failed: !cast<FunctionDecl>(GD.getDecl())->isConsteval() && "consteval function should never be emitted", file clang\lib\CodeGen\CodeGenModule.cpp, line 3530`

Fixes PR48855.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>

Reviewed By: rsmith

Differential Revision: https://reviews.llvm.org/D105446
2021-07-08 20:23:19 +02:00
Stanislav Mekhanoshin de5582be26 [AMDGPU] Fix more indention in llc-pipeline test. NFC. 2021-07-08 11:20:00 -07:00
Louis Dionne 8ea2b951c6 [libc++][ci] Install Clang 11, Clang 12 and Clang ToT in the Docker image
The compiler support policy mentions that we support Clang 11 and 12, so
we should test those. We already test on Clang 12, but I'll add testers
for Clang 11 once the new Docker image is in use on all the builders.
2021-07-08 14:14:17 -04:00
Nicolas Vasilache 4747e1b83b [mlir][Linalg] Fix tensor.extract_slice(linalg.init_tensor) canonicalization for rank-reducing extract
Differential Revision: https://reviews.llvm.org/D105636
2021-07-08 18:13:51 +00:00
Michael Liao 8c7ff9da90 [Metadata] Decorate methods with 'const'. NFC.
- Minor coding style fix.
2021-07-08 14:11:14 -04:00
Stanislav Mekhanoshin 9dae86ce56 [AMDGPU] Fix indention in llc-pipeline test. NFC. 2021-07-08 11:08:25 -07:00
Matt Arsenault 43f25e61ce Mips/GlobalISel: Remove custom splitToValueTypes 2021-07-08 13:39:06 -04:00
Matt Arsenault 9b057f647d GlobalISel: Track original argument index in ArgInfo
SelectionDAG's equivalents in ISD::InputArg/OutputArg track the
original argument index. Mips relies on this, and its currently
reinventing its own parallel CallLowering infrastructure which tracks
these indexes on the side. Add this to help move towards deleting the
custom mips handling.
2021-07-08 13:39:02 -04:00
Matt Arsenault 2f9504aa41 Mips/GlobalISel: Use correct callee calling convention
This was using the convention from the calling function.
2021-07-08 13:38:57 -04:00
Fangrui Song d833543dd5 [LangRef] Fix typo about SHF_LINK_ORDER 2021-07-08 10:29:43 -07:00
Leonard Chan a11aea68a4 [compiler-rt][hwasan] Define fuchsia implementations of required hwasan functions
This contains all the definitions required by hwasan for the fuchsia
implementation and can be landed independently from the remaining parts of D91466.

Differential Revision: https://reviews.llvm.org/D103936
2021-07-08 10:24:27 -07:00
Eli Friedman 5b350183cd [ScalarEvolution] Fix overflow in computeBECount.
There are two issues with the current implementation of computeBECount:

1. It doesn't account for the possibility that adding "Stride - 1" to
Delta might overflow. For almost all loops, it doesn't, but it's not
actually proven anywhere.
2. It doesn't account for the possibility that Stride is zero. If Delta
is zero, the backedge is never taken; the value of Stride isn't
relevant. To handle this, we have to make sure that the expression
returned by computeBECount evaluates to zero.

To deal with this, add two new checks:

1. Use a variety of tricks to try to prove that the addition doesn't
overflow.  If the proof is impossible, use an alternate sequence which
never overflows.
2. Use umax(Stride, 1) to handle the possibility that Stride is zero.

Differential Revision: https://reviews.llvm.org/D105216
2021-07-08 10:09:55 -07:00
Simon Pilgrim 769e782793 Fix MSVC "truncation from 'int' to 'bool'" warning. NFCI. 2021-07-08 18:08:24 +01:00
Simon Pilgrim 8ef67fa9d2 [CostModel][X86] Account for older SSE targets with slow fp->int conversions
Both the conversion cost and the xmm->gpr transfer cost tend to be a lot higher on early SSE targets
2021-07-08 18:08:24 +01:00
Fangrui Song c34b0ab589 [LangRef] Clarify !associated
Notably, a global variable with the metadata should generally not be referenced
by a function function. E.g. -fstack-size-section usage is fine, but
-fsanitize-coverage= used to have a linker GC problem (fixed by D97430).

Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D104933
2021-07-08 10:07:10 -07:00
Aart Bik 8cf60e61e7 [mlir][sparse] updated setter/getter comments
For the getters, it is bad practice to keep the reference
around for too long, as explained in the new comment

Reviewed By: gussmith23

Differential Revision: https://reviews.llvm.org/D105599
2021-07-08 09:36:22 -07:00
Stanislav Mekhanoshin 74a5760d35 [AMDGPU] Set LoopInfo as preserved by SIAnnotateControlFlow
The pass does not change loops, it just adds calls.

Differential Revision: https://reviews.llvm.org/D105583
2021-07-08 09:34:43 -07:00
Louis Dionne d2a8d362c5 [libc++][ci] Stop testing on GCC previous, since we don't support it anymore
This is the first of a few commits that update the CI to match the
recently officialized compiler support policy. I'm staging those
changes to try and keep the CI green at all times, accounting how
builders refresh their Docker image.
2021-07-08 12:33:26 -04:00
Nikita Popov 83a87b831a [IR] Restore vector support for deprecated CreateGEP methods
As pointed out in post-commit review on rG8e22539067d9, it's
necessary to call getScalarType() to support GEPs with a vector
base. Dropping that call was an oversight on my side.
2021-07-08 18:15:56 +02:00
Louis Dionne a276f45180 [libc++][docs] Update documentation to reflect libc++'s compiler support policy
In https://lists.llvm.org/pipermail/llvm-dev/2021-March/148881.html, we
discussed updating the compiler support policy for libc++ to match more
closely what we do actually support.

This commit enshrines that policy decision in libc++'s documentation.

Differential Revision: https://reviews.llvm.org/D105563
2021-07-08 11:56:50 -04:00
Louis Dionne 6afd6e96ce [libc++] Workaround failures with modules on Clang ToT 2021-07-08 11:50:54 -04:00
Jeremy Morse 63cc251eb9 [DebugInfo][InstrRef][4/4] Support DBG_INSTR_REF through all backend passes
This is a cleanup patch -- we're now able to support all flavours of
variable location in instruction referencing mode. This patch updates
various tests for debug instructions to be broader: numerous code paths
try to ignore debug isntructions, and they now have to ignore the
additional DBG_PHI and DBG_INSTR_REFs that we can generate.

A small amount of rework happens for LiveDebugVariables: as we don't need
to track live intervals through regalloc any more, we can get away with
unlinking debug instructions before regalloc, then re-inserting them after.
Note that this isn't (yet) true of DBG_VALUE_LISTs, they still have to go
through live interval tracking.

In SelectionDAG, add a helper lambda that emits half-formed DBG_INSTR_REFs
for arguments in instr-ref mode, DBG_VALUE otherwise. This is one of the
final locations where DBG_VALUEs are emitted for vreg arguments.

X86InstrInfo now un-sets the debug instr number on SUB instructions that
get mutated into CMP instructions. As the instruction no longer computes a
subtraction, we can't use it for variable locations.

Differential Revision: https://reviews.llvm.org/D88898
2021-07-08 16:42:24 +01:00