platform/upstream/llvm.git
4 years agoRevert "[Attributor] AAPotentialValues Interface"
Shinji Okumura [Sun, 2 Aug 2020 13:48:28 +0000 (22:48 +0900)]
Revert "[Attributor] AAPotentialValues Interface"

The commit cause build failure.

4 years ago[InstSimplify] Reduce code duplication in icmp of binop folds (NFC)
Nikita Popov [Sun, 2 Aug 2020 13:45:24 +0000 (15:45 +0200)]
[InstSimplify] Reduce code duplication in icmp of binop folds (NFC)

For folds where we check for the binop on both the LHS and RHS,
extract a function that expects it on the LHS and call it with
swapped order.

4 years ago[DWARFYAML][debug_aranges] Make the 'Descriptors' field optional.
Xing GUO [Sun, 2 Aug 2020 13:37:11 +0000 (21:37 +0800)]
[DWARFYAML][debug_aranges] Make the 'Descriptors' field optional.

4 years ago[X86] Use const APInt& in for-range loop to avoid unnecessary copies. NFCI.
Simon Pilgrim [Sun, 2 Aug 2020 13:32:05 +0000 (14:32 +0100)]
[X86] Use const APInt& in for-range loop to avoid unnecessary copies. NFCI.

Fixes clang-tidy warning.

4 years ago[X86] Pass SDLoc by const reference. NFCI.
Simon Pilgrim [Sun, 2 Aug 2020 13:23:00 +0000 (14:23 +0100)]
[X86] Pass SDLoc by const reference. NFCI.

4 years ago[X86] Use const APInt& in for-range loop to avoid unnecessary copies. NFCI.
Simon Pilgrim [Sun, 2 Aug 2020 13:15:15 +0000 (14:15 +0100)]
[X86] Use const APInt& in for-range loop to avoid unnecessary copies. NFCI.

Fixes clang-tidy warning.

4 years ago[X86] combineX86ShuffleChain - pull out repeated RootVT.getSizeInBits() calls. NFCI.
Simon Pilgrim [Sun, 2 Aug 2020 13:13:13 +0000 (14:13 +0100)]
[X86] combineX86ShuffleChain - pull out repeated RootVT.getSizeInBits() calls. NFCI.

4 years ago[Attributor] AAPotentialValues Interface
Shinji Okumura [Sun, 2 Aug 2020 09:37:07 +0000 (18:37 +0900)]
[Attributor] AAPotentialValues Interface

This is a split patch of D80991.
This patch introduces AAPotentialValues and its interface only.
For more detail of AAPotentialValues abstract attribute, see the original patch.

Reviewed By: jdoerfert

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

4 years ago[SCEV] Precommit tests with signed counting down loop.
Florian Hahn [Fri, 31 Jul 2020 21:10:39 +0000 (22:10 +0100)]
[SCEV] Precommit tests with signed counting down loop.

From PR46939.

4 years ago[CMake] Pass bugreport URL to standalone clang build
Michał Górny [Thu, 30 Jul 2020 22:11:40 +0000 (00:11 +0200)]
[CMake] Pass bugreport URL to standalone clang build

BUG_REPORT_URL is currently used both in LLVM and in Clang but declared
only in the latter.  This means that it's missing in standalone clang
builds and the driver ends up outputting:

  PLEASE submit a bug report to  and include [...]

(note the missing URL)

To fix this, include LLVM_PACKAGE_BUGREPORT in LLVMConfig.cmake
(similarly to how we pass PACKAGE_VERSION) and use it to fill
BUG_REPORT_URL when building clang standalone.

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

4 years ago[X86] Improve parity idiom recognition to handle (and (truncate (ctpop X)), 1).
Craig Topper [Sun, 2 Aug 2020 05:05:10 +0000 (22:05 -0700)]
[X86] Improve parity idiom recognition to handle (and (truncate (ctpop X)), 1).

Fixes part of PR46954

4 years ago[X86] Add parity test cases for PR46954.
Craig Topper [Sun, 2 Aug 2020 04:57:24 +0000 (21:57 -0700)]
[X86] Add parity test cases for PR46954.

This adds tests cases where the parity idiom of (and (ctpop X, 1))
has a truncate in the middle.

4 years ago[HotColdSplit] Add test case for unlikely attribute in outlined function
AK [Sun, 2 Aug 2020 05:34:44 +0000 (22:34 -0700)]
[HotColdSplit] Add test case for unlikely attribute in outlined function

Authored by: rjf (Ruijie Fang)
Reviewed by: hiraditya,tejohnson,fhahn

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

4 years agoOutline non returning functions unless a longjmp
AK [Sun, 2 Aug 2020 02:15:05 +0000 (19:15 -0700)]
Outline non returning functions unless a longjmp

__assert_fail, abort, exit etc. are cold.
TODO: outline throw

Authored by: rjf (Ruijie Fang)
Reviewed by: hiraditya,tejohnson,fhahn

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

4 years agoUse llvm::is_contained where appropriate (NFC)
Kazu Hirata [Sun, 2 Aug 2020 04:49:38 +0000 (21:49 -0700)]
Use llvm::is_contained where appropriate (NFC)

