platform/upstream/llvm.git
3 years ago[X86][AVX] Fold concat(extract_subvector(v0,c0), extract_subvector(v1,c1)) -> vperm2x128
Simon Pilgrim [Sun, 21 Feb 2021 14:50:43 +0000 (14:50 +0000)]
[X86][AVX] Fold concat(extract_subvector(v0,c0), extract_subvector(v1,c1)) -> vperm2x128

Fixes regression exposed by removing bitcasts across logic-ops in D96206.

Differential Revision: https://reviews.llvm.org/D96206

3 years ago[X86] Fold bitcast(logic(bitcast(X), Y)) --> logic'(X, bitcast(Y)) for int-int bitcasts
Simon Pilgrim [Sun, 21 Feb 2021 14:40:54 +0000 (14:40 +0000)]
[X86] Fold bitcast(logic(bitcast(X), Y)) --> logic'(X, bitcast(Y)) for int-int bitcasts

Extend the existing combine that handles bitcasting for fp-logic ops to also help remove logic ops across bitcasts to/from the same integer types.

This helps improve AVX512 predicate handling for D/Q logic ops and also allows DAGCombine's scalarizeExtractedBinop to remove some annoying gpr->simd->gpr transfers.

The concat_vectors regression in pr40891.ll will be addressed in a followup commit on this patch.

Differential Revision: https://reviews.llvm.org/D96206

3 years ago[RISCV] Add test cases for add/sub/mul overflow intrinsics. NFC
Craig Topper [Sun, 21 Feb 2021 08:06:51 +0000 (00:06 -0800)]
[RISCV] Add test cases for add/sub/mul overflow intrinsics. NFC

Largely copied from AArch64/arm64-xaluo.ll

3 years ago[lld][ELF] __start_/__stop_ refs don't retain C-ident named group sections
Petr Hosek [Tue, 16 Feb 2021 07:41:16 +0000 (23:41 -0800)]
[lld][ELF] __start_/__stop_ refs don't retain C-ident named group sections

The special root semantics for identifier-named sections is meant
specifically for the metadata sections. In the context of group
semantics, where group members are always retained or discarded as a
unit, it's natural not to have this semantics apply to a section in a
group, otherwise we would never discard the group defeating the purpose
of using the group in the first place.

This change modifies the GC behavior so that __start_/__stop_ references
don't retain C identifier named sections in section groups which allows
for these groups to be collected. This matches the behavior of BFD ld.

The only kind of existing case that might break is interdependent
metadata sections that are all in a group together, but that group
doesn't contain any other sections referenced by anything except
implicit inclusion in a `__start_` and/or `__stop_`-referenced
identifier-named section, but such cases should be unlikely.

Differential Revision: https://reviews.llvm.org/D96753

3 years ago[CodeGen] Use range-based for loops (NFC)
Kazu Hirata [Sun, 21 Feb 2021 05:46:02 +0000 (21:46 -0800)]
[CodeGen] Use range-based for loops (NFC)

3 years ago[TableGen] Use ListSeparator (NFC)
Kazu Hirata [Sun, 21 Feb 2021 05:46:00 +0000 (21:46 -0800)]
[TableGen] Use ListSeparator (NFC)

3 years ago[dfsan] Comment out unused methods by D97087 temporarily
Jianzhou Zhao [Sun, 21 Feb 2021 03:29:56 +0000 (03:29 +0000)]
[dfsan] Comment out unused methods by D97087 temporarily

3 years ago[clang][Driver][OpenBSD] libcxx also requires pthread
Brad Smith [Sun, 21 Feb 2021 01:43:16 +0000 (20:43 -0500)]
[clang][Driver][OpenBSD] libcxx also requires pthread

3 years ago[lldb] Refine ThreadPlan::ShouldAutoContinue
Dave Lee [Fri, 19 Feb 2021 19:26:28 +0000 (11:26 -0800)]
[lldb] Refine ThreadPlan::ShouldAutoContinue

Adjust `ShouldAutoContinue` to be available to any thread plan previous to the plan that
explains a stop, not limited to the parent to the plan that explains the stop.

Before this change, `Thread::ShouldStop` did the following:

1. find the plan that explains the stop
2. if it's not a master plan, continue processing previous (aka parent) plans
3. first, call `ShouldAutoContinue` on the immediate parent of the explaining plan
4. then loop over previous plans, calling `ShouldStop` and `MischiefManaged`

Of note, the iteration in step 4 does not call `ShouldAutoContinue`, so again only the
plan just prior to the explaining plan is given the opportunity to override whether to
continue or stop.

This commit changes the loop call `ShouldAutoContinue`, giving each plan the opportunity
to override `ShouldStop` of previous plans.

