platform/upstream/llvm.git
3 years ago[RISCV] Define vfadd/vfsub/vfrsub intrinsics.
Hsiangkai Wang [Mon, 14 Dec 2020 16:51:07 +0000 (00:51 +0800)]
[RISCV] Define vfadd/vfsub/vfrsub intrinsics.

Define vfadd/vfsub/vfrsub intrinsics and lower to V instructions.

We work with @rogfer01 from BSC to come out this patch.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Hsiangkai Wang <kai.wang@sifive.com>
Differential Revision: https://reviews.llvm.org/D93291

3 years ago[RISCV] Define vmin/vminu/vmax/vmaxu intrinsics.
Hsiangkai Wang [Mon, 14 Dec 2020 15:39:35 +0000 (23:39 +0800)]
[RISCV] Define vmin/vminu/vmax/vmaxu intrinsics.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Hsiangkai Wang <kai.wang@sifive.com>
Differential Revision: https://reviews.llvm.org/D93218

3 years ago[RISCV] Define vnsrl/vnsra intrinsics.
Hsiangkai Wang [Mon, 14 Dec 2020 13:47:15 +0000 (21:47 +0800)]
[RISCV] Define vnsrl/vnsra intrinsics.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Hsiangkai Wang <kai.wang@sifive.com>
Differential Revision: https://reviews.llvm.org/D93207

3 years ago[RISCV] Define vsll/vsrl/vsra intrinsics.
Hsiangkai Wang [Mon, 14 Dec 2020 06:54:14 +0000 (14:54 +0800)]
[RISCV] Define vsll/vsrl/vsra intrinsics.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Hsiangkai Wang <kai.wang@sifive.com>
Differential Revision: https://reviews.llvm.org/D93193

3 years ago[RISCV] Define vadc/vmadc/vsbc/vmsbc intrinsics.
Hsiangkai Wang [Sat, 12 Dec 2020 09:18:32 +0000 (17:18 +0800)]
[RISCV] Define vadc/vmadc/vsbc/vmsbc intrinsics.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Hsiangkai Wang <kai.wang@sifive.com>
Differential Revision: https://reviews.llvm.org/D93175

3 years agoFrontend: Fix confusing comment at call to clearOutputFiles, NFC
Duncan P. N. Exon Smith [Tue, 15 Dec 2020 22:10:47 +0000 (14:10 -0800)]
Frontend: Fix confusing comment at call to clearOutputFiles, NFC

Fix the comment in front of `compileModuleImpl`'s call to
`CompilerInstance::clearOutputFiles`. The purpose of this call is to
delete any stray temporary files after the module generation thread
crashes.

The comment is from f545f67de3a1bfdbbfad88acde5b540ce3b82f4f, and
was associated with manually deleting a generated module map. Then
13afbf42d830dd43febbeb0855aa359ca9dbfbf9 added this `clearOutputFiles`
call between the comment and the code it referenced. Finally,
1f76c4e8101b9beaf8f1b10a57faa80256ab2b05 started sending the generated
module map directly to the SourceManager instead of putting it on disk,
deleting the call that the comment referenced.

No functionality change.

3 years ago[docs][unittest][Go][StackProtector] Migrate deprecated DebugInfo::get to DILocation...
Fangrui Song [Tue, 15 Dec 2020 22:17:04 +0000 (14:17 -0800)]
[docs][unittest][Go][StackProtector] Migrate deprecated DebugInfo::get to DILocation::get

3 years ago[Hexagon] Fix bitcasting v1i8 -> i8
Krzysztof Parzyszek [Tue, 15 Dec 2020 21:59:59 +0000 (15:59 -0600)]
[Hexagon] Fix bitcasting v1i8 -> i8

3 years agoGlobalISel: Fix generic handling of single outgoing call arguments
Matt Arsenault [Tue, 15 Dec 2020 15:39:27 +0000 (10:39 -0500)]
GlobalISel: Fix generic handling of single outgoing call arguments

Simply call the argument handler like is done for the incoming
case. This will allow removal of hacks in the AMDGPU call lowering in
a future change.

3 years agoAMDGPU: Remove redundant CCAction for i1
Matt Arsenault [Tue, 15 Dec 2020 19:14:10 +0000 (14:14 -0500)]
AMDGPU: Remove redundant CCAction for i1

3 years ago[clang] Migrate deprecated DebugInfo::get to DILocation::get
Fangrui Song [Tue, 15 Dec 2020 21:59:31 +0000 (13:59 -0800)]
[clang] Migrate deprecated DebugInfo::get to DILocation::get

3 years ago[RISCV] Only custom legalize i32 arguments to vector intrinsics on RV64.
Craig Topper [Tue, 15 Dec 2020 21:34:04 +0000 (13:34 -0800)]
[RISCV] Only custom legalize i32 arguments to vector intrinsics on RV64.

3 years ago[mlir][IR] Define the singleton builtin types in ODS instead of C++
River Riddle [Tue, 15 Dec 2020 21:39:09 +0000 (13:39 -0800)]
[mlir][IR] Define the singleton builtin types in ODS instead of C++

This exposes several issues with the current generation that this revision also fixes.
 * TypeDef now allows specifying the base class to use when generating.
 * TypeDef now inherits from DialectType, which allows for using it as a TypeConstraint
 * Parser/Printers are now no longer generated in the header(removing duplicate symbols), and are now only generated when necessary.
    - Now that generatedTypeParser/Printer are only generated in the definition file,
      existing users will need to manually expose this functionality when necessary.
 * ::get() is no longer generated for singleton types, because it isn't necessary.

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