Use llvm::is_contained where appropriate (NFC)

Reviewed By: kazu

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

4 years ago[llvm-jitlink] Add -phony-externals option to suppress unresolved externals.
Lang Hames [Sun, 2 Aug 2020 00:44:34 +0000 (17:44 -0700)]
[llvm-jitlink] Add -phony-externals option to suppress unresolved externals.

The -phony-externals option adds a generator which explicitly defines any
otherwise unresolved externals as null. This transforms link-time
unresolved-symbol errors into potential runtime null pointer accesses
(if an unresolved external is actually accessed during execution).

This option can be useful in -harness mode to avoid having to mock a
large number of symbols that are not reachable at runtime (e.g. unused
methods referenced by a class vtable).

4 years ago[llvm-jitlink] Support promotion of ODR weak symbols in -harness mode.
Lang Hames [Sat, 1 Aug 2020 04:32:27 +0000 (21:32 -0700)]
[llvm-jitlink] Support promotion of ODR weak symbols in -harness mode.

This prevents weak symbols from being immediately dead-stripped when not
directly referenced from the test harneess, enabling use of weak symbols
from the code under test.

4 years ago[ELF] --wrap: set isUsedInRegularObj of __wrap_ only if it is defined
Fangrui Song [Sun, 2 Aug 2020 01:19:14 +0000 (18:19 -0700)]
[ELF] --wrap: set isUsedInRegularObj of __wrap_ only if it is defined

Fixes PR46169

4 years ago[msan] Respect no_huge_pages_for_shadow.
Evgenii Stepanov [Sat, 1 Aug 2020 00:18:06 +0000 (17:18 -0700)]
[msan] Respect no_huge_pages_for_shadow.

Disable huge pages in the MSan shadow region when
no_huge_pages_for_shadow == true (default).

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

4 years agoUpdated the -I option description.
Andrei Lebedev [Sat, 1 Aug 2020 22:54:11 +0000 (15:54 -0700)]
Updated the -I option description.

4 years ago[NewPM][LVI] Abandon LVI after CVP
Nikita Popov [Thu, 30 Jul 2020 17:14:02 +0000 (19:14 +0200)]
[NewPM][LVI] Abandon LVI after CVP

As mentioned on D70376, LVI can currently cause performance issues
when running under NewPM. The problem is that, unlike the legacy
pass manager, NewPM will not immediately discard the LVI analysis
if the following pass does not need it. This is a problem, because
LVI has a high memory requirement, and mass invalidation of LVI
values is very inefficient. LVI should only be alive during passes
that actively interact with it.

This patch addresses the issue by explicitly abandoning LVI after CVP,
which gets us back to the LegacyPM behavior.

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

4 years ago[X86] Add assembler support for {disp8} and {disp32} to control the size of displacem...
Craig Topper [Sat, 1 Aug 2020 20:25:18 +0000 (13:25 -0700)]
[X86] Add assembler support for {disp8} and {disp32} to control the size of displacement used for memory operands.

These prefixes should override the default behavior and force a larger immediate size. I don't believe gas issues any warning if you use {disp8} when a 32-bit displacement is already required. And this patch doesn't either.

This completes the {disp8} and {disp32} support from PR46650.

Reviewed By: RKSimon

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

4 years ago[InstSimplify] Fold abs(abs(x)) -> abs(x)
Craig Topper [Sat, 1 Aug 2020 17:01:58 +0000 (10:01 -0700)]
[InstSimplify] Fold abs(abs(x)) -> abs(x)

It's always safe to pick the earlier abs regardless of the nsw flag. We'll just lose it if it is on the outer abs but not the inner abs.

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

4 years ago[InstCombine] Fold abs(-x) -> abs(x)
Craig Topper [Sat, 1 Aug 2020 16:59:09 +0000 (09:59 -0700)]
[InstCombine] Fold abs(-x) -> abs(x)

Negating the input doesn't matter. I left a FIXME to copy the nsw flag if its present on the neg but not on the abs.

Reviewed By: nikic

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

4 years ago[PPC] Adjust run line for hardware-loops-crash.ll
Florian Hahn [Sat, 1 Aug 2020 19:58:05 +0000 (20:58 +0100)]
[PPC] Adjust run line for hardware-loops-crash.ll

Looks like %s was accidentally dropped.

4 years ago[LCSSA] Provide option for caller to clean up unused PHIs.
Florian Hahn [Sat, 1 Aug 2020 19:38:38 +0000 (20:38 +0100)]
[LCSSA] Provide option for caller to clean up unused PHIs.

formLCSSAForInstructions is used by SCEVExpander, which tracks all
inserted instructions including LCSSA phis using asserting value
handles. This means cleanup needs to happen in the caller.

Extend formLCSSAForInstructions  to take an optional pointer to a
vector. If this argument is non-nullptr, instead of directly deleting
the phis, add them to the vector, so the caller can process them.

This should address various PPC buildbot failures, including
http://lab.llvm.org:8011/builders/clang-ppc64be-linux-lnt/builds/40567