Why? This allows a plan to do the following:

1. mark itself done and be popped off the stack
2. allow parent plans to finish their work, and to also be popped off the stack
3. and finally, have the thread continue, not stop

This is useful for stepping into async functions. A plan will would step far enough
enough to set a breakpoint on the async target, and then use `ShouldAutoContinue` to
unwind the necessary stepping, and then have the calling thread continue.

Differential Revision: https://reviews.llvm.org/D97076

3 years agoUpdate test error string post pass registration change
Jacques Pienaar [Sat, 20 Feb 2021 23:54:52 +0000 (15:54 -0800)]
Update test error string post pass registration change

3 years ago[mlir] Register the print-op-graph pass using ODS
Jacques Pienaar [Sat, 20 Feb 2021 23:42:02 +0000 (15:42 -0800)]
[mlir] Register the print-op-graph pass using ODS

Move over to ODS & use pass options.

3 years ago[NFC] Refactor PreferMemberInitializerCheck
Nathan James [Sat, 20 Feb 2021 23:35:58 +0000 (23:35 +0000)]
[NFC] Refactor PreferMemberInitializerCheck

3 years ago[libcxx] [test] Call create_directory_symlink when linking directories
Martin Storsjö [Fri, 19 Feb 2021 22:10:56 +0000 (00:10 +0200)]
[libcxx] [test] Call create_directory_symlink when linking directories

This makes the symlinks work properly on windows.

A similar round of cleanup was done in
c41bda7f5fc26e4602a029646991d6a5c59cb365, but these tests were
added after that.

Differential Revision: https://reviews.llvm.org/D97089

3 years ago[libcxx] Make path::format a non-class enum
Martin Storsjö [Fri, 6 Nov 2020 09:57:47 +0000 (11:57 +0200)]
[libcxx] Make path::format a non-class enum

The spec doesn't declare it as an enum class, and being declared
as an enum class breaks referring to the values as e.g.
path::auto_format.

Differential Revision: https://reviews.llvm.org/D97084

3 years ago[InstrProfiling] Use nobits as __llvm_prf_cnts section type in ELF
Petr Hosek [Sat, 20 Feb 2021 05:41:45 +0000 (21:41 -0800)]
[InstrProfiling] Use nobits as __llvm_prf_cnts section type in ELF

This can reduce the binary size because counters will no longer occupy
space in the binary, instead they will be allocated by dynamic linker.

Differential Revision: https://reviews.llvm.org/D97110

3 years ago[clang-tidy] Simplify throw keyword missing check
Stephen Kelly [Mon, 28 Dec 2020 01:54:04 +0000 (01:54 +0000)]
[clang-tidy] Simplify throw keyword missing check

Extend test to verify that it does not match in template instantiations.

Differential Revision: https://reviews.llvm.org/D96132

3 years ago[clang-tidy] Simplify function complexity check
Stephen Kelly [Sat, 26 Dec 2020 21:40:51 +0000 (21:40 +0000)]
[clang-tidy] Simplify function complexity check

Update test to note use of lambda instead of the invisible operator().

Differential Revision: https://reviews.llvm.org/D96131

3 years ago[RISCV] Add another test case showing failure to use remw when the RHS has been zero...
Craig Topper [Sat, 20 Feb 2021 21:48:18 +0000 (13:48 -0800)]
[RISCV] Add another test case showing failure to use remw when the RHS has been zero extended from less than i32. NFC

3 years ago[clang-itdy] Simplify virtual near-miss check
Stephen Kelly [Tue, 29 Dec 2020 13:18:57 +0000 (13:18 +0000)]
[clang-itdy] Simplify virtual near-miss check

Diagnose the problem in templates in the context of the template
declaration instead of in the context of all of the (possibly very many)
template instantiations.

Differential Revision: https://reviews.llvm.org/D96224

3 years ago[ConstantRange] Handle wrapping ranges in min/max (PR48643)
Nikita Popov [Fri, 1 Jan 2021 20:57:34 +0000 (21:57 +0100)]
[ConstantRange] Handle wrapping ranges in min/max (PR48643)

When one of the inputs is a wrapping range, intersect with the
union of the two inputs. The union of the two inputs corresponds
to the result we would get if we treated the min/max as a simple
select.

This fixes PR48643.

3 years ago[InstCombine] fold fdiv with exp/exp2 divisor (PR49147)
Sanjay Patel [Sat, 20 Feb 2021 14:02:39 +0000 (09:02 -0500)]
[InstCombine] fold fdiv with exp/exp2 divisor (PR49147)

Follow-up to:
D96648 / b40fde062
...for the special-case base calls.

