Commit Graph

380548 Commits

Author SHA1 Message Date
Fraser Cormack 9aa20caee6 [RISCV] Improve register allocation around vector masks
With vector mask registers only allocatable to V0 (VMV0Regs) it is
relatively simple to generate code which uses multiple masks and naively
requires spilling.

This patch aims to improve codegen in such cases by telling LLVM it can
use VRRegs to hold masks. This will prevent spilling in many cases by
having LLVM copy to an available VR register.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D97055
2021-02-20 14:47:51 +00:00
David Zarzycki 4550fdff2b [lit testing] "END." not "END:" 2021-02-20 09:43:36 -05:00
Simon Pilgrim 609d0c9772 [InstCombine] matchBSwapOrBitReverse - remove pattern matching early-out. NFCI.
recognizeBSwapOrBitReverseIdiom + collectBitParts have pattern matching to bail out early if a bswap/bitreverse pattern isn't possible - we should be able to rely on this instead without any notable change in compile time.

This is part of a cleanup towards letting matchBSwapOrBitReverse /recognizeBSwapOrBitReverseIdiom use 'root' instructions that aren't ORs (FSHL/FSHRs in particular which can be prematurely created).

Differential Revision: https://reviews.llvm.org/D97056
2021-02-20 13:15:34 +00:00
Mark de Wever 84dbcdd5ff [libc++] Fix the build for AppleClang.
Forgot to add some parts of D93593, this should disable the tests on
Apple. Seems Louis was right ;-)
2021-02-20 13:54:46 +01:00
Fraser Cormack 55b75d8363 [RISCV] Pre-commit test case for D97055. NFC.
This adds a test which unnecessarily spills mask registers.
2021-02-20 12:36:55 +00:00
Simon Pilgrim ee0dee7d38 [X86][SSE] Use llvm min/max intrinsics instead of (deprecated) sse intrinsics. NFCI.
These are auto-upgraded to the equivalent llvm variants now.
2021-02-20 12:17:46 +00:00
Simon Pilgrim a274062bd4 [X86][SSE] vector-compare-combines.ll - use llvm min/max intrinsics instead of (deprecated) sse intrinsics. NFCI.
These are auto-upgraded to the equivalent llvm variants now.
2021-02-20 12:16:54 +00:00
Simon Pilgrim 75e66b88bd [X86][AVX] Remove AVX2 min/max intrinsics tests
These are now autoupgraded to the llvm equivalents and the tests already moved avx2-intrinsics-x86-upgrade.ll
2021-02-20 12:13:06 +00:00
Simon Pilgrim b9f3b305e5 [X86][SSE] Remove SSE41 min/max intrinsics tests
These are now autoupgraded to the llvm equivalents and the tests already moved sse41-intrinsics-x86-upgrade.ll
2021-02-20 12:11:50 +00:00
Simon Pilgrim 63422bcb23 [X86][SSE2] Remove SSE2 min/max intrinsics tests
These are now autoupgraded to the llvm equivalents and the tests already moved sse2-intrinsics-x86-upgrade.ll
2021-02-20 12:10:58 +00:00
Simon Pilgrim ff51bcee4a [X86] KnownBits - use llvm min/max intrinsics instead of (deprecated) sse intrinsics. NFCI.
These are auto-upgraded to the equivalent llvm variants now.
2021-02-20 12:07:02 +00:00
Simon Pilgrim 761bbed264 [DAG] foldSubToUSubSat - fold sub(a,trunc(umin(zext(a),b))) -> usubsat(a,trunc(umin(b,SatLimit)))
This moves the last custom x86 USUBSAT fold to generic DAGCombine.

Completes PR40111

Differential Revision: https://reviews.llvm.org/D96703
2021-02-20 12:02:07 +00:00
Nikita Popov 2b729548f0 [ConstantRangeTest] Make exhaustive testing more principled (NFC)
The current infrastructure for exhaustive ConstantRange testing is
somewhat confusing in what exactly it tests and currently cannot even
be used for operations that produce smallest-size results, rather than
signed/unsigned envelopes.

This patch makes the testing more principled by collecting the exact
set of results of an operation into a bit set and then comparing it
against the range approximation by:

 * Checking conservative correctness: All elements in the set must be
   in the range.
 * Checking optimality under a given preference function: None of the
   (slack-free) ranges that can be constructed from the set are
   preferred over the computed range.