4 years ago[X86][AVX512] Fold concat(and(x,y),and(z,w)) -> and(concat(x,z),concat(y,w)) for...
Simon Pilgrim [Sat, 1 Aug 2020 19:34:39 +0000 (20:34 +0100)]
[X86][AVX512] Fold concat(and(x,y),and(z,w)) -> and(concat(x,z),concat(y,w)) for 512-bit vectors

Helps vpternlog folding on non-AVX512BW targets

4 years ago[libcxx] Add compatible with constraint tests for some shared_ptr constructors.
zoecarver [Sat, 1 Aug 2020 19:06:31 +0000 (12:06 -0700)]
[libcxx] Add compatible with constraint tests for some shared_ptr constructors.

Add shared_ptr tests where the element type and pointer type aren't 'convertible' but are 'compatible'.

Responding to a comment from D81414.

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

4 years ago[X86][AVX] Ensure we only combine to PSHUFLW/PSHUFHW on supporting targets
Simon Pilgrim [Sat, 1 Aug 2020 13:54:21 +0000 (14:54 +0100)]
[X86][AVX] Ensure we only combine to PSHUFLW/PSHUFHW on supporting targets

Noticed while investigating combining from concatenated shuffle vectors, we weren't checking that PSHUFLW/PSHUFHW was legal - we were depending on lowering splitting to subvectors.

4 years ago[LCSSA] Use IRBuilder for PHI creation.
Florian Hahn [Sat, 1 Aug 2020 16:54:23 +0000 (17:54 +0100)]
[LCSSA] Use IRBuilder for PHI creation.

Use IRBuilder instead PHINode::Create. This should not impact the
generated code, but IRBuilder provides a way to register callbacks for
inserted instructions, which is convenient for some users.

Reviewed By: lebedev.ri

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

4 years ago[VectorCombine] add tests for non-zero gep offsets; NFC
Sanjay Patel [Sat, 1 Aug 2020 12:38:28 +0000 (08:38 -0400)]
[VectorCombine] add tests for non-zero gep offsets; NFC

4 years ago[Attributor][NFC] Update description for the dependency graph
Luofan Chen [Sat, 1 Aug 2020 13:27:16 +0000 (21:27 +0800)]
[Attributor][NFC] Update description for the dependency graph

The word "dependency graph" is a bit misleading. When there is an
edge from node A to B (A -> B), it actually mean that B depends on
A and when the state of A is updated, B should also be updated. So
I update the comment to make the description clearer.

Reviewed By: jdoerfert

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

4 years ago[ARM] Distribute post-inc for Thumb2 sign/zero extending loads/stores
David Green [Sat, 1 Aug 2020 13:01:18 +0000 (14:01 +0100)]
[ARM] Distribute post-inc for Thumb2 sign/zero extending loads/stores

This adds sign/zero extending scalar loads/stores to the MVE
instructions added in D77813, allowing us to create up more post-inc
instructions. These are comparatively simple, compared to LDR/STR (which
may be better turned into an LDRD/LDM), but still require some additions
over MVE instructions. Because there are i12 and i8 variants of the
offset loads/stores dealing with different signs, we may need to convert
an i12 address to a i8 negative instruction. t2LDRBi12 can also be
shrunk to a tLDRi under the right conditions, so we need to be careful
with codesize too.

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

4 years ago[mlir][Vector] Simplify code a bit. NFCI.
Benjamin Kramer [Sat, 1 Aug 2020 12:48:42 +0000 (14:48 +0200)]
[mlir][Vector] Simplify code a bit. NFCI.

4 years ago[InstSimplify] simplify abs if operand is known non-negative
Sanjay Patel [Sat, 1 Aug 2020 11:46:23 +0000 (07:46 -0400)]
[InstSimplify] simplify abs if operand is known non-negative

abs() should be rare enough that using value tracking is not going
to be a compile-time cost burden, so use it to reduce a variety of
potential patterns. We do this in DAGCombiner too.

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

4 years ago[InstSimplify] add abs test with assume; NFC
Sanjay Patel [Sat, 1 Aug 2020 11:44:33 +0000 (07:44 -0400)]
[InstSimplify] add abs test with assume; NFC

4 years ago[X86][AVX] Extend v2f64 BROADCAST(LOAD) -> BROADCAST_LOAD to v2i64/v4f32/v4i32
Simon Pilgrim [Sat, 1 Aug 2020 11:28:10 +0000 (12:28 +0100)]
[X86][AVX] Extend v2f64 BROADCAST(LOAD) -> BROADCAST_LOAD to v2i64/v4f32/v4i32

Minor precursor fix for D66004, but helps the SSE41 tests as well as they run with -disable-peephole

4 years ago[clang-tidy][NFC] Small refactor
Nathan James [Sat, 1 Aug 2020 10:04:29 +0000 (11:04 +0100)]
[clang-tidy][NFC] Small refactor

4 years ago[MachineVerifier] Refactor calcRegsPassed. NFC
Evgeny Leviant [Sat, 1 Aug 2020 09:58:52 +0000 (12:58 +0300)]
[MachineVerifier] Refactor calcRegsPassed. NFC

Patch improves performance of verify-machineinstrs pass up to 10x.
Differential revision: https://reviews.llvm.org/D84105