3 years ago[NFCI][SimplifyCFG] Add basic scaffolding for gradually making the pass DomTree-aware
Roman Lebedev [Tue, 15 Dec 2020 18:36:23 +0000 (21:36 +0300)]
[NFCI][SimplifyCFG] Add basic scaffolding for gradually making the pass DomTree-aware

Two observations:
1. Unavailability of DomTree makes it impossible to make
  `FoldBranchToCommonDest()` transform in certain cases,
   where the successor is dominated by predecessor,
   because we then don't have PHI's, and can't recreate them,
   well, without handrolling 'is dominated by' check,
   which doesn't really look like a great solution to me.
2. Avoiding invalidating DomTree in SimplifyCFG will
   decrease the number of `Dominator Tree Construction` by 5
   (from 28 now, i.e. -18%) in `-O3` old-pm pipeline
   (as per `llvm/test/Other/opt-O3-pipeline.ll`)
   This might or might not be beneficial for compile time.

So the plan is to make SimplifyCFG preserve DomTree, and then
eventually make DomTree fully required and preserved by the pass.

Now, SimplifyCFG is ~7KLOC. I don't think it will be nice
to do all this uplifting in a single mega-commit,
nor would it be possible to review it in any meaningful way.

But, i believe, it should be possible to do this in smaller steps,
introducing the new behavior, in an optional way, off-by-default,
opt-in option, and gradually fixing transforms one-by-one
and adding the flag to appropriate test coverage.

Then, eventually, the default should be flipped,
and eventually^2 the flag removed.

And that is what is happening here - when the new off-by-default option
is specified, DomTree is required and is claimed to be preserved,
and SimplifyCFG-internal assertions verify that the DomTree is still OK.

3 years ago[NFC][Tests][SimplifyCFG] Trim whitespaces at the end of lines
Roman Lebedev [Tue, 15 Dec 2020 21:32:50 +0000 (00:32 +0300)]
[NFC][Tests][SimplifyCFG] Trim whitespaces at the end of lines

3 years ago[flang] Clean up TODO comments and fix one (DATA constant ambiguity)
peter klausler [Tue, 15 Dec 2020 19:09:41 +0000 (11:09 -0800)]
[flang] Clean up TODO comments and fix one (DATA constant ambiguity)

Remove resolved & moot TODO comments in Common/, Parser/,
and Evaluate/.  Address a pending one relating to parsing
ambiguity in DATA statement constants, handling it with
symbol table information in Semantics and adding a test.

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

3 years ago[clang-tidy] Support all YAML supported spellings for bools in CheckOptions.
Nathan James [Tue, 15 Dec 2020 21:15:15 +0000 (21:15 +0000)]
[clang-tidy] Support all YAML supported spellings for bools in CheckOptions.

Depends on D92755

Reviewed By: aaron.ballman

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

3 years ago[PowerPC] Enable paired vector type and intrinsics when MMA is disabled
Baptiste Saleil [Tue, 15 Dec 2020 21:08:09 +0000 (15:08 -0600)]
[PowerPC] Enable paired vector type and intrinsics when MMA is disabled

This patch enables the Clang type __vector_pair and its associated LLVM
intrinsics even when MMA is disabled. With this patch, the type is now controlled
by the PPC paired-vector-memops option. The builtins and intrinsics will be
renamed to drop the mma prefix in another patch.

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

3 years ago[clangd] Validate clang-tidy Checks in clangd config.
Nathan James [Tue, 15 Dec 2020 21:10:56 +0000 (21:10 +0000)]
[clangd] Validate clang-tidy Checks in clangd config.

Add instrumentation in ConfigCompile to validate that items in ClangTidy:[Add|Remove] correspond to actual clang-tidy checks.
If they don't a warning will be presented to the user.

This is especially useful for catching typos in the glob items.

Reviewed By: sammccall

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

3 years ago[flang] Minor fix to list-directed REAL output editing
peter klausler [Tue, 15 Dec 2020 18:49:01 +0000 (10:49 -0800)]
[flang] Minor fix to list-directed REAL output editing

Always emit the letter 'E' in list-directed REAL output;
the library was omitting it for exponents greater than 99,
as should be done for E and D formatting of large exponents
without an Ed exponent digit count.

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

3 years ago[lld-macho] Add implicit dylib support for frameworks
Jez Ng [Tue, 15 Dec 2020 05:49:03 +0000 (00:49 -0500)]
[lld-macho] Add implicit dylib support for frameworks

{D93000} applied to frameworks. Partial fix for PR48511.

Reviewed By: #lld-macho, thakis

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

3 years ago[lld-macho] Support -sub_umbrella
Jez Ng [Tue, 15 Dec 2020 03:55:28 +0000 (22:55 -0500)]
[lld-macho] Support -sub_umbrella

From what I can tell, it's essentially identical to
`-sub_library`, but it doesn't match files ending in ".dylib".

Reviewed By: #lld-macho, thakis

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

3 years ago[lld-macho] Don't emit rebase opcodes for relocs in TLV sections
Jez Ng [Mon, 14 Dec 2020 23:57:01 +0000 (18:57 -0500)]
[lld-macho] Don't emit rebase opcodes for relocs in TLV sections

Their addresses are already encoded as section-relative offsets, so
there's no need to rebase them at runtime. {D85080} has some context
on the weirdness of TLV sections.

Fixes llvm.org/PR48491.

Reviewed By: #lld-macho, thakis

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

3 years ago[lld-macho] -weak_{library,framework} should always take priority
Jez Ng [Mon, 14 Dec 2020 22:59:22 +0000 (17:59 -0500)]
[lld-macho] -weak_{library,framework} should always take priority