Implemented preference functions are:

 * PreferSmallest: Smallest range regardless of signed/unsigned wrapping
   behavior. Probably what we would call "optimal" without further
   qualification.
 * PreferSmallestUnsigned/Signed: Smallest range that has no
   unsigned/signed wrapping. We use this if our calculation is precise
   only up to signed/unsigned envelope.
 * PreferSmallestNonFullUnsigned/Signed: Smallest range that has no
   unsigned/signed wrapping -- but preferring a smaller wrapping range
   over a (non-wrapping) full range. We use this if we have a fully
   precise calculation but apply a sign preference to the result
   (union/intersection). Even with a sign preference, returning a
   wrapping range is still "strictly better" than returning a full one.

This also addresses PR49273 by replacing the fragile manual range
construction logic in testBinarySetOperationExhaustive() with generic
code that isn't specialized to the particular form of ranges that set
operations can produces.

Differential Revision: https://reviews.llvm.org/D88356
2021-02-20 12:37:31 +01:00
Luís Marques 7c31661b22 [Sanitizers][NFC] Fix typo 2021-02-20 10:54:00 +00:00
David Zarzycki 45d058e56d [lit] Add --xfail and --filter-out (inverse of --filter)
In semi-automated environments,  XFAILing or filtering out known regressions without actually committing changes or temporarily modifying the test suite can be quite useful.

Reviewed By: yln

Differential Revision: https://reviews.llvm.org/D96662
2021-02-20 05:43:29 -05:00
Juneyoung Lee e4d751c271 Update BPFAdjustOpt.cpp to accept select form of or as well
This is a minor pattern-match update to BPFAdjustOpt.cpp to accept
not only 'or i1 a, b' but also 'select i1 a, i1 true, i1 b'.
This resolves regression after SimplifyCFG's creating select form
of and/or instead (https://reviews.llvm.org/D95026).
This is a small change, and currently such select form isn't created
or doesn't reach to the late pipeline (because InstCombine eagerly
folds it into and/or i1), so I chose to commit without a review process.
2021-02-20 18:29:58 +09:00
Amara Emerson 067ec53df1 [AArch64][GlobalISel] Add selection support for G_VECREDUCE of <2 x i32>
This selects to a pairwise add and a subreg copy.
2021-02-20 00:39:38 -08:00
Martin Storsjö 7b5f0050a9 [libcxx] [test] Remove two unnecesary files/variables in a test
These don't seem to have any function in the test.

The non_regular_file one seems to have been added in
0f8c8f59df, without any apparent
purpose there.

Differential Revision: https://reviews.llvm.org/D97083
2021-02-20 10:20:12 +02:00
Martin Storsjö 8c305a5d82 [libcxx] Rename a method in PathParser for clarity. NFC.
Differential Revision: https://reviews.llvm.org/D97081
2021-02-20 10:20:11 +02:00
Mark de Wever 1a5c92f680 [libc++] Fixes _LIBCPP_HAS_NO_CONCEPTS
Before the define was in a GCC specific part. Now it's available for all
compilers. The patch had its CI run in D93593.
2021-02-20 09:13:16 +01:00
Juneyoung Lee 3b8cfef486 [InstCombine] Add more tests to nonnull-select.ll (NFC) 2021-02-20 16:59:52 +09:00
Kazu Hirata a205fa5cd9 [CodeGen] Use range-based for loops (NFC) 2021-02-19 22:44:14 -08:00
Kazu Hirata f169c027d6 [TableGen] Use ListSeparator (NFC) 2021-02-19 22:44:12 -08:00
Dávid Bolvanský 501b4fe4ed Fixed failing test 2021-02-20 07:11:42 +01:00
Dávid Bolvanský ee51c42e00 Reduce the number of attributes attached to each function
This takes advantage of the implicit default behavior to reduce the number of
attributes.
2021-02-20 06:57:47 +01:00
Dávid Bolvanský cd54c57919 Reland "[Libcalls, Attrs] Annotate libcalls with noundef"
Fixed Clang tests.
2021-02-20 06:18:48 +01:00
Juneyoung Lee aacf7878bc [ValueTracking] Improve impliesPoison
This patch improves ValueTracking's impliesPoison(V1, V2) to do this reasoning:

```
  %res = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %a, i64 %b)
  %overflow = extractvalue { i64, i1 } %res, 1
  %mul      = extractvalue { i64, i1 } %res, 0

	; If %mul is poison, %overflow is also poison, and vice versa.
```

This improvement leads to supporting this optimization under `-instcombine-unsafe-select-transform=0`:

```
define i1 @test2_logical(i64 %a, i64 %b, i64* %ptr) {
; CHECK-LABEL: @test2_logical(
; CHECK-NEXT:    [[MUL:%.*]] = mul i64 [[A:%.*]], [[B:%.*]]
; CHECK-NEXT:    [[TMP1:%.*]] = icmp ne i64 [[A]], 0
; CHECK-NEXT:    [[TMP2:%.*]] = icmp ne i64 [[B]], 0
; CHECK-NEXT:    [[OVERFLOW_1:%.*]] = and i1 [[TMP1]], [[TMP2]]
; CHECK-NEXT:    [[NEG:%.*]] = sub i64 0, [[MUL]]
; CHECK-NEXT:    store i64 [[NEG]], i64* [[PTR:%.*]], align 8
; CHECK-NEXT:    ret i1 [[OVERFLOW_1]]
;

  %res = tail call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %a, i64 %b)
  %overflow = extractvalue { i64, i1 } %res, 1
  %mul = extractvalue { i64, i1 } %res, 0
  %cmp = icmp ne i64 %mul, 0
  %overflow.1 = select i1 %overflow, i1 true, i1 %cmp
  %neg = sub i64 0, %mul
  store i64 %neg, i64* %ptr, align 8
  ret i1 %overflow.1
}
```

Previously, this didn't happen because the flag prevented `select i1 %overflow, i1 true, i1 %cmp` from being `or i1 %overflow, %cmp`.
Note that the select -> or conversion happens only when `impliesPoison(%cmp, %overflow)` returns true.
This improvement allows `impliesPoison` to do the reasoning.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D96929
2021-02-20 13:22:34 +09:00
Aart Bik f32b3401e1 [mlir][sparse] convert function pass to module pass
Rationale:
Touching function level information can only be done within a module pass.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D97102
2021-02-19 20:04:02 -08:00
Wenlei He a952d7291e [SampleFDO] Skip PreLink ICP for better profile quality of MonoLTO PostLink
For ThinLTO, PreLink ICP is skipped to favor better profile annotation during LTO PostLink. This change applies the same tweak for MonoLTO. Note that PreLink ICP not only makes PostLink profile annotation harder, it is also uncoordinated with PostLink ICP so duplicated ICP could happen.

Differential Revision: https://reviews.llvm.org/D97028
2021-02-19 19:35:23 -08:00
Dávid Bolvanský 94d034fb86 Revert "[Libcalls, Attrs] Annotate libcalls with noundef"
This reverts commit 33b0c63775. Bots are failing. Some Clang tests need to be updated too.
2021-02-20 04:18:42 +01:00
Craig Topper 71b68fe532 [RISCV] Teach our custom vector load/store intrinsic isel code to propagate memory operands if we have them.
We don't currently create memory operands for these intrinsics,
but there was a suggestion of using the indexed load/store
intrinsics to implement isel for scalable vector gather/scatter.
That may propagate the memory operand from the gather/scatter
ISD nodes.
2021-02-19 19:12:20 -08:00
Dávid Bolvanský 33b0c63775 [Libcalls, Attrs] Annotate libcalls with noundef
I think we can use here same logic as for nonnull.

strlen(X) - X must be noundef => valid pointer.

for libcalls with size arg, we add noundef only if size is known and greater than 0 - so pointers must be noundef (valid ones)

Reviewed By: jdoerfert, aqjune

Differential Revision: https://reviews.llvm.org/D95122
2021-02-20 04:10:07 +01:00
Dávid Bolvanský 68e6025cf7 Revert "[BuildLibcalls] Mark some libcalls with inaccessiblememonly and inaccessiblemem_or_argmemonly"
This reverts commit 05d891a19e.
2021-02-20 03:58:53 +01:00
Dávid Bolvanský 05d891a19e [BuildLibcalls] Mark some libcalls with inaccessiblememonly and inaccessiblemem_or_argmemonly
Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D94850
2021-02-20 03:56:01 +01:00
Pan, Tao 12edddafac [CodeGen] Fix two dots between text section name and symbol name
There is a trailing dot in text section name if it has prefix, don't add
repeated dot when connect text section name and symbol name.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D96327
2021-02-20 10:15:48 +08:00
Vitaly Buka c17547df44 Revert "Implement -bundle_loader"
D95913 passes null pointer into memcpy

This reverts commit 1a0afcf518.
2021-02-19 17:40:07 -08:00
Craig Topper baab797878 [ValueTypes] Assert if changeVectorElementType is called on a simple type with an extended element type.
Previously we would use the extended implementation, but
the extended implementation requires the vector type to be extended
so that we can access the LLVMContext. In theory we could
detect this case and use the context from the element type instead,
but since I know of no cases hitting this in practice today
I've done the simplest thing.