4 years ago[clang-tidy] readability-identifier-naming checks configs for included files
Nathan James [Sat, 1 Aug 2020 09:35:13 +0000 (10:35 +0100)]
[clang-tidy] readability-identifier-naming checks configs for included files

When checking for the style of a decl that isn't in the main file, the check will now search for the configuration that the included files uses to gather the style for its decls.

This can be useful to silence warnings in header files that follow a different naming convention without using header-filter to silence all warnings(even from other checks) in the header file.

Reviewed By: aaron.ballman, gribozavr2

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

4 years ago[X86] Refactor the broadcast and load folding in tryVPTESTM to reduce some code.
Craig Topper [Sat, 1 Aug 2020 06:10:47 +0000 (23:10 -0700)]
[X86] Refactor the broadcast and load folding in tryVPTESTM to reduce some code.

Now we try to load and broadcast together for operand 1. Followed
by load and broadcast for operand 1. Previously we tried load
operand 1, load operand 1, broadcast operand 0, broadcast operand 1.

Now we have a single helper that tries load and broadcast for
one operand that we can just call twice.

4 years ago[SCEV] don't query getSCEV() for incomplete phis
Chen Zheng [Sat, 1 Aug 2020 05:28:15 +0000 (01:28 -0400)]
[SCEV] don't query getSCEV() for incomplete phis

querying getSCEV() for incomplete phis leads to wrong cache value in `ExprToIVMap`,
because incomplete phis may be simplified to same value before get SCEV expression.

Reviewed By: lebedev.ri, mkazantsev

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

4 years ago[X86] Use TargetLowering::getRegClassFor to simplify some code in tryVPTESTM. NFCI
Craig Topper [Sat, 1 Aug 2020 04:38:59 +0000 (21:38 -0700)]
[X86] Use TargetLowering::getRegClassFor to simplify some code in tryVPTESTM. NFCI

4 years agoPowerPC: Don't lower SELECT_CC to PPCISD::FSEL on SPE
Justin Hibbits [Thu, 9 Apr 2020 02:29:40 +0000 (21:29 -0500)]
PowerPC: Don't lower SELECT_CC to PPCISD::FSEL on SPE

SPE doesn't have a fsel instruction, so don't try to lower to it.

This fixes a "Cannot select: tN: f64 = PPCISD::FSEL tX, tY, tZ" error.

Reviewed By: #powerpc, lkail
Differential Revision: https://reviews.llvm.org/D77773

4 years agoPowerPC: Fix SPE extloadf32 handling.
Justin Hibbits [Thu, 16 Apr 2020 14:42:39 +0000 (09:42 -0500)]
PowerPC: Fix SPE extloadf32 handling.

The patterns were incorrect copies from the FPU code, and are
unnecessary, since there's no extended load for SPE.  Just let LLVM
itself do the work by marking it expand.

Reviewed By: #powerpc, lkail
Differential Revision: https://reviews.llvm.org/D78670

4 years ago[VE] Change calling convention to follow ABI
Kazushi (Jam) Marukawa [Sat, 11 Jul 2020 07:01:13 +0000 (16:01 +0900)]
[VE] Change calling convention to follow ABI

Change to expand all arguments and return values to i64 to follow ABI.
Update regression tests also.

Reviewed By: simoll

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

4 years ago[clang-tidy][NFC] Added convienence methods for getting optional options
Nathan James [Sat, 1 Aug 2020 00:45:33 +0000 (01:45 +0100)]
[clang-tidy][NFC] Added convienence methods for getting optional options

These methods abstract away Error handling when trying to read options that can't be parsed by logging the error automatically and returning None.

Reviewed By: gribozavr2

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

4 years ago[AArch64][SVE] Allow vector of pointers as legal type for masked load/store.
Huihui Zhang [Sat, 1 Aug 2020 00:08:17 +0000 (17:08 -0700)]
[AArch64][SVE] Allow vector of pointers as legal type for masked load/store.

Refer to LangRef http://llvm.org/docs/LangRef.html#llvm-masked-load-intrinsics
'llvm.masked.load/store.*’ intrinsics are overloaded intrinsic, which allow the
load/store data to be a vector of any integer, floating-point or pointer data type.

Therefore, allow pointer data type when checking 'isLegalMaskedLoadStore()'.

Reviewed By: paulwalker-arm

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

4 years agoDon't crash if we deserialize a pack expansion type whose pattern
Richard Smith [Sat, 1 Aug 2020 00:07:36 +0000 (17:07 -0700)]
Don't crash if we deserialize a pack expansion type whose pattern
contains no packs.

Fixes a regression from 740a164dec483225cbd02ab6c82199e2747ffacb.

4 years ago[X86] Simplify vpternlog immediate selection.
Craig Topper [Sat, 1 Aug 2020 00:07:20 +0000 (17:07 -0700)]
[X86] Simplify vpternlog immediate selection.

Rather than hardcoding immediate values for 12 different combinations
in a nested pair of switches, we can perform the matched logic
operation on 3 magic constants to calculate the immediate.

Special thanks to this tweet https://twitter.com/rygorous/status/1187034321992871936
for making me realize I could do this.