We were not setting forceWeakImport for file paths given by
`-weak_library` if we had already loaded the file. This diff fixes that
by having `loadDylib` return a cached DylibFile instance even if we have
already loaded that file.

We still avoid emitting multiple LC_LOAD_DYLIBs, but we achieve this by
making inputFiles a SetVector instead of relying on the `loadedDylibs`
cache.

Reviewed By: #lld-macho, smeenai

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

3 years ago[mlir] Handle unknown ops in dynamic_tensor_from_elements bufferization
Sean Silva [Tue, 15 Dec 2020 02:22:58 +0000 (18:22 -0800)]
[mlir] Handle unknown ops in dynamic_tensor_from_elements bufferization

Due to how the conversion infra works, the "clone" call that this
pattern was using required all the cloned ops to be immediately
legalized as part of this dialect conversion invocation.

That was previously working due to a couple factors:

- In the test case, there was scf.if, which we happen to mark as legal
  as part of marking the entire SCF dialect as legal for the scf.parallel
  we generate here.

- Originally, this test case had std.extract_element in the body, which
  we happened to have a pattern for in this pass. After I migrated that to
  `tensor.extract` (which removed the tensor.extract bufferization from
  here), I hacked this up to use `std.dim` which we still have patterns
  for in this pass.

This patch updates the test case to use a truly opaque op `test.source`
that properly stresses this aspect of the pattern.

(this also removes a stray dependency on the `tensor` dialect that I
must have left behind as part of my hacking this pass up when migrating
to `tensor.extract`)

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

3 years ago[OpenMP] Introduce new file wrapper class for runtime
Peyton, Jonathan L [Thu, 3 Dec 2020 19:25:47 +0000 (13:25 -0600)]
[OpenMP] Introduce new file wrapper class for runtime

Introduce new kmp_safe_raii_file_t class with RAII semantics for file
open/close. It is essentially a wrapper around the C-style FILE* object.
This also unifies the way we error report if a file can't be opened.

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

3 years ago[LV] Restructure handling of -prefer-predicate-over-epilogue option [NFC]
Philip Reames [Tue, 15 Dec 2020 20:33:51 +0000 (12:33 -0800)]
[LV] Restructure handling of -prefer-predicate-over-epilogue option [NFC]

This should be purely non-functional.  When touching this code for another reason, I found the handling of the PredicateOrDontVectorize piece here very confusing.  Let's make it an explicit state (instead of an implicit combination of two variables), and use early return for options/hint processing.

3 years ago[RISCV] Use default member initializers for the feature flags in RISCVTargetInfo...
Craig Topper [Tue, 15 Dec 2020 20:33:21 +0000 (12:33 -0800)]
[RISCV] Use default member initializers for the feature flags in RISCVTargetInfo. NFC

This avoids having to repeat all the flags in the constructor's
initializer list in the same order. This style is already used by
several other targets.

3 years ago[AMDGPU] Clarify scratch initialization
Tony [Tue, 15 Dec 2020 01:42:25 +0000 (01:42 +0000)]
[AMDGPU] Clarify scratch initialization

- Clarify documentation on initializing scratch.
- Rename compute_pgm_rsrc2 field for enabling scratch from
  ENABLE_SGPR_PRIVATE_SEGMENT_WAVEFRONT_OFFSET to
  ENABLE_PRIVATE_SEGMENT to match hardware definition.

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

3 years ago[mlir] Allow nested regions in inlineRegionAndEmitStore
Tres Popp [Tue, 15 Dec 2020 16:40:12 +0000 (17:40 +0100)]
[mlir] Allow nested regions in inlineRegionAndEmitStore

This is useful for scalar code that uses for/while loops.
This has also been confirmed to work for representing std.pow as an
scf.for loop on gpus.

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

3 years agoSet decl on DeclRefExpr directly during deserialization rather than
Richard Smith [Tue, 15 Dec 2020 06:47:32 +0000 (22:47 -0800)]
Set decl on DeclRefExpr directly during deserialization rather than
relying on a setter that might have additional side-effects. NFC.

3 years agoConsider reference, pointer, and pointer-to-member TemplateArguments to be different...
Richard Smith [Sun, 15 Nov 2020 01:37:25 +0000 (17:37 -0800)]
Consider reference, pointer, and pointer-to-member TemplateArguments to be different if they have different types.

For the Itanium ABI, this implements the mangling rule suggested in
https://github.com/itanium-cxx-abi/cxx-abi/issues/47, namely mangling
such template arguments as being cast to the parameter type in the case
where the template name is overloadable. This can cause a mangling
change for rare cases, where

 * the template argument declaration is converted from its declared type
   to the type of the template parameter, and
 * the template parameter either has a deduced type or is a parameter of
   a function template.

However, such changes are necessary to avoid mangling collisions. The
ABI changes can be reversed with -fclang-abi-compat=11 or earlier.

Re-commit with a fix for a couple of regressions.

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

3 years agoAdding a test case that I accidentally dropped from 27ea7d0a6e0dc51e0214707bcc265fa6f...
Aaron Ballman [Tue, 15 Dec 2020 19:56:03 +0000 (14:56 -0500)]
Adding a test case that I accidentally dropped from 27ea7d0a6e0dc51e0214707bcc265fa6f9dc9bc6

3 years agoReland dcdef5b5b3df457566e7faf61e1e5789c42528d1
Kirill Bobyrev [Tue, 15 Dec 2020 19:48:25 +0000 (20:48 +0100)]
Reland dcdef5b5b3df457566e7faf61e1e5789c42528d1