Also add asserts to several extended EVT functions that assume
LLVMTy is non-null.

Follow from discussion in D97036

Reviewed By: pengfei

Differential Revision: https://reviews.llvm.org/D97070
2021-02-19 17:30:46 -08:00
Jianzhou Zhao dab953c8e4 [dfsan] Add utils that get/set origins
This is a part of https://reviews.llvm.org/D95835.

Reviewed-by: morehouse

Differential Revision: https://reviews.llvm.org/D97087
2021-02-20 00:52:33 +00:00
Jacques Pienaar 3bec7ed59e Different fix for gcc bug
Was still running into

from definition of 'template<class T> struct llvm::DenseMapInfo'
[-fpermissive]
 template <typename T> struct DenseMapInfo;
                               ^
2021-02-19 16:41:00 -08:00
Eric Schweitz c68d2895a1 [flang][fir] Update flang test tool support classes.
This updates the various classes that support the compliation of
Fortran. These classes are shared by the test tools.

Authors: Eric Schweitz, Sameeran Joshi, et.al.

Differential Revision: https://reviews.llvm.org/D97073
2021-02-19 16:02:39 -08:00
Mehdi Amini f8c1f3b14a Revert "Revert "Fix MLIR Toy tutorial JIT example and add a test to cover it""
This reverts commit f36060417a and
reapply commit ae15b1e7ad.

JIT test must be annotated to not run on Windows.
2021-02-19 23:54:52 +00:00
Yusra Syeda b006f55544 [SystemZ/z/OS] Add XPLINK 64-bit calling convention to tablegen.
This commit adds the initial changes to the SystemZ target
description for the XPLINK 64-bit calling convention on z/OS.
Additions include:

 - a new predicate IsTargetXPLINK64
 - different register allocation order
 - generaton of nopr after a call

Reviewed-by: uweigand

Differential Revision: https://reviews.llvm.org/D96887
2021-02-19 18:39:49 -05:00
Petr Hosek 3275b18f89 [Coverage] Normalize compilation dir as well
This matches debug info behavior.

Differential Revision: https://reviews.llvm.org/D97001
2021-02-19 15:29:03 -08:00
zoecarver 6c75a84ce7 [libc++][nfc] Only test if pair is_assignable after C++03.
In C++03 libc++ uses a different set of constructors which aren't
constrained, so these tests won't work. This should fix the bots.

Refs: 82c4701.
2021-02-19 15:14:44 -08:00
Martin Storsjö 99fc4a6584 [libcxx] Enable filesystem by default for mingw targets
This feature can be built successfully for windows now. However,
the helper functions for __int128_t aren't available in MSVC
configurations, so don't enable it by default there yet. (See
https://reviews.llvm.org/D91139 for discussion on how to proceed
with things in MSVC environments.)

Differential Revision: https://reviews.llvm.org/D97075
2021-02-20 01:09:10 +02:00
Philip Reames b13e942224 [ValueTracking] Add a two argument form of safeCtxI [NFC]
The existing implementation was relying on order of evaluation to achieve a particular result.  This got really confusing when wanting to change the handling for arguments in a later patch.
2021-02-19 14:52:51 -08:00
Christopher Tetreault 55448ab540 [AArch64] Adding Neon Polynomial vadd Intrinsics
This patch adds the following intrinsics:
            vadd_p8
            vadd_p16
            vadd_p64
            vaddq_p8
            vaddq_p16
            vaddq_p64
            vaddq_p128

Reviewed By: t.p.northover, DavidSpickett, ctetreau

Differential Revision: https://reviews.llvm.org/D96825
2021-02-19 14:48:12 -08:00
Amara Emerson 27566e9c3e [AArch64][GlobalISel] Make G_VECREDUCE_ADD of <2 x s32> legal. 2021-02-19 14:28:21 -08:00
Stella Stamenova f36060417a Revert "Fix MLIR Toy tutorial JIT example and add a test to cover it"
This reverts commit ae15b1e7ad.

This commit caused failures on the mlir windows buildbot
2021-02-19 13:38:43 -08:00
Jianzhou Zhao cb1f1aab90 [dfsan] Add origin address calculation
This is a part of https://reviews.llvm.org/D95835.

Reviewed-by: morehouse

Differential Revision: https://reviews.llvm.org/D97065
2021-02-19 21:30:07 +00:00