4 years ago[libc] [obvious] In strrchr, remove cast to unsigned char before
cgyurgyik [Sat, 1 Aug 2020 00:14:34 +0000 (20:14 -0400)]
[libc] [obvious] In strrchr, remove cast to unsigned char before
comparison.

4 years ago[libc] [obvious] Fix strchr and strrchr tests so that constness is
cgyurgyik [Fri, 31 Jul 2020 23:59:29 +0000 (19:59 -0400)]
[libc] [obvious] Fix strchr and strrchr tests so that constness is
actually verified.

4 years ago[compiler-rt][Darwin] Fix linker errors for check-asan
Julian Lettner [Fri, 31 Jul 2020 23:09:13 +0000 (16:09 -0700)]
[compiler-rt][Darwin] Fix linker errors for check-asan

A recent change broke `ninja check-asan` on Darwin by causing an error
during linking of ASan unit tests [1].

Move the addition of `-ObjC` compiler flag outside of the new
`if(COMPILER_RT_STANDALONE_BUILD)` block.  It doesn't add any global
flags (e.g, `${CMAKE_CXX_FLAGS}`) and the decision to add is based
solely on source paths (`${source_rpath}`).

[1] 8b2fcc42b895, https://reviews.llvm.org/D84466

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

4 years agoSupport experimental v extension v0.9.
Hsiangkai Wang [Thu, 4 Jun 2020 19:34:01 +0000 (03:34 +0800)]
Support experimental v extension v0.9.

Differential revision: https://reviews.llvm.org/D81213

4 years agoUpgrade MC to v0.9.
Hsiangkai Wang [Thu, 21 May 2020 09:30:20 +0000 (17:30 +0800)]
Upgrade MC to v0.9.

Differential revision: https://reviews.llvm.org/D80802

4 years ago[ValueTracking] Improve llvm.abs handling in computeKnownBits.
Craig Topper [Fri, 31 Jul 2020 22:46:12 +0000 (15:46 -0700)]
[ValueTracking] Improve llvm.abs handling in computeKnownBits.

Add the optimizations we have in the SelectionDAG version.
Known non-negative copies all known bits. Any known one other than
the sign bit makes result non-negative.

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

4 years ago[OpenMP] Fixed the issue that target memory deallocation might be called when they...
Shilei Tian [Fri, 31 Jul 2020 22:54:09 +0000 (18:54 -0400)]
[OpenMP] Fixed the issue that target memory deallocation might be called when they're being used

This patch fixed the issue that target memory might be deallocated when
they're still being used or before they're used.

Reviewed By: ye-luo

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

4 years ago[InstSimplify] add tests for abs intrinsic; NFC
Sanjay Patel [Fri, 31 Jul 2020 20:35:41 +0000 (16:35 -0400)]
[InstSimplify] add tests for abs intrinsic; NFC

4 years agoUpdated the -I option description.
Andrei Lebedev [Fri, 31 Jul 2020 22:39:12 +0000 (15:39 -0700)]
Updated the -I option description.

4 years agoConvert to early exit (NFC)
Adrian Prantl [Fri, 31 Jul 2020 20:30:59 +0000 (13:30 -0700)]
Convert to early exit (NFC)

4 years ago[mlir] Add shape.with_shape op
Jacques Pienaar [Fri, 31 Jul 2020 21:46:48 +0000 (14:46 -0700)]
[mlir] Add shape.with_shape op

This is an operation that can returns a new ValueShape with a different shape. Useful for composing shape function calls and reusing existing shape transfer functions.

Just adding the op in this change.

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

4 years ago[mlir][PassIncGen] Refactor how pass registration is generated
River Riddle [Fri, 31 Jul 2020 20:18:13 +0000 (13:18 -0700)]
[mlir][PassIncGen] Refactor how pass registration is generated

The current output is a bit clunky and requires including files+macros everywhere, or manually wrapping the file inclusion in a registration function. This revision refactors the pass backend to automatically generate `registerFooPass`/`registerFooPasses` functions that wrap the pass registration. `gen-pass-decls` now takes a `-name` input that specifies a tag name for the group of passes that are being generated. For each pass, the generator now produces a `registerFooPass` where `Foo` is the name of the definition specified in tablegen. It also generates a `registerGroupPasses`, where `Group` is the tag provided via the `-name` input parameter, that registers all of the passes present.

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

4 years ago[MLIR][NFC] Add FuncOp::getArgumentTypes()
Rahul Joshi [Fri, 31 Jul 2020 18:39:49 +0000 (11:39 -0700)]
[MLIR][NFC] Add FuncOp::getArgumentTypes()

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

4 years ago[lldb] report an error if a CLI option lacks an argument
Luboš Luňák [Thu, 30 Jul 2020 16:08:13 +0000 (18:08 +0200)]
[lldb] report an error if a CLI option lacks an argument

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

4 years ago[lldb] force full gui redraw on Ctrl+L
Luboš Luňák [Thu, 30 Jul 2020 19:25:38 +0000 (21:25 +0200)]
[lldb] force full gui redraw on Ctrl+L

As is common with curses apps, this allows to redraw everything
in case something corrupts the screen. Apparently key modifiers
are difficult with curses (curses FAQ it "doesn't do that"),
thankfully Ctrl+key are simply control characters, so it's
(ascii & 037) => 12.

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