Reviewed By: sammccall

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

3 years ago[OPENMP51] Add present modifier in defaultmap clause
cchen [Tue, 15 Dec 2020 19:49:52 +0000 (13:49 -0600)]
[OPENMP51] Add present modifier in defaultmap clause

Support present modifier in defaultmap by adding an extra dimension
for `ImplicitMap`. Therefore, we now create OMPMapClause in `ActOnOpenMPExecutableDirective`
based on both `maptype` and `maptype-modifier`.

Reviewed By: ABataev

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

3 years ago[lld/mac] Set ordinal on dynamic undefined symbols in symbol table
Nico Weber [Tue, 15 Dec 2020 18:36:15 +0000 (13:36 -0500)]
[lld/mac] Set ordinal on dynamic undefined symbols in symbol table

This lets `nm -m` print "(from libfoo)" in its output, which is more
accessible than dumping the bind table.

See https://reviews.llvm.org/D57190#2455761 for the somewhat
surprising `AltEntry` that appears in symtab.s.

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

3 years ago[tests] fix an accidental target dependence added in 99ac8868
Philip Reames [Tue, 15 Dec 2020 19:07:30 +0000 (11:07 -0800)]
[tests] fix an accidental target dependence added in 99ac8868

3 years ago[tests][LV] precommit tests for D93317
Philip Reames [Tue, 15 Dec 2020 18:53:27 +0000 (10:53 -0800)]
[tests][LV] precommit tests for D93317

3 years ago[clangd] Provide suggestions with invalid config keys
Nathan James [Tue, 15 Dec 2020 18:16:16 +0000 (18:16 +0000)]
[clangd] Provide suggestions with invalid config keys

Update the config file warning when an unknown key is detected which is likely a typo by suggesting the likely key.
This won't suggest a key that has already been seen in the block.

Appends the fix to the diag, however right now there is no support for presenting that fix to the user.

Reviewed By: sammccall

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

3 years ago[NFC] update extract-lowbits.ll and scalar-pf-to-i64.ll
Mircea Trofin [Tue, 15 Dec 2020 18:04:01 +0000 (10:04 -0800)]
[NFC] update extract-lowbits.ll and scalar-pf-to-i64.ll

Auto-updated with update_llc_test_checks

3 years ago[libc++] Fix synopsis in string::ends_with test. NFC.
Marek Kurdej [Tue, 15 Dec 2020 18:03:11 +0000 (19:03 +0100)]
[libc++] Fix synopsis in string::ends_with test. NFC.

3 years agoRevert "[FPEnv] Teach the IRBuilder about invoke's correct use of the strictfp attrib...
Kevin P. Neal [Tue, 15 Dec 2020 17:55:58 +0000 (12:55 -0500)]
Revert "[FPEnv] Teach the IRBuilder about invoke's correct use of the strictfp attribute."

The test is busted on some hosts that aren't the one I'm using.

This reverts commit 67a1ffd88ac08526bb6cfc7b3f607e6668ba1c70.

3 years ago[mlir] Add std.pow lowering to LLVMIR
Tres Popp [Tue, 15 Dec 2020 17:15:52 +0000 (18:15 +0100)]
[mlir] Add std.pow lowering to LLVMIR

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

3 years ago[NFC] Update extract-bits.ll
Mircea Trofin [Tue, 15 Dec 2020 17:51:09 +0000 (09:51 -0800)]
[NFC] Update extract-bits.ll

Running update_llc_test_checks adds @PLT annotations to a number of
calls.

3 years ago[mlir] Add std.powf to ROCDL lowering.
Tres Popp [Tue, 15 Dec 2020 17:26:11 +0000 (18:26 +0100)]
[mlir] Add std.powf to ROCDL lowering.

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

3 years agoRevert "[clangd] Log remote index connectivity status"
Kirill Bobyrev [Tue, 15 Dec 2020 17:42:09 +0000 (18:42 +0100)]
Revert "[clangd] Log remote index connectivity status"

This reverts commit dcdef5b5b3df457566e7faf61e1e5789c42528d1.

This commit breaks clangd-ubuntu-tsan builds:
http://lab.llvm.org:8011/#builders/131/builds/1392

3 years ago[mlir] Fix GPUToNVVM test
Tres Popp [Tue, 15 Dec 2020 17:40:48 +0000 (18:40 +0100)]
[mlir] Fix GPUToNVVM test

3 years ago[FPEnv] Teach the IRBuilder about invoke's correct use of the strictfp attribute.
Kevin P. Neal [Tue, 15 Dec 2020 17:35:46 +0000 (12:35 -0500)]
[FPEnv] Teach the IRBuilder about invoke's correct use of the strictfp attribute.

Similar to D69312, and documented in D69839, the IRBuilder needs to add
the strictfp attribute to invoke instructions when constrained floating
point is enabled.

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

3 years ago[X86] Regenerate avxvnni.ll tests - remove unused prefix. NFCI.
Simon Pilgrim [Tue, 15 Dec 2020 17:35:19 +0000 (17:35 +0000)]
[X86] Regenerate avxvnni.ll tests - remove unused prefix. NFCI.

3 years ago[clangd] Log remote index connectivity status
Kirill Bobyrev [Tue, 15 Dec 2020 17:29:11 +0000 (18:29 +0100)]
[clangd] Log remote index connectivity status

Reviewed By: sammccall

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

3 years ago[mlir] Add NVVM lowering for std.pow
Tres Popp [Tue, 15 Dec 2020 16:18:06 +0000 (17:18 +0100)]
[mlir] Add NVVM lowering for std.pow

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