From the earlier commit:
This is unusual in the general (non-reciprocal) case because we need
an extra instruction, but that should be better for general FP
reassociation and codegen. We conservatively check for "arcp" FMF
here as we do with existing fdiv folds, but it is not strictly
necessary to have that.

3 years ago[InstCombine] add tests for fdiv of exp/exp2; NFC
Sanjay Patel [Fri, 19 Feb 2021 21:36:02 +0000 (16:36 -0500)]
[InstCombine] add tests for fdiv of exp/exp2; NFC

3 years ago[ConstantRange] Handle wrapping range in binaryNot()
Nikita Popov [Sat, 20 Feb 2021 20:42:26 +0000 (21:42 +0100)]
[ConstantRange] Handle wrapping range in binaryNot()

We don't need any special handling for wrapping ranges (or empty
ranges for that matter). The sub() call will already compute a
correct and precise range.

We only need to adjust the test expectation: We're now computing
an optimal result, rather than an unsigned envelope.

3 years ago[OpenMP] libomp: cleanup some resource leaks
AndreyChurbanov [Sat, 20 Feb 2021 20:26:35 +0000 (23:26 +0300)]
[OpenMP] libomp: cleanup some resource leaks

Close mutexattr and condattr local objects to eliminate resource leaks.

Differential Revision: https://reviews.llvm.org/D96892

3 years ago[RISCV] Add an additional remw test to rv64m-exhaustive-w-insts.ll. NFC
Craig Topper [Sat, 20 Feb 2021 19:51:41 +0000 (11:51 -0800)]
[RISCV] Add an additional remw test to rv64m-exhaustive-w-insts.ll. NFC

This adds the IR for this C code

int32_t foo(uint16_t x, int16_t y) {
  x %= y;
  return x;
}

Note the dividend is unsigned and the divisor is signed. C type
promotion rules will extend them and use a 32-bit srem and the
function returns a 32-bit result.

We fail to use remw for this case. The zero extended input has
enough sign bits, but we won't consider (i64 AssertZext X, i16) in
the sexti32 isel pattern.

We also end up with a extra shifts to zero upper bits on the result.
computeKnownBits knew the result was positive before type legalization
and allowed the SIGN_EXTEND to become ZERO_EXTEND. But after promoting
to i64 we no longer know that bit 31 (and all bits above it) should
be 0.

3 years ago[Clang][OpenMP] Update driver test case for OpenMP offload to use sm_35
Shilei Tian [Sat, 20 Feb 2021 20:13:22 +0000 (15:13 -0500)]
[Clang][OpenMP] Update driver test case for OpenMP offload to use sm_35

`sm_35` is the minimum requirement for OpenMP offloading on NVPTX device.
Current driver test case is using `sm_20`. D97003 is going to switch the minimum
CUDA version to 9.2, which only supports `sm_30+`. This patch makes step for the
change.

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D97120

3 years ago[clang-tidy] Simplify braced init check
Stephen Kelly [Tue, 29 Dec 2020 13:42:20 +0000 (13:42 +0000)]
[clang-tidy] Simplify braced init check

The normalization of matchers means that this now works in all language
modes.

Differential Revision: https://reviews.llvm.org/D96135

3 years agoclang: Exclude efi_main from -Wmissing-prototypes
Daan De Meyer [Sat, 30 Jan 2021 19:28:11 +0000 (19:28 +0000)]
clang: Exclude efi_main from -Wmissing-prototypes

When compiling UEFI applications, the main function is named
efi_main() instead of main(). Let's exclude efi_main() from
-Wmissing-prototypes as well to avoid warnings when working
on UEFI applications.

Differential Revision: https://reviews.llvm.org/D95746

3 years ago[ConstantRangeTest] Print detailed information on failure (NFC)
Nikita Popov [Sat, 20 Feb 2021 18:53:38 +0000 (19:53 +0100)]
[ConstantRangeTest] Print detailed information on failure (NFC)

When the optimality check fails, print the inputs, the computed
range and the better range that was found. This makes it much
simpler to identify the cause of the failure.

Make sure that full ranges (which, unlikely all the other cases,
have multiple ways to construct them that all result in the same
range) only print one message by handling them separately.

3 years ago[lld/mac] reject -undefined warning and -undefined suppress with -twolevel_namespace
Nico Weber [Thu, 18 Feb 2021 13:48:07 +0000 (08:48 -0500)]
[lld/mac] reject -undefined warning and -undefined suppress with -twolevel_namespace

See discussion on https://reviews.llvm.org/D93263

-flat_namespace isn't implemented yet, and neither is -undefined dynamic,
so this makes -undefined pretty pointless in lld/MachO for now. But once
we implement -flat_namespace (which we need to do anyways to get check-llvm
to pass with lld as host linker), the code's already there.