4 years ago[clang] Use the location of the void parameters when complaining that only a single...
Jaydeep Chauhan [Fri, 31 Jul 2020 19:22:22 +0000 (20:22 +0100)]
[clang] Use the location of the void parameters when complaining that only a single void parameter should be present.

Fixes PR46417.

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

Reviewed By: aaron.ballman

4 years agoFix a test typo which caused a breakage.
Sriraman Tallam [Fri, 31 Jul 2020 19:26:53 +0000 (12:26 -0700)]
Fix a test typo which caused a breakage.

4 years agoNew test for basic block sections options.
Sriraman Tallam [Fri, 31 Jul 2020 19:00:59 +0000 (12:00 -0700)]
New test for basic block sections options.

This tests lld basic block sections options:
+ --lto-basic-block-sections=
+ --lto-unique-basic-block-section-names

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

4 years ago[libc] [obvious] Add rest of strrchr test.
Chris Gyurgyik [Fri, 31 Jul 2020 18:57:46 +0000 (14:57 -0400)]
[libc] [obvious] Add rest of strrchr test.

4 years agoRename basic block sections options to be consistent.
Sriraman Tallam [Fri, 31 Jul 2020 18:14:49 +0000 (11:14 -0700)]
Rename basic block sections options to be consistent.

D68049 created options for basic block sections: -fbasic-block-sections=,
-funique-basic-block-section-names. Rename options in llc and lld (--lto-)
to be consistent. Specifically,

+ Rename basicblock-sections to basic-block-sections
+ Rename unique-bb-section-names to unique-basic-block-section-names

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

4 years ago[compiler-rt][Darwin] Fix GetOSMajorKernelOffset() on watchOS
Julian Lettner [Fri, 31 Jul 2020 18:38:10 +0000 (11:38 -0700)]
[compiler-rt][Darwin] Fix GetOSMajorKernelOffset() on watchOS

`TARGET_OS_IOS` and `TARGET_OS_WATCH` are not mutually exclusive.
`SANITIZER_IOS` is defined for all embedded platforms.  So the branch
for watchOS is never taken.  We could fix this by switching the order
of the branches (but the reason for doing so is non-obvious).  Instead,
lets use the Darwin-specific `TARGET_OS_*` macros which are mutually
exclusive.

4 years ago[libc] Adds strrchr implementation.
cgyurgyik [Fri, 31 Jul 2020 18:36:23 +0000 (14:36 -0400)]
[libc] Adds strrchr implementation.

Reviewed By: sivachandra

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

4 years ago[gn build] Port b7cfa6ca928
LLVM GN Syncbot [Fri, 31 Jul 2020 18:32:54 +0000 (18:32 +0000)]
[gn build] Port b7cfa6ca928

4 years ago[Loop Peeling] Separate the Loop Peeling Utilities from the Loop Unrolling Utilities
Sidharth Baveja [Fri, 31 Jul 2020 18:31:58 +0000 (18:31 +0000)]
[Loop Peeling] Separate the Loop Peeling Utilities from the Loop Unrolling Utilities

Summary: This patch separates the Loop Peeling Utilities from Loop Unrolling.
The reason for this change is that Loop Peeling is no longer only being used by
loop unrolling; Patch D82927 introduces loop peeling with fusion, such that
loops can be modified to have to same trip count, making them legal to be
peeled.

Reviewed By: Meinersbur

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

4 years ago[flang][OpenMP] Added initial support for lowering OpenMP parallel construct
Sourabh Singh Tomar [Thu, 30 Jul 2020 18:17:51 +0000 (23:47 +0530)]
[flang][OpenMP] Added initial support for lowering OpenMP  parallel construct

This patch lower `!OMP PARALLEL` construct from PFT to OpenMPDialect operations.
This is first patch in this direction(lowering parallel construct).

OpenMP parallel construct can have multiple clauses and parameters. This patch
only implements lowering of an empty(contains no code in body) parallel construct
without any clauses or parameters.

Patch is carved out of following approved PR:
https://github.com/flang-compiler/f18-llvm-project/pull/322

Reviewed By: kiranchandramohan, DavidTruby

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

4 years ago[flang][NFC] Verify C781 from - Clause 7 constraint checks for f18.
sameeran joshi [Fri, 24 Jul 2020 06:55:32 +0000 (12:25 +0530)]
[flang][NFC] Verify C781 from - Clause 7 constraint checks for f18.

Reviewed By: PeteSteinfeld

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

4 years ago[libc++] Avoid including <Block.h> from <functional>
Louis Dionne [Fri, 31 Jul 2020 16:56:36 +0000 (12:56 -0400)]
[libc++] Avoid including <Block.h> from <functional>

Block.h is a pretty common name, which can lead to nasty collisions with
user provided headers. Since we're only getting a few simple declarations
from the header, it's better to declare them manually than to include the
header.

rdar://66384326

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

4 years ago[Support] Fix computeHostNumPhysicalCores() to respect affinity
Fangrui Song [Fri, 31 Jul 2020 18:20:15 +0000 (11:20 -0700)]
[Support] Fix computeHostNumPhysicalCores() to respect affinity