3 years ago[X86] Explicitly use SDValue instead of auto. NFCI.
Simon Pilgrim [Tue, 15 Dec 2020 17:27:10 +0000 (17:27 +0000)]
[X86] Explicitly use SDValue instead of auto. NFCI.

Fix static analyzer warning about not using a SDValue&

3 years agoSeparateConstOffsetFromGEP::lowerToSingleIndexGEPs - don't use dyn_cast_or_null....
Simon Pilgrim [Tue, 15 Dec 2020 17:15:06 +0000 (17:15 +0000)]
SeparateConstOffsetFromGEP::lowerToSingleIndexGEPs - don't use dyn_cast_or_null. NFCI.

ResultPtr is guaranteed to be non-null - and using dyn_cast_or_null causes unnecessary static analyzer warnings.

We can't say the same for FirstResult AFAICT, so keep dyn_cast_or_null for that.

3 years ago[llvm-symbolizer] Add missing include for config.h
Amy Huang [Tue, 15 Dec 2020 16:41:22 +0000 (08:41 -0800)]
[llvm-symbolizer] Add missing include for config.h

The cmake variable LLVM_ENABLE_DIA_SDK was being used here but
was undefined because config.h wasn't included.

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

3 years ago[ELF] Error for out-of-range R_X86_64_[REX_]GOTPCRELX
Fangrui Song [Tue, 15 Dec 2020 17:20:06 +0000 (09:20 -0800)]
[ELF] Error for out-of-range R_X86_64_[REX_]GOTPCRELX

Reviewed By: grimar

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

3 years ago[AArch64][NEON] Remove undocumented vceqz{,q}_p16, vml{a,s}q_n_f64 intrinsics
Joe Ellis [Tue, 15 Dec 2020 16:56:43 +0000 (16:56 +0000)]
[AArch64][NEON] Remove undocumented vceqz{,q}_p16, vml{a,s}q_n_f64 intrinsics

Prior to this patch, Clang supported the following C/C++ intrinsics:

    vceqz_p16
    vceqzq_p16
    vmlaq_n_f64
    vmlsq_n_f64

... exposed through arm_neon.h. However, these intrinsics are not part
of the ACLE, allowing developers to write code that is not compatible
with other toolchains.

This patch removes these intrinsics.

There is a bug report capturing this issue here:

    https://bugs.llvm.org/show_bug.cgi?id=47471

Reviewed By: bsmith

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

3 years ago[PGO] Allow overriding -vp-counters-per-site
Raul Tambre [Tue, 15 Dec 2020 06:41:22 +0000 (08:41 +0200)]
[PGO] Allow overriding -vp-counters-per-site

In some build configurations more than 1.5 might be required.
Paramaterize so it can be changed by the user.

Reviewed By: yamauchi

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

3 years ago[X86] Remove unnecessary SUBV_BROADCAST combines. NFCI.
Simon Pilgrim [Tue, 15 Dec 2020 13:36:22 +0000 (13:36 +0000)]
[X86] Remove unnecessary SUBV_BROADCAST combines. NFCI.

Noticed while dealing with D92645 - these are now handled by getFauxShuffleMask + shuffle combining code.

3 years ago[libc++] Fix allocate_shared when used with an explicitly convertible allocator
Louis Dionne [Tue, 15 Dec 2020 16:45:53 +0000 (11:45 -0500)]
[libc++] Fix allocate_shared when used with an explicitly convertible allocator

When the allocator is only explicitly convertible from other specializations
of itself, the new version of std::allocate_shared would not work because
it would try to do an implicit conversion. This patch fixes the problem
and adds a test so that we don't fall into the same trap in the future.

3 years ago[utils] The func_dict for a prefix may just be empty
Mircea Trofin [Tue, 15 Dec 2020 16:40:01 +0000 (08:40 -0800)]
[utils] The func_dict for a prefix may just be empty

Follow up from D92965 - since we try to find failed prefixes
after each RUN line, it's possible the whole list of functions for a
prefix be non-existent, which is fine - this happens when none of the
RUN lines seen so far used the prefix.

3 years ago[clang][driver][NFC] Use StringRef instead of std::string
Nathan James [Tue, 15 Dec 2020 16:19:12 +0000 (16:19 +0000)]
[clang][driver][NFC] Use StringRef instead of std::string

3 years ago[NFC] Fix a few SVEInstrInfo related stylistic issues.
Paul Walker [Tue, 15 Dec 2020 15:31:57 +0000 (15:31 +0000)]
[NFC] Fix a few SVEInstrInfo related stylistic issues.

3 years ago[mlir] Add std op for X raised to the power of Y
Tres Popp [Thu, 10 Dec 2020 22:49:42 +0000 (23:49 +0100)]
[mlir] Add std op for X raised to the power of Y

Proposal:
https://llvm.discourse.group/t/rfc-standard-add-powop-to-std-dialect/2377

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

3 years ago[ARM] Match dual lane vmovs from insert_vector_elt
David Green [Tue, 15 Dec 2020 15:58:52 +0000 (15:58 +0000)]
[ARM] Match dual lane vmovs from insert_vector_elt

MVE has a dual lane vector move instruction, capable of moving two
general purpose registers into lanes of a vector register. They look
like one of:
  vmov q0[2], q0[0], r2, r0
  vmov q0[3], q0[1], r3, r1
They only accept these lane indices though (and only insert into an
i32), either moving lanes 1 and 3, or 0 and 2.