Follow-up to https://reviews.llvm.org/D93263#2491865

Differential Revision: https://reviews.llvm.org/D96963

3 years ago[ASTMatchers] Fix hasUnaryOperand matcher for postfix operators
Stephen Kelly [Fri, 19 Feb 2021 22:59:35 +0000 (22:59 +0000)]
[ASTMatchers] Fix hasUnaryOperand matcher for postfix operators

Differential Revision: https://reviews.llvm.org/D97095

3 years ago[LTO] Fix cloning of llvm*.used when splitting module
Teresa Johnson [Fri, 19 Feb 2021 01:23:02 +0000 (17:23 -0800)]
[LTO] Fix cloning of llvm*.used when splitting module

Refines the fix in 3c4c205060c9398da705eb71b63ddd8a04999de9 to only
put globals whose defs were cloned into the split regular LTO module
on the cloned llvm*.used globals. This avoids an issue where one of the
attached values was a local that was promoted in the original module
after the module was cloned. We only need to have the values defined in
the new module on those globals.

Fixes PR49251.

Differential Revision: https://reviews.llvm.org/D97013

3 years ago[OpenMP][NFC] clang-format the whole openmp project
Shilei Tian [Sat, 20 Feb 2021 17:46:04 +0000 (12:46 -0500)]
[OpenMP][NFC] clang-format the whole openmp project

Same script as D95318. Test files are excluded.

Reviewed By: AndreyChurbanov

Differential Revision: https://reviews.llvm.org/D97088

3 years agoRevert "Implement nullPointerConstant() using a better API."
Stephen Kelly [Sun, 14 Feb 2021 15:16:35 +0000 (15:16 +0000)]
Revert "Implement nullPointerConstant() using a better API."

This reverts commit 9148302a (2019-08-22) which broke the pre-existing
unit test for the matcher.  Also revert commit 518b2266 (Fix the
nullPointerConstant() test to get bots back to green., 2019-08-22) which
incorrectly changed the test to expect the broken behavior.

Differential Revision: https://reviews.llvm.org/D96665

3 years ago[RISCV] Support extraction of misaligned subvectors
Fraser Cormack [Thu, 18 Feb 2021 12:48:14 +0000 (12:48 +0000)]
[RISCV] Support extraction of misaligned subvectors

This patch extends the support for RVV EXTRACT_SUBVECTOR to cover those
which don't align to a vector register boundary. It accomplishes this by
extracting the nearest register-sized subvector (a subregister
operation), then sliding the vector down with VSLIDEDOWN and extracting
the subvector from the first position (a COPY operation).

Since this procedure involves the use of VSCALE and multiplication, the
handling of such operations is done during lowering to simplify the
implementation and make use of DAG combining. This necessitated moving
some helper functions from RISCVISelDAGToDAG to RISCVTargetLowering.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D96959