computeHostNumPhysicalCores() is designed to respect CPU affinity.
D84764 used sysconf(_SC_NPROCESSORS_ONLN) which does not respect
affinity.
SupportTests Threading.PhysicalConcurrency may fail if taskset -c is specified.

4 years ago[flang]Verify C7107, C7108, C7109 from - Clause 7 constraint checks for f18.
sameeran joshi [Fri, 24 Jul 2020 08:19:29 +0000 (13:49 +0530)]
[flang]Verify C7107, C7108, C7109 from - Clause 7 constraint checks for f18.

   1.  Annotate the sources with constraint numbers.
   2.  Add tests for

    *C7107 (R765) digit shall have one of the values 0 or 1.
    *C7108 (R766) digit shall have one of the values 0 through 7.
    *C7109 (R764) A boz-literal-constant shall appear only as a data-stmt-constant in a DATA statement, or where explicitly allowed in 16.9 as an actual argument of an intrinsic procedure.

Reviewed By: PeteSteinfeld

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

4 years agoRevert "[flang] Fix multi-config generator builds."
Tim Keith [Fri, 31 Jul 2020 18:10:44 +0000 (11:10 -0700)]
Revert "[flang] Fix multi-config generator builds."

This reverts commit 332170356e35ea9cdc2c1d612b61a50ec5ea322e.

The change breaks out-of-tree builds.
Discussion in https://reviews.llvm.org/D84022

4 years ago[ConstantFolding] fold abs intrinsic
Sanjay Patel [Fri, 31 Jul 2020 15:50:39 +0000 (11:50 -0400)]
[ConstantFolding] fold abs intrinsic

The handling for minimum value is similar to cttz/ctlz with 0 just above this case.

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

4 years agoRuntimeDyldELF: report_fatal_error instead of asserting for unimplemented relocations...
Hans Wennborg [Thu, 23 Jul 2020 09:17:16 +0000 (11:17 +0200)]
RuntimeDyldELF: report_fatal_error instead of asserting for unimplemented relocations (PR46816)

This fixes the ExecutionEngine/MCJIT/stubs-sm-pic.ll test in no-asserts
builds which is set to XFAIL on some platforms like 32-bit x86. More
importantly, we probably don't want to silently error in these cases.

Differential revision: https://reviews.llvm.org/D84390

4 years ago[libc] Add islower and isupper implementation.
cgyurgyik [Fri, 31 Jul 2020 18:04:36 +0000 (14:04 -0400)]
[libc] Add islower and isupper implementation.

Reviewed By: sivachandra

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

4 years ago[libunwind] Add -Wno-suggest-override to CMakeLists.txt.
kristina [Fri, 31 Jul 2020 17:44:02 +0000 (18:44 +0100)]
[libunwind] Add -Wno-suggest-override to CMakeLists.txt.

Set -Wno-suggest-override where such warning is provided
by the compiler when building libunwind, alongside libcxx
and libcxxabi, using recent Clang. This extends behavior
introduced in 77e0e9e17daf0865620abcd41f692ab0642367c4
to libunwind, avoiding a large amount of warnings during
builds. See D84126 for the original patch.

4 years ago[OpenMP][docs] Update loop tiling status.
Michael Kruse [Fri, 31 Jul 2020 18:00:06 +0000 (13:00 -0500)]
[OpenMP][docs] Update loop tiling status.

4 years ago[ValueTracking] Add ComputeNumSignBits support for llvm.abs intrinsic
Craig Topper [Fri, 31 Jul 2020 17:43:00 +0000 (10:43 -0700)]
[ValueTracking] Add ComputeNumSignBits support for llvm.abs intrinsic

If absolute value needs turn a negative number into a positive number it reduces the number of sign bits by at most 1.

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

4 years ago[Flang] Checks for constraint C7110-C7115.
sameeran joshi [Thu, 30 Jul 2020 19:32:04 +0000 (01:02 +0530)]
[Flang] Checks for constraint C7110-C7115.

Added more tests.
 Annotate sources and tests.
 Improve error message.

Reviewed By: PeteSteinfeld

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

4 years ago[lldb/Test] Reduce code duplication by importing subprocess globally
Jonas Devlieghere [Fri, 31 Jul 2020 17:52:49 +0000 (10:52 -0700)]
[lldb/Test] Reduce code duplication by importing subprocess globally

Import the subprocess module once instead of doing it inline which is
error prone and leads to needless code duplication.

4 years ago[ThinLTO] Compile time improvement to propagateAttributes
Teresa Johnson [Thu, 30 Jul 2020 20:49:49 +0000 (13:49 -0700)]
[ThinLTO] Compile time improvement to propagateAttributes

I found that propagateAttributes was ~23% of a thin link's run time
(almost 4x higher than the second hottest function). The main reason is
that it re-examines a global var each time it is referenced. This
becomes unnecessary once it is marked both non read only and non write
only. I added a set to avoid doing redundant work, which dropped the
runtime of that thin link by almost 15%.