This patch adds some tablegen patterns for them, selecting from vector
inserts elements. Because the insert_elements are know to be
canonicalized to ascending order there are several patterns that we need
to select. These lane indices are:

3 2 1 0    -> vmovqrr 31; vmovqrr 20
3 2 1      -> vmovqrr 31; vmov 2
3 1        -> vmovqrr 31
2 1 0      -> vmovqrr 20; vmov 1
2 0        -> vmovqrr 20

With the top one being the most common. All other potential patterns of
lane indices will be matched by a combination of these and the
individual vmov pattern already present. This does mean that we are
selecting several machine instructions at once due to the need to
re-arrange the inserts, but in this case there is nothing else that will
attempt to match an insert_vector_elt node.

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

3 years ago[clangd] Improve goToDefinition on auto and dectype
Quentin Chateau [Tue, 15 Dec 2020 15:31:25 +0000 (16:31 +0100)]
[clangd] Improve goToDefinition on auto and dectype

locateSymbolAt (used in goToDeclaration) follows the
deduced type instead of failing to locate the declaration.

Reviewed By: sammccall

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

3 years ago[SystemZ] Remove most hard-coded R1D instances for sibcalls
Ulrich Weigand [Tue, 15 Dec 2020 15:18:43 +0000 (16:18 +0100)]
[SystemZ] Remove most hard-coded R1D instances for sibcalls

Indirect sibling calls need to use %r1 to hold the target address.
This is currently hard-coded in many places.  This is not only
unnecessary, but makes future changes in this area difficult.

This patch now encodes the target address as operand without
hard coding a register in most places throughout the MI back-end.
Code generation still always uses %r1, but this is now decided
solely in one place in SystemZTargetLowering::LowerCall.

NFC intended.

3 years ago[utils] Fix UpdateTestChecks case where 2 runs differ for last label
Mircea Trofin [Fri, 11 Dec 2020 00:15:18 +0000 (16:15 -0800)]
[utils] Fix UpdateTestChecks case where 2 runs differ for last label

Two RUN lines produce outputs that, each, have some common parts and
some different parts. The common parts are checked under label A. The
differing parts are associated to a function and checked under labels B
and C, respectivelly.
When build_function_body_dictionary is called for the first RUN line, it
will attribute the function body to labels A and C. When the second RUN
is passed to build_function_body_dictionary, it sees that the function
body under A is different from what it has. If in this second RUN line,
A were at the end of the prefixes list, A's body is still kept
associated with the first run's function.