3 years ago[RISCV] Improve register allocation around vector masks
Fraser Cormack [Fri, 19 Feb 2021 15:54:40 +0000 (15:54 +0000)]
[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

3 years ago[lit testing] "END." not "END:"
David Zarzycki [Sat, 20 Feb 2021 14:43:36 +0000 (09:43 -0500)]
[lit testing] "END." not "END:"

3 years ago[InstCombine] matchBSwapOrBitReverse - remove pattern matching early-out. NFCI.
Simon Pilgrim [Sat, 20 Feb 2021 12:25:58 +0000 (12:25 +0000)]
[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

3 years ago[libc++] Fix the build for AppleClang.
Mark de Wever [Sat, 20 Feb 2021 12:52:40 +0000 (13:52 +0100)]
[libc++] Fix the build for AppleClang.

Forgot to add some parts of D93593, this should disable the tests on
Apple. Seems Louis was right ;-)

3 years ago[RISCV] Pre-commit test case for D97055. NFC.
Fraser Cormack [Sat, 20 Feb 2021 12:34:27 +0000 (12:34 +0000)]
[RISCV] Pre-commit test case for D97055. NFC.

This adds a test which unnecessarily spills mask registers.

3 years ago[X86][SSE] Use llvm min/max intrinsics instead of (deprecated) sse intrinsics. NFCI.
Simon Pilgrim [Sat, 20 Feb 2021 12:17:46 +0000 (12:17 +0000)]
[X86][SSE] Use llvm min/max intrinsics instead of (deprecated) sse intrinsics. NFCI.

These are auto-upgraded to the equivalent llvm variants now.

3 years ago[X86][SSE] vector-compare-combines.ll - use llvm min/max intrinsics instead of (depre...
Simon Pilgrim [Sat, 20 Feb 2021 12:16:54 +0000 (12:16 +0000)]
[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.

3 years ago[X86][AVX] Remove AVX2 min/max intrinsics tests
Simon Pilgrim [Sat, 20 Feb 2021 12:13:06 +0000 (12:13 +0000)]
[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

3 years ago[X86][SSE] Remove SSE41 min/max intrinsics tests
Simon Pilgrim [Sat, 20 Feb 2021 12:11:50 +0000 (12:11 +0000)]
[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

3 years ago[X86][SSE2] Remove SSE2 min/max intrinsics tests
Simon Pilgrim [Sat, 20 Feb 2021 12:10:58 +0000 (12:10 +0000)]
[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

3 years ago[X86] KnownBits - use llvm min/max intrinsics instead of (deprecated) sse intrinsics...
Simon Pilgrim [Sat, 20 Feb 2021 12:07:02 +0000 (12:07 +0000)]
[X86] KnownBits - use llvm min/max intrinsics instead of (deprecated) sse intrinsics. NFCI.

These are auto-upgraded to the equivalent llvm variants now.

3 years ago[DAG] foldSubToUSubSat - fold sub(a,trunc(umin(zext(a),b))) -> usubsat(a,trunc(umin...
Simon Pilgrim [Fri, 19 Feb 2021 18:56:20 +0000 (18:56 +0000)]
[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

3 years ago[ConstantRangeTest] Make exhaustive testing more principled (NFC)
Nikita Popov [Wed, 23 Sep 2020 18:43:59 +0000 (20:43 +0200)]
[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

3 years ago[Sanitizers][NFC] Fix typo
Luís Marques [Sat, 20 Feb 2021 10:54:00 +0000 (10:54 +0000)]
[Sanitizers][NFC] Fix typo

3 years ago[lit] Add --xfail and --filter-out (inverse of --filter)
David Zarzycki [Tue, 16 Feb 2021 11:16:10 +0000 (06:16 -0500)]
[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

3 years agoUpdate BPFAdjustOpt.cpp to accept select form of or as well
Juneyoung Lee [Sat, 20 Feb 2021 09:22:38 +0000 (18:22 +0900)]
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.

3 years ago[AArch64][GlobalISel] Add selection support for G_VECREDUCE of <2 x i32>
Amara Emerson [Sat, 20 Feb 2021 08:38:17 +0000 (00:38 -0800)]
[AArch64][GlobalISel] Add selection support for G_VECREDUCE of <2 x i32>

This selects to a pairwise add and a subreg copy.

3 years ago[libcxx] [test] Remove two unnecesary files/variables in a test
Martin Storsjö [Fri, 19 Feb 2021 21:10:11 +0000 (23:10 +0200)]
[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
0f8c8f59df057a85d6d49913ec9877c6d597785b, without any apparent
purpose there.

Differential Revision: https://reviews.llvm.org/D97083

3 years ago[libcxx] Rename a method in PathParser for clarity. NFC.
Martin Storsjö [Fri, 8 Jan 2021 22:20:35 +0000 (00:20 +0200)]
[libcxx] Rename a method in PathParser for clarity. NFC.

Differential Revision: https://reviews.llvm.org/D97081

3 years ago[libc++] Fixes _LIBCPP_HAS_NO_CONCEPTS
Mark de Wever [Sat, 20 Feb 2021 08:13:16 +0000 (09:13 +0100)]
[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.

3 years ago[InstCombine] Add more tests to nonnull-select.ll (NFC)
Juneyoung Lee [Sat, 20 Feb 2021 07:59:52 +0000 (16:59 +0900)]
[InstCombine] Add more tests to nonnull-select.ll (NFC)

3 years ago[CodeGen] Use range-based for loops (NFC)
Kazu Hirata [Sat, 20 Feb 2021 06:44:14 +0000 (22:44 -0800)]
[CodeGen] Use range-based for loops (NFC)

3 years ago[TableGen] Use ListSeparator (NFC)
Kazu Hirata [Sat, 20 Feb 2021 06:44:12 +0000 (22:44 -0800)]
[TableGen] Use ListSeparator (NFC)

3 years agoFixed failing test
Dávid Bolvanský [Sat, 20 Feb 2021 06:11:42 +0000 (07:11 +0100)]
Fixed failing test

3 years agoReduce the number of attributes attached to each function
Dávid Bolvanský [Sat, 20 Feb 2021 05:57:47 +0000 (06:57 +0100)]
Reduce the number of attributes attached to each function

This takes advantage of the implicit default behavior to reduce the number of
attributes.

3 years agoReland "[Libcalls, Attrs] Annotate libcalls with noundef"
Dávid Bolvanský [Sat, 20 Feb 2021 03:19:03 +0000 (04:19 +0100)]
Reland "[Libcalls, Attrs] Annotate libcalls with noundef"

Fixed Clang tests.

3 years ago[ValueTracking] Improve impliesPoison
Juneyoung Lee [Thu, 18 Feb 2021 03:38:40 +0000 (12:38 +0900)]
[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

3 years ago[mlir][sparse] convert function pass to module pass
Aart Bik [Sat, 20 Feb 2021 01:58:08 +0000 (17:58 -0800)]
[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

3 years ago[SampleFDO] Skip PreLink ICP for better profile quality of MonoLTO PostLink
Wenlei He [Fri, 19 Feb 2021 04:11:58 +0000 (20:11 -0800)]
[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

3 years agoRevert "[Libcalls, Attrs] Annotate libcalls with noundef"
Dávid Bolvanský [Sat, 20 Feb 2021 03:17:44 +0000 (04:17 +0100)]
Revert "[Libcalls, Attrs] Annotate libcalls with noundef"

This reverts commit 33b0c63775ce58014c55e285671e3315104a6076. Bots are failing. Some Clang tests need to be updated too.

3 years ago[RISCV] Teach our custom vector load/store intrinsic isel code to propagate memory...
Craig Topper [Sat, 20 Feb 2021 02:56:08 +0000 (18:56 -0800)]
[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.

3 years ago[Libcalls, Attrs] Annotate libcalls with noundef
Dávid Bolvanský [Sat, 20 Feb 2021 03:08:50 +0000 (04:08 +0100)]
[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

3 years agoRevert "[BuildLibcalls] Mark some libcalls with inaccessiblememonly and inaccessiblem...
Dávid Bolvanský [Sat, 20 Feb 2021 02:58:53 +0000 (03:58 +0100)]
Revert "[BuildLibcalls] Mark some libcalls with inaccessiblememonly and inaccessiblemem_or_argmemonly"

This reverts commit 05d891a19e45687090edcfccfbad334911659eb0.

3 years ago[BuildLibcalls] Mark some libcalls with inaccessiblememonly and inaccessiblemem_or_ar...
Dávid Bolvanský [Wed, 20 Jan 2021 00:27:25 +0000 (01:27 +0100)]
[BuildLibcalls] Mark some libcalls with inaccessiblememonly and inaccessiblemem_or_argmemonly

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D94850

3 years ago[CodeGen] Fix two dots between text section name and symbol name
Pan, Tao [Sat, 20 Feb 2021 02:15:06 +0000 (10:15 +0800)]
[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

3 years agoRevert "Implement -bundle_loader"
Vitaly Buka [Sat, 20 Feb 2021 00:04:49 +0000 (16:04 -0800)]
Revert "Implement -bundle_loader"

D95913 passes null pointer into memcpy

This reverts commit 1a0afcf518717f61d45a1cdc6ad1a6436ec663b1.

3 years ago[ValueTypes] Assert if changeVectorElementType is called on a simple type with an...
Craig Topper [Sat, 20 Feb 2021 01:19:25 +0000 (17:19 -0800)]
[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

3 years ago[dfsan] Add utils that get/set origins
Jianzhou Zhao [Fri, 19 Feb 2021 21:32:37 +0000 (21:32 +0000)]
[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

3 years agoDifferent fix for gcc bug
Jacques Pienaar [Sat, 20 Feb 2021 00:41:00 +0000 (16:41 -0800)]
Different fix for gcc bug

Was still running into

from definition of 'template<class T> struct llvm::DenseMapInfo'
[-fpermissive]
 template <typename T> struct DenseMapInfo;
                               ^

3 years ago[flang][fir] Update flang test tool support classes.
Eric Schweitz [Fri, 19 Feb 2021 19:05:41 +0000 (11:05 -0800)]
[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

3 years agoRevert "Revert "Fix MLIR Toy tutorial JIT example and add a test to cover it""
Mehdi Amini [Fri, 19 Feb 2021 23:53:13 +0000 (23:53 +0000)]
Revert "Revert "Fix MLIR Toy tutorial JIT example and add a test to cover it""

This reverts commit f36060417ad3e247900dfcb07a2476a9d92ee2d2 and
reapply commit ae15b1e7ad71e4bfde1b031dd5e6b0bbb3b88a42.

JIT test must be annotated to not run on Windows.

3 years ago[SystemZ/z/OS] Add XPLINK 64-bit calling convention to tablegen.
Yusra Syeda [Fri, 19 Feb 2021 22:44:10 +0000 (17:44 -0500)]
[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

3 years ago[Coverage] Normalize compilation dir as well
Petr Hosek [Thu, 18 Feb 2021 23:01:05 +0000 (15:01 -0800)]
[Coverage] Normalize compilation dir as well

This matches debug info behavior.

Differential Revision: https://reviews.llvm.org/D97001

3 years ago[libc++][nfc] Only test if pair is_assignable after C++03.
zoecarver [Fri, 19 Feb 2021 23:12:19 +0000 (15:12 -0800)]
[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.

3 years ago[libcxx] Enable filesystem by default for mingw targets
Martin Storsjö [Wed, 4 Nov 2020 22:13:22 +0000 (00:13 +0200)]
[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

3 years ago[ValueTracking] Add a two argument form of safeCtxI [NFC]
Philip Reames [Fri, 19 Feb 2021 22:51:53 +0000 (14:51 -0800)]
[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.

3 years ago[AArch64] Adding Neon Polynomial vadd Intrinsics
Christopher Tetreault [Fri, 19 Feb 2021 22:46:36 +0000 (14:46 -0800)]
[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

3 years ago[AArch64][GlobalISel] Make G_VECREDUCE_ADD of <2 x s32> legal.
Amara Emerson [Fri, 19 Feb 2021 22:27:08 +0000 (14:27 -0800)]
[AArch64][GlobalISel] Make G_VECREDUCE_ADD of <2 x s32> legal.

3 years agoRevert "Fix MLIR Toy tutorial JIT example and add a test to cover it"
Stella Stamenova [Fri, 19 Feb 2021 21:38:43 +0000 (13:38 -0800)]
Revert "Fix MLIR Toy tutorial JIT example and add a test to cover it"

This reverts commit ae15b1e7ad71e4bfde1b031dd5e6b0bbb3b88a42.

This commit caused failures on the mlir windows buildbot

3 years ago[dfsan] Add origin address calculation
Jianzhou Zhao [Fri, 19 Feb 2021 17:50:02 +0000 (17:50 +0000)]
[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

3 years ago[libc++][nfc] SFINAE on pair/tuple assignment operators: LWG 2729.
zoecarver [Fri, 19 Feb 2021 21:24:30 +0000 (13:24 -0800)]
[libc++][nfc] SFINAE on pair/tuple assignment operators: LWG 2729.

This patch ensures that SFINAE is used to delete assignment operators in pair and tuple based on issue 2729.

Differential Review: https://reviews.llvm.org/D62454

3 years ago[RISCV] Remove VPatILoad and VPatIStore multiclasses that are no longer used. NFC
Craig Topper [Fri, 19 Feb 2021 21:23:08 +0000 (13:23 -0800)]
[RISCV] Remove VPatILoad and VPatIStore multiclasses that are no longer used. NFC

3 years agoAdd datalayout to test added in 7e3183d73
Philip Reames [Fri, 19 Feb 2021 21:09:34 +0000 (13:09 -0800)]
Add datalayout to test added in 7e3183d73

Realized after pushing this would probably fail on bots for other than x86-64.

3 years ago[lldb] Rename {stop,run}_vote to report_{stop,run}_vote
Dave Lee [Wed, 17 Feb 2021 23:09:50 +0000 (15:09 -0800)]
[lldb] Rename {stop,run}_vote to report_{stop,run}_vote

Rename `stop_vote` and `run_vote` to `report_stop_vote` and `report_run_vote`
respectively. These variables are limited to logic involving (event) reporting only.
This naming is intended to make their context more clear.

Differential Revision: https://reviews.llvm.org/D96917

3 years agoAdd test triggered by review discussion on D97077
Philip Reames [Fri, 19 Feb 2021 21:03:31 +0000 (13:03 -0800)]
Add test triggered by review discussion on D97077

3 years agoPatch by @wecing (Chenguang Wang).
Tim Shen [Fri, 19 Feb 2021 20:19:34 +0000 (12:19 -0800)]
Patch by @wecing (Chenguang Wang).

The current getFoldedSizeOf() implementation uses naive recursion, which
could be really slow when the input structure type is too complex.

This issue was first brought up in
http://llvm.org/bugs/show_bug.cgi?id=8281; this change fixes it by
adding memoization.

Differential Revision: https://reviews.llvm.org/D6594

3 years ago[mlir] Add math polynomial approximation pass
Eugene Zhulenev [Fri, 19 Feb 2021 00:24:56 +0000 (16:24 -0800)]
[mlir] Add math polynomial approximation pass

This gives ~30x speedup compared to expanding Tanh into exp operations:

```
name                  old cpu/op  new cpu/op  delta
BM_mlir_Tanh_f32/10    253ns ± 3%    55ns ± 7%  -78.35%  (p=0.000 n=44+41)
BM_mlir_Tanh_f32/100  2.21µs ± 4%  0.14µs ± 8%  -93.85%  (p=0.000 n=48+49)
BM_mlir_Tanh_f32/1k   22.6µs ± 4%   0.7µs ± 5%  -96.68%  (p=0.000 n=32+42)
BM_mlir_Tanh_f32/10k   225µs ± 5%     7µs ± 6%  -96.88%  (p=0.000 n=49+55)

name                  old time/op             new time/op             delta
BM_mlir_Tanh_f32/10    259ns ± 1%               56ns ± 2%  -78.31%        (p=0.000 n=41+39)
BM_mlir_Tanh_f32/100  2.27µs ± 1%             0.14µs ± 5%  -93.89%        (p=0.000 n=46+49)
BM_mlir_Tanh_f32/1k   22.9µs ± 1%              0.8µs ± 4%  -96.67%        (p=0.000 n=30+42)
BM_mlir_Tanh_f32/10k   230µs ± 0%                7µs ± 3%  -96.88%        (p=0.000 n=37+55)
```

This approximations is based on Eigen::generic_fast_tanh function

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D96739

3 years ago[clang] Emit type metadata on available_externally vtables for WPD
Teresa Johnson [Wed, 17 Feb 2021 03:44:58 +0000 (19:44 -0800)]
[clang] Emit type metadata on available_externally vtables for WPD

When WPD is enabled, via WholeProgramVTables, emit type metadata for
available_externally vtables. Additionally, add the vtables to the
llvm.compiler.used global so that they are not prematurely eliminated
(before *LTO analysis).

This is needed to avoid devirtualizing calls to a function overriding a
class defined in a header file but with a strong definition in a shared
library. Without type metadata on the available_externally vtables from
the header, the WPD analysis never sees what a derived class is
overriding. Even if the available_externally base class functions are
pure virtual, because shared library definitions are already treated
conservatively (committed patches D91583, D96721, and D96722) we will
not devirtualize, which would be unsafe since the library might contain
overrides that aren't visible to the LTO unit.

An example is std::error_category, which is overridden in LLVM
and causing failures after a self build with WPD enabled, because
libstdc++ contains hidden overrides of the virtual base class methods.

Differential Revision: https://reviews.llvm.org/D96919

3 years ago[msan] Set cmpxchg shadow precisely
Jianzhou Zhao [Fri, 19 Feb 2021 04:37:49 +0000 (04:37 +0000)]
[msan] Set cmpxchg shadow precisely

In terms of https://llvm.org/docs/LangRef.html#cmpxchg-instruction,
the return type of chmpxchg is a pair {ty, i1}, while I think we
only wanted to set the shadow for the address 0th op, and it has type
ty.

Reviewed-by: eugenis
Differential Revision: https://reviews.llvm.org/D97029

3 years agoprecommit test cleanup for D97077
Philip Reames [Fri, 19 Feb 2021 20:19:31 +0000 (12:19 -0800)]
precommit test cleanup for D97077

3 years ago[flang][fir][NFC] run clang-format
Eric Schweitz [Fri, 19 Feb 2021 20:05:26 +0000 (12:05 -0800)]
[flang][fir][NFC] run clang-format

cleanup post-merge

3 years ago[Verifier] remove dead code for saturating intrinsics; NFC
Sanjay Patel [Fri, 19 Feb 2021 19:56:20 +0000 (14:56 -0500)]
[Verifier] remove dead code for saturating intrinsics; NFC

Test coverage shows that we assert with the string from the
tablegen defs file for these intrinsics, so these cases
should never be live.

3 years ago[Verifier] add tests for saturating intrinsics; NFC
Sanjay Patel [Fri, 19 Feb 2021 19:48:12 +0000 (14:48 -0500)]
[Verifier] add tests for saturating intrinsics; NFC

As noted in D96904, we don't have direct tests for these malformed ops.

3 years ago[libcxx] Make generic_*string return paths with forward slashes on windows
Martin Storsjö [Mon, 9 Nov 2020 09:45:13 +0000 (11:45 +0200)]
[libcxx] Make generic_*string return paths with forward slashes on windows

This matches what MS STL returns; in std::filesystem, forward slashes
are considered generic dir separators that are valid on all platforms.

Differential Revision: https://reviews.llvm.org/D91181

3 years ago[elfabi] Fix a bug when .dynsym contains no non-local symbol
Haowei Wu [Thu, 18 Feb 2021 04:10:44 +0000 (20:10 -0800)]
[elfabi] Fix a bug when .dynsym contains no non-local symbol

This patch fixed a bug when elbabi was supplied with a tbe file
contains no non-local symbol. Before this patch, it wrote 0 to
sh_info of the .dynsym section, making the ELF stub file invalid.
This patch fixed this issue.

Differential Revision: https://reviews.llvm.org/D96930