I made a smaller efficiency improvement (no measurable impact) to skip
all summaries for a VI if the first copy is dead. I added an assert to
ensure that all copies are dead if any is. The code in
computeDeadSymbols marks all summaries for a VI as live. There is one
corner case where it was skipping marking an alias as live, that I
fixed. However, since the code earlier marked all copies of a preserved
GUID's VI as live, and each 'visit' marks all copies live, the only case
where this could make a difference is summaries that were marked live
when they were built initially, and that is only a few special compiler
generated symbols and inline assembly symbols, so it likely is never
provoked in practice.

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

4 years ago[Support][CommandLine] Delete unused llvm::cl::ParseEnvrironmentOptions
Fangrui Song [Fri, 31 Jul 2020 17:46:27 +0000 (10:46 -0700)]
[Support][CommandLine] Delete unused llvm::cl::ParseEnvrironmentOptions

The function was added in 2003. It is not used and can be emulated with ParseCommandLineOptions.

4 years ago[PowerPC] Add Vector String Isolate instruction definitions and MC Tests
Albion Fung [Fri, 31 Jul 2020 16:57:59 +0000 (11:57 -0500)]
[PowerPC] Add Vector String Isolate instruction definitions and MC Tests

This patch implements the instruction definition and MC tests for the vector
string isolate instructions.

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

4 years ago[SCEVExpander] Name temporary instructions for LCSSA insertion (NFC).
Florian Hahn [Fri, 31 Jul 2020 17:16:01 +0000 (18:16 +0100)]
[SCEVExpander] Name temporary instructions for LCSSA insertion (NFC).

4 years ago[GISel] Add combiners for G_INTTOPTR and G_PTRTOINT
Aditya Nandakumar [Fri, 31 Jul 2020 16:41:06 +0000 (09:41 -0700)]
[GISel] Add combiners for G_INTTOPTR and G_PTRTOINT

https://reviews.llvm.org/D84909

Patch adds two new GICombinerRules, one for G_INTTOPTR and one for
G_PTRTOINT. The G_INTTOPTR elides ptr2int(int2ptr(x)) to a copy of x, if
the cast is within the same address space. The G_PTRTOINT elides
int2ptr(ptr2int(x)) to a copy of x. Patch additionally adds new combiner
tests for the AArch64 target to test these new combiner rules.

Patch by mkitzan

4 years agoDisable getauxval for Go
Keith Randall [Fri, 31 Jul 2020 17:04:04 +0000 (10:04 -0700)]
Disable getauxval for Go

We want the Go build to not use getauxval, as we must support glibc < 2.16 platforms.

Reviewed By: dvyukov

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

4 years ago[X86][SSE] Cleanup bitwise reduction check prefixes. NFC
Simon Pilgrim [Fri, 31 Jul 2020 11:51:46 +0000 (12:51 +0100)]
[X86][SSE] Cleanup bitwise reduction check prefixes. NFC

Add AVX512BW/AVX512BWVL prefixes for a future patch

4 years ago[PGO][test] Add test to check memops changes function hash
Hiroshi Yamauchi [Thu, 30 Jul 2020 18:22:25 +0000 (11:22 -0700)]
[PGO][test] Add test to check memops changes function hash

Following up D84782.

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

4 years ago[AutoFDO] Avoid merging inlinee samples multiple times
Hongtao Yu [Fri, 31 Jul 2020 01:22:50 +0000 (18:22 -0700)]
[AutoFDO] Avoid merging inlinee samples multiple times

A function call can be replicated by optimizations like loop unroll and jump threading and the replicates end up sharing the sample nested callee profile. Therefore when it comes to merging samples for uninlined callees in the sample profile inliner, a callee profile can be merged multiple times which will cause an assert to fire.

This change avoids merging same callee profile for duplicate callsites by filtering out callee profiles with a non-zero head sample count.

Reviewed By: wenlei, wmi

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

4 years ago[gn build] Port df69492cdfa
LLVM GN Syncbot [Fri, 31 Jul 2020 16:23:24 +0000 (16:23 +0000)]
[gn build] Port df69492cdfa

4 years ago[llvm-libtool-darwin] Refactor Slice and writeUniversalBinary
Sameer Arora [Thu, 23 Jul 2020 23:26:42 +0000 (16:26 -0700)]
[llvm-libtool-darwin] Refactor Slice and writeUniversalBinary

Refactoring `Slice` class and function `createUniversalBinary` from
`llvm-lipo` into  MachOUniversalWriter. This refactoring is necessary so
as to use the refactored code for creating universal binaries under
llvm-libtool-darwin.

Reviewed by alexshap, smeenai

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

4 years ago[PowerPC] Implement low-order Vector Modulus Builtins, and add Vector Multiply/Divide...
Amy Kwan [Tue, 28 Jul 2020 04:45:54 +0000 (23:45 -0500)]
[PowerPC] Implement low-order Vector Modulus Builtins, and add Vector Multiply/Divide/Modulus Builtins Tests

Power10 introduces new instructions for vector multiply, divide and modulus.
These instructions can be exploited by the builtin functions: vec_mul, vec_div,
and vec_mod, respectively.

This patch aims adds the function prototype, vec_mod, as vec_mul and vec_div
been previously implemented in altivec.h.

This patch also adds the following front end tests:
vec_mul for v2i64
vec_div for v4i32 and v2i64
vec_mod for v4i32 and v2i64

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