When we output the function body (i.e. add_checks), we stop after
emitting for the first prefix matching that function. So we end up with
the wrong function body (first RUN's A-association).

There is no reason to special-case the last label in the prefixes list,
and the fix is to always clear a label association if we find a RUN line
where the body is different.

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

3 years ago[lldb] Fix import-std-module tests after libc++ got a new __memory subdirectory
Raphael Isemann [Tue, 15 Dec 2020 15:13:17 +0000 (16:13 +0100)]
[lldb] Fix import-std-module tests after libc++ got a new __memory subdirectory

7ad49aec125b3c1205b164331d0aa954d773f890 added a __memory subdirectory to libc++
but the code we use to find libc++ from the debug info support files wasn't
prepared to encounter unknown subdirectories within libc++. The import-std-module
tests automatically fell back to not importing the std module which caused
them to fail.

This patch removes our hardcoded exception for the 'experimental' subdirectory
and instead just ignores all subdirectories of c++/vX/ when searching the
support files.

3 years ago[AnnotationRemarks] Also generate annotation remarks when using -O0.
Florian Hahn [Tue, 15 Dec 2020 14:44:38 +0000 (14:44 +0000)]
[AnnotationRemarks] Also generate annotation remarks when using -O0.

The AnnotationRemarks pass is already run at the end of the module
pipeline. This patch also adds it before bailing out for -O0, so remarks
are also generated with -O0.

3 years ago[VE] Support FRAMEADDR
Kazushi (Jam) Marukawa [Tue, 15 Dec 2020 13:43:09 +0000 (22:43 +0900)]
[VE] Support FRAMEADDR

Implement FRAMEADDR for VE.  Add a regression test also.

Reviewed By: simoll

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

3 years ago[VE][NFC] Sort VEISD operations
Kazushi (Jam) Marukawa [Tue, 15 Dec 2020 12:52:51 +0000 (21:52 +0900)]
[VE][NFC] Sort VEISD operations

Reviewed By: simoll

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

3 years ago[VPlan] Use VPDef for VPWidenSelectRecipe.
Florian Hahn [Tue, 15 Dec 2020 14:02:52 +0000 (14:02 +0000)]
[VPlan] Use VPDef for VPWidenSelectRecipe.

This patch turns updates VPWidenSelectRecipe to manage the value
it defines using VPDef.

Reviewed By: gilr

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

3 years ago[AMDGPU] Unify flat offset logic
Sebastian Neubauer [Tue, 15 Dec 2020 09:33:50 +0000 (10:33 +0100)]
[AMDGPU] Unify flat offset logic

Move getNumFlatOffsetBits from AMDGPUAsmParser and SIInstrInfo into
AMDGPUBaseInfo.

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

3 years ago[AMDGPU][NFC] Add more global_atomic_cmpswap tests
Sebastian Neubauer [Tue, 15 Dec 2020 13:46:15 +0000 (14:46 +0100)]
[AMDGPU][NFC] Add more global_atomic_cmpswap tests

3 years ago[OpenMP] Initialize runtime in the forked child process
Hansang Bae [Mon, 14 Dec 2020 16:54:03 +0000 (10:54 -0600)]
[OpenMP] Initialize runtime in the forked child process

This patch enables serial initialization in the forked child process
to fix unstable runtime behavior when used with Python-based AI tools.

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

3 years ago[clangd] Oops, fix code in #ifdef WIN32
Sam McCall [Tue, 15 Dec 2020 13:17:44 +0000 (14:17 +0100)]
[clangd] Oops, fix code in #ifdef WIN32

3 years ago[InstCombine] Remove scalable vector restriction in foldVectorBinop
Jun Ma [Tue, 15 Dec 2020 09:20:55 +0000 (17:20 +0800)]
[InstCombine] Remove scalable vector restriction in foldVectorBinop

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

3 years agoReland [clangd] Extract per-dir CDB cache to its own threadsafe class. NFC
Sam McCall [Tue, 15 Dec 2020 13:00:03 +0000 (14:00 +0100)]
Reland [clangd] Extract per-dir CDB cache to its own threadsafe class. NFC

This reverts commit 4d956af594c5adc9d566d1846d86dd89c70c9c0b.

Assertion failures on windows fixed by
965d71c69acce658e9e3de00b25a351b00937820

3 years ago[clangd] Avoid traversing C:\ -> C: when looking for CDBs
Sam McCall [Tue, 15 Dec 2020 12:58:08 +0000 (13:58 +0100)]
[clangd] Avoid traversing C:\ -> C: when looking for CDBs

Boost in its infinite wisdom considers C: a parent of C:\, and we've
inherited that. This breaks the assumption that after canonicalizing a
path, the path parents are the directory's parents.

3 years ago[LV] Pass explicit vector width to not require a X86 target.
Florian Hahn [Tue, 15 Dec 2020 12:51:28 +0000 (12:51 +0000)]
[LV] Pass explicit vector width to not require a X86 target.

3 years ago[clang-format] Recognize c++ coroutine keywords as unary operator to avoid misleading...
Chuanqi Xu [Tue, 15 Dec 2020 12:50:38 +0000 (20:50 +0800)]
[clang-format] Recognize c++ coroutine keywords as unary operator to avoid misleading pointer alignment

Summary: The clang-format may go wrong when handle c++ coroutine keywords and pointer.
The default value for PointerAlignment is PAS_Right. So the following format is good:
```
co_return *a;
```
But within some code style, the value for PointerAlignment is PAS_Left, the behavior goes wrong:
```
co_return* a;
```

test-plan: check-clang

reviewers: MyDeveloperDay

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

3 years ago[InstCombine][NFC] Change cast of FixedVectorType to dyn_cast.
Jun Ma [Mon, 14 Dec 2020 06:42:55 +0000 (14:42 +0800)]
[InstCombine][NFC] Change cast of FixedVectorType to dyn_cast.

3 years ago[InstCombine] Remove scalable vector restriction in InstCombineCompares
Jun Ma [Tue, 15 Dec 2020 03:37:10 +0000 (11:37 +0800)]
[InstCombine] Remove scalable vector restriction in InstCombineCompares

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

3 years ago[InstCombine] Remove scalable vector restriction when fold SelectInst
Jun Ma [Fri, 11 Dec 2020 03:29:47 +0000 (11:29 +0800)]
[InstCombine] Remove scalable vector restriction when fold SelectInst

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

3 years ago[RISCV] Define vwadd/vwaddu/vwsub/vwsubu intrinsics.
Hsiangkai Wang [Fri, 11 Dec 2020 08:08:10 +0000 (16:08 +0800)]
[RISCV] Define vwadd/vwaddu/vwsub/vwsubu intrinsics.

Define vwadd/vwaddu/vwsub/vwsubu intrinsics and lower to V instructions.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Hsiangkai Wang <kai.wang@sifive.com>
Differential Revision: https://reviews.llvm.org/D93108

3 years ago[SVE] Move INT_TO_FP i1 promotion into custom lowering.
Paul Walker [Sat, 24 Oct 2020 10:23:10 +0000 (11:23 +0100)]
[SVE] Move INT_TO_FP i1 promotion into custom lowering.

AddPromotedToType is being used to legalise INT_TO_FP operations
when the source is a predicate. The point where this introduces
vector extends might cause problems in the future so this patch
falls back to manual promotion within custom lowering.

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

3 years ago[CodeGenPrepare] Update optimizeGatherScatterInst for scalable vectors.
Paul Walker [Thu, 3 Dec 2020 12:26:29 +0000 (12:26 +0000)]
[CodeGenPrepare] Update optimizeGatherScatterInst for scalable vectors.

optimizeGatherScatterInst does nothing specific to fixed length vectors
but uses FixedVectorType to extract the number of elements.  This patch
simply updates the code to use VectorType and getElementCount instead.

For testing I just copied Transforms/CodeGenPrepare/X86/gather-scatter-opt.ll
replacing `<4 x ` with `<vscale x 4`.

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

3 years ago[X86] Remove trailing whitespace. NFC.
Simon Pilgrim [Mon, 14 Dec 2020 17:54:49 +0000 (17:54 +0000)]
[X86] Remove trailing whitespace. NFC.

3 years ago[X86][AVX] LowerBUILD_VECTOR - reduce 256/512-bit build vectors with zero/undef upper...
Simon Pilgrim [Mon, 14 Dec 2020 17:49:33 +0000 (17:49 +0000)]
[X86][AVX] LowerBUILD_VECTOR - reduce 256/512-bit build vectors with zero/undef upper elements + pad.

As discussed on D92645, we don't do a good job of recognising when we don't require the full width of a ymm/zmm build vector because the upper elements are undef/zero.

This commit allows us to make use of implicit zeroing of upper elements with AVX instructions, which we emulate in DAG with a INSERT_SUBVECTOR into the bottom of a undef/zero vector of the original type.

This exposed a limitation in getTargetConstantBitsFromNode which didn't extract bits from INSERT_SUBVECTORs of different element widths which I've included as well to prevent a couple of regressions.

3 years ago[LV] Add reduction test, which exposed a crash in a pending patch.
Florian Hahn [Tue, 15 Dec 2020 09:39:47 +0000 (09:39 +0000)]
[LV] Add reduction test, which exposed a crash in a pending patch.

3 years ago[VPlan] Use VPDef for VPWidenGEPRecipe.
Florian Hahn [Tue, 15 Dec 2020 09:30:14 +0000 (09:30 +0000)]
[VPlan] Use VPDef for VPWidenGEPRecipe.

This patch turns updates VPWidenGEPRecipe to manage the value it defines
using VPDef. The VPValue is used  during VPlan construction and
codegeneration instead of the plain IR reference where possible.

Reviewed By: gilr

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

3 years ago[VPlan] Use VPdef for VPWidenCall.
Florian Hahn [Tue, 15 Dec 2020 09:11:24 +0000 (09:11 +0000)]
[VPlan] Use VPdef for VPWidenCall.

This patch turns updates VPWidenREcipe to manage the value it defines
using VPDef.

Reviewed By: gilr

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

3 years ago[clang][cli] Squash multiple cc1 -fxxx-exceptions flags into single -exception-model...
Jan Svoboda [Tue, 15 Dec 2020 08:59:19 +0000 (09:59 +0100)]
[clang][cli] Squash multiple cc1 -fxxx-exceptions flags into single -exception-model=xxx option

This patch enables marshalling of the exception model options while enforcing their mutual exclusivity. The clang driver interface remains the same, this only affects the cc1 command line.

Depends on D93215.

Reviewed By: dexonsmith

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

3 years ago[clang][cli] Squash exception model in LangOptions into one member
Jan Svoboda [Tue, 15 Dec 2020 08:41:11 +0000 (09:41 +0100)]
[clang][cli] Squash exception model in LangOptions into one member

This squashes multiple members in LangOptions into one. This is leveraged in a follow-up patch that implements marshalling of related command-line options.

Depends on D93214.

Reviewed By: dexonsmith

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

3 years ago[clang][cli] Create accessors for exception models in LangOptions
Jan Svoboda [Mon, 14 Dec 2020 12:08:48 +0000 (13:08 +0100)]
[clang][cli] Create accessors for exception models in LangOptions

This abstracts away the members that are being replaced in a follow-up patch.

Depends on D83979.

Reviewed By: dexonsmith

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

3 years ago[clangd] Add hover info for `this` expr
xndcn [Tue, 15 Dec 2020 08:45:56 +0000 (09:45 +0100)]
[clangd] Add hover info for `this` expr

How about add hover information for `this` expr?
It seems useful to show related information about the class for `this` expr sometimes.

Reviewed By: sammccall

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

3 years ago[VE] Support atomic exchange instructions
Kazushi (Jam) Marukawa [Sat, 12 Dec 2020 03:27:32 +0000 (12:27 +0900)]
[VE] Support atomic exchange instructions

Support atomic exchange and atomic compare and exchange instructions.
Change CAS and TS1AM instructions for ISel patterns.  Add selectADDRzi
pattern for them.  Add TS1AM pseudo instruction also for better ISel.
Add shouldExpandAtomicRMWInIR() function to expand all atomicrmw
instructions except atomicrmw xchg.  Add custom lower for i8/i16
atomicrmw xchg.  Modify replaceFI to support CAS/TS1AM instructions
which use "reg+disp" operands instead of "reg+imm+disp" operands.
And, add several regression tests to check the correctness.

Reviewed By: simoll

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

3 years ago[RISCV][NFC] Define scalable vectors for half types.
Hsiangkai Wang [Tue, 15 Dec 2020 05:49:54 +0000 (13:49 +0800)]
[RISCV][NFC] Define scalable vectors for half types.

This is a preperation work for vfadd intrinsics.

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

3 years ago[llvm-readelf] - Don't print OS/Processor specific prefix for known ELF file types.
Georgii Rymar [Mon, 14 Dec 2020 15:04:45 +0000 (18:04 +0300)]
[llvm-readelf] - Don't print OS/Processor specific prefix for known ELF file types.

This is a change suggested in post commit comments for
D93096 (https://reviews.llvm.org/D93096#2451796).

Imagine we want to add a custom OS specific ELF file type.
For that we can update the `ElfObjectFileType` array:

```
static const EnumEntry<unsigned> ElfObjectFileType[] = {
...
  {"Core",         "CORE (Core file)",         ELF::ET_CORE},
  {"MyType",       "MyType (my description)",     0xfe01},
};
```

The current code then might print:
```
OS Specific: (MyType (my description))
```

Though instead we probably would like to see a nicer output, e.g:
```
Type: MyType (my description)
```

To achieve that we can reorder the code slightly.

It is impossible to add a test I think, because we have no custom values in
the `ElfObjectFileType` array in LLVM.

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

3 years ago[SCEV] Add missing type check into getRangeForAffineNoSelfWrappingAR
Max Kazantsev [Tue, 15 Dec 2020 07:40:17 +0000 (14:40 +0700)]
[SCEV] Add missing type check into getRangeForAffineNoSelfWrappingAR

We make type widening without checking if it's needed. Bail if the max
iteration count is wider than AR's type.