platform/upstream/llvm.git
2 years ago[clang][deps] Don't prune search paths used by dependencies
Jan Svoboda [Wed, 16 Mar 2022 10:45:46 +0000 (11:45 +0100)]
[clang][deps] Don't prune search paths used by dependencies

When pruning header search paths (to reduce the number of modules we need to build explicitly), we can't prune the search paths used in (transitive) dependencies of a module. Otherwise, we could end up with either of the following dependency graphs:

```
X:<hash1> -> Y:<hash2>
X:<hash1> -> Y:<hash3>
```

depending on the search paths of the translation unit we discovered `X` and `Y` from.

This patch fixes that.

Depends on D121295.

Reviewed By: dexonsmith

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

2 years ago[clang][deps] NFC: Use range-based for loop instead of iterators
Jan Svoboda [Wed, 16 Mar 2022 10:44:55 +0000 (11:44 +0100)]
[clang][deps] NFC: Use range-based for loop instead of iterators

The iterator is not needed after the loop body anymore, meaning we can use more terse range-based for loop.

Depends on D121295.

Reviewed By: dexonsmith

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

2 years ago[clang][deps] Modules don't contribute to search path usage
Jan Svoboda [Wed, 16 Mar 2022 10:44:07 +0000 (11:44 +0100)]
[clang][deps] Modules don't contribute to search path usage

To reduce the number of modules we build in explicit builds (which use strict context hash), we prune unused header search paths. This essentially merges parts of the dependency graph.

Determining whether a search path was used to discover a module (through implicit module maps) proved to be somewhat complicated. Initial support landed in D102923, while D113676 attempts to fix some bugs.

However, now that we don't use implicit module maps in explicit builds (since D120465), we don't need to consider such search paths as used anymore. Modules are no longer discovered through the header search mechanism, so we can drop such search paths (provided they are not needed for other reasons).

This patch removes whatever support for detecting such usage we had, since it's buggy and not required anymore.

Depends on D120465.

Reviewed By: dexonsmith

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

2 years ago[X86] computeKnownBitsForTargetNode - add X86ISD::AND KnownBits handling
Simon Pilgrim [Wed, 16 Mar 2022 11:05:26 +0000 (11:05 +0000)]
[X86] computeKnownBitsForTargetNode - add X86ISD::AND KnownBits handling

Fixes #54171

2 years ago[X86] Add PR54171 test case
Simon Pilgrim [Wed, 16 Mar 2022 11:00:50 +0000 (11:00 +0000)]
[X86] Add PR54171 test case

2 years ago[mlir][SCF] Implement RegionBranchOpInterface on ExecuteRegionOp
Matthias Springer [Wed, 16 Mar 2022 09:18:09 +0000 (18:18 +0900)]
[mlir][SCF] Implement RegionBranchOpInterface on ExecuteRegionOp

This is needed for the BufferDeallocation pass.

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

2 years ago[mlir][bufferize][NFC] Rename allow-return-memref to allow-return-allocs
Matthias Springer [Wed, 16 Mar 2022 10:45:06 +0000 (19:45 +0900)]
[mlir][bufferize][NFC] Rename allow-return-memref to allow-return-allocs

Also clean up/split test cases.

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

2 years ago[flang][driver] Add support for `-mllvm`
Andrzej Warzynski [Wed, 2 Mar 2022 15:40:16 +0000 (15:40 +0000)]
[flang][driver] Add support for `-mllvm`

This option is added in both `flang-new` (the compiler driver) and
`flang-new -fc1` (the frontend driver). The semantics are consistent
with `clang` and `clang -cc1`.

As Flang does not run any LLVM passes when invoked with `-emit-llvm`
(i.e. `flang-new -S -emit-llvm <file>`), the tests use
`-S`/`-c`/`-emit-obj` instead. These options require an LLVM backend to
be run by the driver to generate the output (this makese `-mllvm`
relevant here).

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

2 years ago[flang] Lower adjustl and adjustr intrinsics
Valentin Clement [Wed, 16 Mar 2022 10:34:33 +0000 (11:34 +0100)]
[flang] Lower adjustl and adjustr intrinsics

This patch adds lowering for the `adjustl` and `adjustr`
intrinsics.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier

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

Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years ago[flang] Lower transfer instrinsic
Valentin Clement [Wed, 16 Mar 2022 10:28:12 +0000 (11:28 +0100)]
[flang] Lower transfer instrinsic

This patch adds lowering for the `transfer` intrinsic.
The calls are lowered to runtime function calls.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: mleair <leairmark@gmail.com>
2 years ago[flang][lowering] Add support for lowering of the `ibset` intrinsic
Andrzej Warzynski [Tue, 15 Mar 2022 17:07:07 +0000 (17:07 +0000)]
[flang][lowering] Add support for lowering of the `ibset` intrinsic

This patch adds support for lowering of the `ibset` intrinsic from Fortran
to the FIR dialect of MLIR.

This is part of the upstreaming effort from the `fir-dev` branch in [1].

[1] https://github.com/flang-compiler/f18-llvm-project

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Differential Revision: https://reviews.llvm.org/D121717

2 years ago[VE] v512|256 f32|64 fneg isel and tests
Simon Moll [Wed, 16 Mar 2022 10:31:19 +0000 (11:31 +0100)]
[VE] v512|256 f32|64 fneg isel and tests

fneg instruction isel and tests. We do this also in preparation of fused
negatate-multiple-add fp operations.

Reviewed By: kaz7

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

2 years ago[FunctionAttrs] Infer argmemonly .
Florian Hahn [Wed, 16 Mar 2022 10:24:33 +0000 (10:24 +0000)]
[FunctionAttrs] Infer argmemonly .

This patch adds initial argmemonly inference, by checking the underlying
objects of locations returned by MemoryLocation.

I think this should cover most cases, except function calls to other
argmemonly functions.

I'm not sure if there's a reason why we don't infer those yet.

Additional argmemonly can improve codegen in some cases. It also makes
it easier to come up with a C reproducer for 7662d1687b09 (already fixed,
but I'm trying to see if C/C++ fuzzing could help to uncover similar
issues.)

Compile-time impact:
NewPM-O3: +0.01%
NewPM-ReleaseThinLTO: +0.03%
NewPM-ReleaseLTO+g: +0.05%

https://llvm-compile-time-tracker.com/compare.php?from=067c035012fc061ad6378458774ac2df117283c6&to=fe209d4aab5b593bd62d18c0876732ddcca1614d&stat=instructions

Reviewed By: nikic

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

2 years ago[Clang] Allow "ext_vector_type" applied to Booleans
Simon Moll [Wed, 16 Mar 2022 10:10:11 +0000 (11:10 +0100)]
[Clang] Allow "ext_vector_type" applied to Booleans

This is the `ext_vector_type` alternative to D81083.

This patch extends Clang to allow 'bool' as a valid vector element type
(attribute ext_vector_type) in C/C++.

This is intended as the canonical type for SIMD masks and facilitates
clean vector intrinsic declarations.  Vectors of i1 are supported on IR
level and below down to many SIMD ISAs, such as AVX512, ARM SVE (fixed
vector length) and the VE target (NEC SX-Aurora TSUBASA).

The RFC on cfe-dev: https://lists.llvm.org/pipermail/cfe-dev/2020-May/065434.html

Reviewed By: erichkeane

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

2 years ago[mlir][bufferize] Do not deallocate allocs that are returned from a block
Matthias Springer [Wed, 16 Mar 2022 08:01:17 +0000 (17:01 +0900)]
[mlir][bufferize] Do not deallocate allocs that are returned from a block

Such IR is rejected by default, but can be allowed with `allow-return-memref`. In preparation of future refactorings, do not deallocate such buffers.

One-Shot Analysis now gathers information about yielded tensors, so that we know during the actual bufferization whether a newly allocated buffer should be deallocated again. (Otherwise, it will leak. This will be addressed in a subsequent commit that also makes `allow-return-memref` a non-experimental flag.)

As a cleanup, `allow-return-memref` is now part of OneShotBufferizationOptions. (It was previously ignored by AlwaysCopyBufferizationState.) Moreover, AlwaysCopyBufferizationState now asserts that `create-deallocs` is deactivated to prevent surprising behavior.

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

2 years ago[mlir][tensor] Implement ReifyRankedShapedTypeOpInterface on GenerateOp
Matthias Springer [Wed, 16 Mar 2022 08:00:48 +0000 (17:00 +0900)]
[mlir][tensor] Implement ReifyRankedShapedTypeOpInterface on GenerateOp

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

2 years ago[Tests] Update pipeline tests
Nikita Popov [Wed, 16 Mar 2022 09:55:43 +0000 (10:55 +0100)]
[Tests] Update pipeline tests

After 20531b3a6b091b8dd2e3992aec11ac10581e91e2, we now use a cached
TTI instance, so the TargetIRAnalysis analysis run goes away.

2 years ago[ConstraintElimination] Add additional tests with uncond branches.
Florian Hahn [Wed, 16 Mar 2022 09:46:03 +0000 (09:46 +0000)]
[ConstraintElimination] Add additional tests with uncond branches.

2 years ago[AArch64] Regenerate and extend peephole-and-tst.ll tests. NFC
David Green [Wed, 16 Mar 2022 09:44:20 +0000 (09:44 +0000)]
[AArch64] Regenerate and extend peephole-and-tst.ll tests. NFC

2 years ago[RelLookupTableConverter] Avoid querying TTI for declarations
Nikita Popov [Wed, 16 Mar 2022 09:36:00 +0000 (10:36 +0100)]
[RelLookupTableConverter] Avoid querying TTI for declarations

This code queries TTI on a single function, which is considered to
be representative. This is a bit odd, but probably fine in practice.

However, I think we should at least avoid querying declarations,
which e.g. will generally lack target attributes, and for which
we don't seem to ever query TTI in other places.

2 years ago[SelectionDAG] Emit calls to __divei4 and friends for division/remainder of large...
Matthias Gehre [Tue, 22 Feb 2022 15:32:17 +0000 (15:32 +0000)]
[SelectionDAG] Emit calls to __divei4 and friends for division/remainder of large integers

Emit calls to __divei4 and friends for divison/remainder of large integers.

This fixes https://github.com/llvm/llvm-project/issues/44994.

The overall RFC is in https://discourse.llvm.org/t/rfc-add-support-for-division-of-large-bitint-builtins-selectiondag-globalisel-clang/60329

The compiler-rt part is in https://reviews.llvm.org/D120327

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

2 years ago[AAEval] Remove unused function (NFC)
Nikita Popov [Wed, 16 Mar 2022 09:25:28 +0000 (10:25 +0100)]
[AAEval] Remove unused function (NFC)

2 years agoMissing include in Support/Host.cpp under __MVS__
serge-sans-paille [Wed, 16 Mar 2022 09:14:04 +0000 (10:14 +0100)]
Missing include in Support/Host.cpp under __MVS__

2 years ago[AAEval] Make compatible with opaque pointers
Nikita Popov [Tue, 15 Mar 2022 09:18:19 +0000 (10:18 +0100)]
[AAEval] Make compatible with opaque pointers

With opaque pointers, we cannot use the pointer element type to
determine the LocationSize for the AA query. Instead, -aa-eval
tests are now required to have an explicit load or store for any
pointer they want to compute alias results for, and the load/store
types are used to determine the location size.

This may affect ordering of results, and sorting within one result,
as the type is not considered part of the sorted string anymore.

To somewhat minimize the churn, printing still uses faux typed
pointer notation.

2 years agoUse lit_config.substitute instead of foo % lit_config.params everywhere
Sam McCall [Tue, 15 Mar 2022 22:15:56 +0000 (23:15 +0100)]
Use lit_config.substitute instead of foo % lit_config.params everywhere

This mechanically applies the same changes from D121427 everywhere.

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

2 years ago[flang] Lower system_clock intrinsic
Valentin Clement [Wed, 16 Mar 2022 08:50:51 +0000 (09:50 +0100)]
[flang] Lower system_clock intrinsic

This patch adds lowering ofr the `system_clock` intrinsic.
The call is lowered to runtime function call.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier

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

Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years ago[clang-format] Fix crashes due to missing l_paren
Owen Pan [Tue, 15 Mar 2022 09:41:02 +0000 (02:41 -0700)]
[clang-format] Fix crashes due to missing l_paren

Fixes #54384.

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

2 years ago[llvm][ADT] Remove duplicate code in llvm::StringMapImpl::RehashTable
wangyihan [Wed, 16 Mar 2022 08:01:35 +0000 (01:01 -0700)]
[llvm][ADT] Remove duplicate code in llvm::StringMapImpl::RehashTable

Remove duplicate code in llvm::StringMapImpl::RehashTable, near StringMap.cpp:229

```
if (!NewTableArray[NewBucket]) {
  NewTableArray[FullHash & (NewSize - 1)] = Bucket;
  NewHashArray[FullHash & (NewSize - 1)] = FullHash;
  if (I == BucketNo)
    NewBucketNo = NewBucket;
  continue;
}
```

Reviewed By: MaskRay, dexonsmith

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

2 years ago[clang] CWG 2354: prohibit alignas for enums
Vlad Serebrennikov [Wed, 16 Mar 2022 07:46:44 +0000 (15:46 +0800)]
[clang] CWG 2354: prohibit alignas for enums

Reviewed By: aaron.ballman, erichkeane

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

2 years agoCleanup codegen includes
serge-sans-paille [Tue, 15 Mar 2022 09:54:19 +0000 (10:54 +0100)]
Cleanup codegen includes

This is a (fixed) recommit of https://reviews.llvm.org/D121169

after:  1061034926
before: 1063332844

Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanup
Differential Revision: https://reviews.llvm.org/D121681

2 years ago[ELF] Move invalid binding diagnostic from initializeSymbols to postParse
Fangrui Song [Wed, 16 Mar 2022 07:31:29 +0000 (00:31 -0700)]
[ELF] Move invalid binding diagnostic from initializeSymbols to postParse

It is excessive to have a diagnostic for STB_LOCAL. Just reuse the invalid
binding diagnostic for STB_LOCAL.

2 years ago[LoongArch] Add some missing comments. NFC
Weining Lu [Wed, 16 Mar 2022 06:53:20 +0000 (14:53 +0800)]
[LoongArch] Add some missing comments. NFC

Add more comments /*Lower=*/ and /*Upper=*/ calling generateImmOutOfRangeError.

2 years ago[ELF] Use endianness-aware read32 to avoid dispatch. NFC
Fangrui Song [Wed, 16 Mar 2022 06:51:11 +0000 (23:51 -0700)]
[ELF] Use endianness-aware read32 to avoid dispatch. NFC

2 years ago[ELF] Inline ARMExidxSyntheticSection::classof. NFC
Fangrui Song [Wed, 16 Mar 2022 06:41:30 +0000 (23:41 -0700)]
[ELF] Inline ARMExidxSyntheticSection::classof. NFC

To optimize the only call site `dyn_cast<ARMExidxSyntheticSection>(first)` and
decrease code size.

2 years ago[ELF] Optimize "Strip sections"
Fangrui Song [Wed, 16 Mar 2022 06:15:43 +0000 (23:15 -0700)]
[ELF] Optimize "Strip sections"

If SHT_LLVM_SYMPART is unused, don't iterate over inputSections.
If neither --strip-debug/--strip-all, don't iterate over inputSections.

2 years ago[flang] Lower date_and_time and cpu_time intrinsics
Valentin Clement [Wed, 16 Mar 2022 05:37:29 +0000 (06:37 +0100)]
[flang] Lower date_and_time and cpu_time intrinsics

This patch lowers the `cpu_time` and the `date_and_time` instrinsics to
FIR and runtime calls.

This patch is part of the upstreaming effort from fir-dev branch.

Depends on D121704

Reviewed By: PeteSteinfeld

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

Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[flang][NFC] Remove duplicated header file
Valentin Clement [Wed, 16 Mar 2022 05:36:24 +0000 (06:36 +0100)]
[flang][NFC] Remove duplicated header file

Remove IntervalSet.h since it is a duplicate from
flang/include/flang/Lower/IntervalSet.h.

Reviewed By: PeteSteinfeld

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

2 years ago[NFC][X86] Rename some variables and functions about target features
Shengchen Kan [Wed, 16 Mar 2022 05:01:26 +0000 (13:01 +0800)]
[NFC][X86] Rename some variables and functions about target features

This is preparation for D121768. The member's name should align w/
the interface for trival target feature.

2 years ago[mlir][Linalg] Add multi-result op cast test.
MaheshRavishankar [Wed, 16 Mar 2022 04:51:17 +0000 (04:51 +0000)]
[mlir][Linalg] Add multi-result op cast test.

https://reviews.llvm.org/D121369 fixed an issue with canonicalizing a
linalg op producer with a cast op consumer. Adding a test to verify
that change.

Reviewed By: hanchung

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

2 years ago[mlir:OpenMP] Fix memory leak in asan translation
River Riddle [Wed, 16 Mar 2022 04:54:55 +0000 (21:54 -0700)]
[mlir:OpenMP] Fix memory leak in asan translation

A fake unreachable was created and removed, but never
erased.

2 years ago[libc] Unlock after pop_back
Alex Brachet [Wed, 16 Mar 2022 04:00:26 +0000 (04:00 +0000)]
[libc] Unlock after pop_back

2 years ago[libc][NFC] Use more common variable naming convention
Alex Brachet [Wed, 16 Mar 2022 03:34:54 +0000 (03:34 +0000)]
[libc][NFC] Use more common variable naming convention

We were in between two styles when this file was initially
checked in.

2 years ago[msan] Add interceptors for Linux 64-bit stat variants
Manoj Gupta [Mon, 14 Mar 2022 21:19:37 +0000 (14:19 -0700)]
[msan] Add interceptors for Linux 64-bit stat variants

glibc >= 2.33 uses shared functions for stat family functions.
D111984 added support for non-64 bit variants but they
do not appear to be enough as we have been noticing msan
errors on 64-bit stat variants on Chrome OS.

Reviewed By: vitalybuka

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

2 years agoUpdated mlir-tablegen dependencies for f96a8675cd29776ca39bb76133ee9167f5001f17
Sterling Augustine [Wed, 16 Mar 2022 02:41:33 +0000 (19:41 -0700)]
Updated mlir-tablegen dependencies for f96a8675cd29776ca39bb76133ee9167f5001f17

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

2 years ago[ELF] Move section assignment from initializeSymbols to postParse
Fangrui Song [Wed, 16 Mar 2022 02:24:41 +0000 (19:24 -0700)]
[ELF] Move section assignment from initializeSymbols to postParse

https://discourse.llvm.org/t/parallel-input-file-parsing/60164

initializeSymbols currently sets Defined::section and handles non-prevailing
COMDAT groups. Move the code to the parallel postParse to reduce work from the
single-threading code path and make parallel section initialization infeasible.

Postpone reporting duplicate symbol errors so that the messages have the
section information. (`Defined::section` is assigned in postParse and another
thread may not have the information).

* duplicated-synthetic-sym.s: BinaryFile duplicate definition (very rare) now
  has no section information
* comdat-binding: `%t/w.o %t/g.o` leads to an undesired undefined symbol. This
  is not ideal but we report a diagnostic to inform that this is unsupported.
  (See release note)
* comdat-discarded-lazy.s: %tdef.o is unextracted. The new behavior (discarded
  section error) makes more sense
* i386-comdat.s: switched to a better approach working around
  .gnu.linkonce.t.__x86.get_pc_thunk.bx in glibc<2.32 for x86-32.
  Drop the ancient no-longer-relevant workaround for __i686.get_pc_thunk.bx

Depends on D120640

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

2 years ago[RISCV] Select SRLI+SLLI for AND with leading ones mask
Haocong.Lu [Wed, 16 Mar 2022 02:07:21 +0000 (02:07 +0000)]
[RISCV] Select SRLI+SLLI for AND with leading ones mask

Select SRLI+SLLI for and i64 %x, imm if the imm is a leading ones mask.
It's useful in RV64 when the mask exceeds simm32 (cannot be generated by LUI).

Reviewed By: craig.topper

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

2 years ago[lit] Remove clang_libs_dir
Sam McCall [Wed, 16 Mar 2022 02:01:40 +0000 (03:01 +0100)]
[lit] Remove clang_libs_dir

Seems to have been added accidentally in 58db03a116a197719 and then
copied into clangd by me (but not actually needed).

2 years agoRevert D120626 "[ELF] Move section assignment from initializeSymbols to postParse"
Fangrui Song [Wed, 16 Mar 2022 02:00:54 +0000 (19:00 -0700)]
Revert D120626 "[ELF] Move section assignment from initializeSymbols to postParse"

This reverts commit c30e6447c0225f675773d07f2b6d4e3c2b962155.
It exposed brittle support for __x86.get_pc_thunk.bx.
Need to think a bit how to support __x86.get_pc_thunk.bx.

2 years ago[ELF][test] Improve i386-linkonce.s
Fangrui Song [Wed, 16 Mar 2022 01:47:52 +0000 (18:47 -0700)]
[ELF][test] Improve i386-linkonce.s

Make it behave like the glibc<2.32 .gnu.linkonce usage that we want to work around.

2 years ago[LLDB][NFC] Remove dead code from Section.cpp
Shafik Yaghmour [Wed, 16 Mar 2022 01:10:30 +0000 (18:10 -0700)]
[LLDB][NFC] Remove dead code from Section.cpp

Removing comment out code, looks like debugging code left over from a while ago.

2 years ago[lsan] Attempt to fix s390x after a63932a8
Vitaly Buka [Wed, 16 Mar 2022 01:01:07 +0000 (18:01 -0700)]
[lsan] Attempt to fix s390x after a63932a8

2 years ago[lld][WebAssembly] Take advantage of extended const expressions when available
Sam Clegg [Mon, 7 Mar 2022 23:50:30 +0000 (15:50 -0800)]
[lld][WebAssembly] Take advantage of extended const expressions when available

In particular we use these in two places:

1. When building PIC code we no longer need to combine output segments
   into a single segment that can be initialized at `__memory_base`.
   Instead each segment can encode its offset from `__memory_base` in
   its initializer.  e.g.

```
(i32.add (global.get __memory_base) (i32.const offset)
```

2. When building PIC code we no longer need to relocation internalized
   global addresses.  We can just initialize them with their correct
   offsets.

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

2 years ago[LLDB][NativePDB] Remove REQUIRES: system-windows for local-variables-regsiters.s
Zequan Wu [Wed, 16 Mar 2022 00:49:24 +0000 (17:49 -0700)]
[LLDB][NativePDB] Remove REQUIRES: system-windows for local-variables-regsiters.s

2 years ago[gn build] (manually) port 89cd86bbc58a (clang-pseudo move)
Nico Weber [Wed, 16 Mar 2022 00:44:59 +0000 (20:44 -0400)]
[gn build] (manually) port 89cd86bbc58a (clang-pseudo move)

2 years ago[mlir][sparse] add one extra index test on f32 matrix
Aart Bik [Tue, 15 Mar 2022 21:30:08 +0000 (14:30 -0700)]
[mlir][sparse] add one extra index test on f32 matrix

Reviewed By: bixia

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

2 years ago[mlir:PDLInterp][NFC] Switch to using prefixed accessors
River Riddle [Tue, 15 Mar 2022 23:40:36 +0000 (16:40 -0700)]
[mlir:PDLInterp][NFC] Switch to using prefixed accessors

PDLInterp is effectively an internal dialect, so there isn't a need to
stage the switch.

2 years ago[mlir:Toy][NFC] Switch toy to use prefixed accessors
River Riddle [Tue, 15 Mar 2022 23:09:19 +0000 (16:09 -0700)]
[mlir:Toy][NFC] Switch toy to use prefixed accessors

2 years ago[lld-macho] Set FinalDefinitionInLinkageUnit on most LTO externs
Jez Ng [Wed, 16 Mar 2022 00:25:06 +0000 (20:25 -0400)]
[lld-macho] Set FinalDefinitionInLinkageUnit on most LTO externs

Since Mach-O has a two-level namespace (unlike ELF), we can usually set
this property to true.

(I believe this setting is only available in the new LTO backend, so I
can't really use ld64 / libLTO's behavior as a reference here... I'm
just doing what I think is correct.)

See {D119294} for the work done to calculate the `interposable` used in
this diff.

Reviewed By: MaskRay

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

2 years ago[ELF] Suppress duplicate symbol error for __x86.get_pc_thunk.bx
Fangrui Song [Wed, 16 Mar 2022 00:20:29 +0000 (17:20 -0700)]
[ELF] Suppress duplicate symbol error for __x86.get_pc_thunk.bx

2 years ago[libfuzzer] improve introductory sentence
Tobias Nießen [Wed, 16 Mar 2022 00:13:08 +0000 (17:13 -0700)]
[libfuzzer] improve introductory sentence

This merely adds a missing "an" in the introductory sentence.

Reviewed By: vitalybuka

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

2 years agoReapply [pseudo] Move pseudoparser from clang to clang-tools-extra"
Sam McCall [Wed, 16 Mar 2022 00:08:02 +0000 (01:08 +0100)]
Reapply [pseudo] Move pseudoparser from clang to clang-tools-extra"

This reverts commit 049f4e4eab19c6e468e029232e94ca71245b0f56.

The problem was a stray dependency in CLANG_TEST_DEPS which caused cmake
to fail if clang-pseudo wasn't built. This is now removed.

2 years agoRevert "[pseudo] Move pseudoparser from clang to clang-tools-extra"
Sam McCall [Wed, 16 Mar 2022 00:06:01 +0000 (01:06 +0100)]
Revert "[pseudo] Move pseudoparser from clang to clang-tools-extra"

This reverts commit b97856c4cfe7efb13887d5691002a7aa38440924.

Breaks a bunch of bots:
https://lab.llvm.org/buildbot/#/builders/193/builds/8513

2 years ago[libc][bazel] split support_standalone_cpp target
Michael Jones [Wed, 9 Mar 2022 19:00:44 +0000 (11:00 -0800)]
[libc][bazel] split support_standalone_cpp target

previously the support_standalone_cpp target contained all of the files
in the __support/cpp folder. This change splits these out so that only
what is needed is included. In addition, this change adds the new
support files that previously didn't have targets.

Reviewed By: lntue, gchatelet

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

2 years ago[SLP] Optionally preserve MemorySSA
Philip Reames [Tue, 15 Mar 2022 23:19:55 +0000 (16:19 -0700)]
[SLP] Optionally preserve MemorySSA

This initial patch adds code to preserve MemorySSA through a run of SLP vectorizer. The eventual plan is to use MemorySSA to accelerate SLP's memory dependence checking, but we're a ways from that.  In particular, this patch is correct, but really slow. It's being landed so that we can work incrementally in tree, not because it's expected to be useful to anyone just yet.

The broader effort is being tracked in https://github.com/llvm/llvm-project/issues/54256.  Its worth noting expicitly that this may not work out, and if not, we will be reverting all of the MSSA support in SLP at some point in the next few weeks.

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

2 years ago[pseudo] Move pseudoparser from clang to clang-tools-extra
Sam McCall [Tue, 8 Mar 2022 18:31:32 +0000 (19:31 +0100)]
[pseudo] Move pseudoparser from clang to clang-tools-extra

This should make clearer that:
 - it's not part of clang proper
 - there's no expectation to update it along with clang (beyond green tests)
 - clang should not depend on it

This is intended to be expose a library, so unlike other tools has a split
between include/ and lib/.

The main renames are:
  clang/lib/Tooling/Syntax/Pseudo/*           => clang-tools-extra/pseudo/lib/*
  clang/include/clang/Tooling/Syntax/Pseudo/* => clang-tools-extra/pseudo/include/clang-pseudo/*
  clang/tools/clang/pseudo/*                  => clang-tools-extra/pseudo/tool/*
  clang/test/Syntax/*                         => clang-tools-extra/pseudo/test/*
  clang/unittests/Tooling/Syntax/Pseudo/*     => clang-tools-extra/pseudo/unittests/*
  #include "clang/Tooling/Syntax/Pseudo/*"    => #include "clang-pseudo/*"
  namespace clang::syntax::pseudo             => namespace clang::pseudo
  check-clang                                 => check-clang-pseudo
  clangToolingSyntaxPseudo                    => clangPseudo
The clang-pseudo and ClangPseudoTests binaries are not renamed.

See discussion around:
https://discourse.llvm.org/t/rfc-a-c-pseudo-parser-for-tooling/59217/50

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

2 years ago[gn build] (manually) port 2b69eb4a7d1d
Nico Weber [Tue, 15 Mar 2022 23:05:46 +0000 (19:05 -0400)]
[gn build] (manually) port 2b69eb4a7d1d

2 years ago[mlir][sparse][taco] Support the use of index values in tensor expressions.
Bixia Zheng [Mon, 14 Mar 2022 23:41:41 +0000 (16:41 -0700)]
[mlir][sparse][taco] Support the use of index values in tensor expressions.

PyTACO DSL doesn't support the use of index values as in A[i] = B[i]+ i.
We extend the DSL to support such a use in MLIR-PyTACO.

Remove an obsolete unit test. Add unit tests and PyTACO tests.

Reviewed By: aartbik

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

2 years ago[lld][WebAssembly] Add --unresolved-symbols=import-dynamic
Sam Clegg [Mon, 16 Nov 2020 18:11:37 +0000 (10:11 -0800)]
[lld][WebAssembly] Add --unresolved-symbols=import-dynamic

This is a new mode for handling unresolved symbols that allows all
symbols to be imported in the same that they would be in the case of
`-fpie` or `-shared`, but generting an otherwise fixed/non-relocatable
binary.

Code linked in this way should still be compiled with `-fPIC` so that
data symbols can be resolved via imports.

This essentially allows the building of static binaries that have
dynamic imports.  See:
https://github.com/emscripten-core/emscripten/issues/12682

As with other uses of the experimental dynamic linking ABI, this
behaviour will produce a warning unless run with `--experimental-pic`.

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

2 years ago[flang] Move null entry at the correct place
Valentin Clement [Tue, 15 Mar 2022 21:52:36 +0000 (22:52 +0100)]
[flang] Move null entry at the correct place

This is a fix for failing buildbot
https://lab.llvm.org/buildbot/#/builders/172/builds/9652

2 years ago[mlir][toy] Define a FuncOp operation in toy and drop the dependence on FuncOp
River Riddle [Wed, 9 Mar 2022 00:21:07 +0000 (16:21 -0800)]
[mlir][toy] Define a FuncOp operation in toy and drop the dependence on FuncOp

FuncOp is being moved out of the builtin dialect, and defining a custom
toy operation showcases various aspects of defining function-like operation
(e.g. inlining, passes, etc.).

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

2 years ago[mlir][PDL] Define a new PDLInterp::FuncOp operation and drop uses of FuncOp
River Riddle [Tue, 8 Mar 2022 22:20:08 +0000 (14:20 -0800)]
[mlir][PDL] Define a new PDLInterp::FuncOp operation and drop uses of FuncOp

Defining our own function operation allows for the PDL interpreter
to be more self contained, and also removes any dependency on FuncOp;
which is moving out of the Builtin dialect.

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

2 years ago[libc][NFC] Fix typos and reduntent code triggering compiler warinings.
Siva Chandra Reddy [Tue, 15 Mar 2022 21:34:51 +0000 (21:34 +0000)]
[libc][NFC] Fix typos and reduntent code triggering compiler warinings.

2 years ago[MLIR] UnknownLoc on Inlinable Calls in LLVMIR Translation
Ian Bearman [Tue, 15 Mar 2022 20:31:25 +0000 (13:31 -0700)]
[MLIR] UnknownLoc on Inlinable Calls in LLVMIR Translation

During MLIR translation to LLVMIR if an inlineable call has an UnkownLoc we get this error message:

```
inlinable function call in a function with debug info must have a !dbg location
  call void @callee()
```

There is code that checks for this case and strips debug information to avoid this situation. I'm expanding this code to handle the case where an debug location points at a UnknownLoc. For example, a NamedLoc whose child location is an UnknownLoc.

Reviewed By: ftynse

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

2 years ago[ELF] Work around not-fully-supported .gnu.linkonce.t.__x86.get_pc_thunk.bx
Fangrui Song [Tue, 15 Mar 2022 21:48:29 +0000 (14:48 -0700)]
[ELF] Work around not-fully-supported .gnu.linkonce.t.__x86.get_pc_thunk.bx

2 years ago[lldb] Fix AppleObjCRuntime log channels
Jonas Devlieghere [Tue, 15 Mar 2022 21:21:10 +0000 (14:21 -0700)]
[lldb] Fix AppleObjCRuntime log channels

The log channel was changed from Types to Commands in
a007a6d84471bb956abe10974cac3066799f583f:

-    Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES));
+    Log *log = GetLog(LLDBLog::Process | LLDBLog::Commands);

2 years ago[flang] Fix intrinsic entry
Valentin Clement [Tue, 15 Mar 2022 21:40:11 +0000 (22:40 +0100)]
[flang] Fix intrinsic entry

2 years ago[flang] Lower random_[init|number|seed] intrinsics
Valentin Clement [Tue, 15 Mar 2022 21:29:06 +0000 (22:29 +0100)]
[flang] Lower random_[init|number|seed] intrinsics

Thsi patch add the infrastructure to lower the random related
intrinsics:

- `random_init`
- `random_number`
- `random_seed`

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld, schweitz

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

Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years ago[sanitizer] Always initialize the regex in the regcomp() interceptor
Tavian Barnes [Tue, 15 Mar 2022 21:23:02 +0000 (14:23 -0700)]
[sanitizer] Always initialize the regex in the regcomp() interceptor

When regcomp() fails, the same regex_t* should be passed to regerror()
for potentially better error messages.  But doing that with msan would
report a use-of-uninitialized-value.

Fixes https://github.com/google/sanitizers/issues/1496

Reviewed By: vitalybuka

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

2 years ago[flang] Lower min|max intrinsics
Valentin Clement [Tue, 15 Mar 2022 21:18:45 +0000 (22:18 +0100)]
[flang] Lower min|max intrinsics

This patch adds lowering for the following intrinsics:
- `max`
- `maxloc`
- `maxval`
- `minloc`
- `minval`

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: mleair <leairmark@gmail.com>
2 years agoX86ISelDAGToDAG: Transform TEST + MOV64ri to SHR + TEST
Matthias Braun [Wed, 9 Mar 2022 23:50:20 +0000 (15:50 -0800)]
X86ISelDAGToDAG: Transform TEST + MOV64ri to SHR + TEST

Optimize a pattern where a sequence of 8/16 or 32 bits is tested for
zero: LLVM normalizes this towards and `AND` with mask which is usually
good, but does not work well on X86 when the mask does not fit into a
64bit register. This DagToDAG peephole transforms sequences like:

```
movabsq $562941363486720, %rax # imm = 0x1FFFE00000000
testq %rax, %rdi
```

to

```
shrq $33, %rdi
testw %di, %di
```

The result has a shorter encoding and saves a register if the tested
value isn't used otherwise.

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

2 years agoAdd tests for D121320
Matthias Braun [Wed, 9 Mar 2022 19:10:06 +0000 (11:10 -0800)]
Add tests for D121320

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

2 years ago[libc++] Define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER whenever we enable warnings in...
Louis Dionne [Thu, 3 Mar 2022 18:39:12 +0000 (13:39 -0500)]
[libc++] Define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER whenever we enable warnings in the test suite

This should make CI consistent on all the compilers we support. Most of
this patch is working around various warnings emitted by GCC in our code
base, which are now being shown when we compile the tests.

After this patch, the whole test suite should be warning free on all
compilers we support and test, except for a few warnings on GCC that
we silence explicitly until we figure out the proper fix for them.

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

2 years ago[flang] Lower character related intrinsic
Valentin Clement [Tue, 15 Mar 2022 21:13:24 +0000 (22:13 +0100)]
[flang] Lower character related intrinsic

This patch adds lowering for the following character related intrinsics:
- `len`
- `len_trim`
- `lge`, `lgt`, `lle` and `llt`

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[clang-tools-extra] Reuse llvm_config.use_clang() to set up test environment
Sam McCall [Thu, 10 Mar 2022 23:29:10 +0000 (00:29 +0100)]
[clang-tools-extra] Reuse llvm_config.use_clang() to set up test environment

This replaces a bunch of duplicate logic to set up environment variables
and a few substitutions.

It does a little more than we were doing previously:
 - searching for clang and setting up substitutions for it
 - setting up some substitutions for target triples, which are
   potentially useful but not actually used

clangd has been happily using this for its tests for a while.

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

2 years ago[flang] Lower allocated intrinsic
Valentin Clement [Tue, 15 Mar 2022 21:06:04 +0000 (22:06 +0100)]
[flang] Lower allocated intrinsic

This patch adds lowering for the `allocated`
intrinsic.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier, PeteSteinfeld

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years agoFix sphinx build because of indentation
Aleksandr Platonov [Tue, 15 Mar 2022 21:08:54 +0000 (00:08 +0300)]
Fix sphinx build because of indentation

2 years ago[lit] add lit_config.substitute to interpolate lit_config.params
Sam McCall [Thu, 10 Mar 2022 23:58:03 +0000 (00:58 +0100)]
[lit] add lit_config.substitute to interpolate lit_config.params

A version of this logic appears in ~every lit.site.cfg.in (28 copies total).
This patch just removes two, but I'll update the rest of llvm-project next.

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

2 years ago[LLDB][NativePDB] Don't complete static members' types when completing a record type.
Zequan Wu [Mon, 14 Mar 2022 20:53:19 +0000 (13:53 -0700)]
[LLDB][NativePDB] Don't complete static members' types when completing a record type.

`UdtRecordCompleter` shouldn't complete static members' types. static members' types are going to be completed when the types are called in `SymbolFile::CompleteType`.

Reviewed By: labath

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

2 years ago[flang] Lower alternate return
Valentin Clement [Tue, 15 Mar 2022 21:03:14 +0000 (22:03 +0100)]
[flang] Lower alternate return

This patch adds the lowering infrastructure for the lowering of
alternat returns.

This patch is part of the upstreaming effort from fir-dev branch.

Depends on D121698

Reviewed By: PeteSteinfeld

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

Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[flang] Lower entry statement
Valentin Clement [Tue, 15 Mar 2022 21:01:34 +0000 (22:01 +0100)]
[flang] Lower entry statement

This patch add the lowering for the entry statement.

This patch is part of the upstreaming effort from fir-dev branch.

Depends on D121697

Reviewed By: PeteSteinfeld

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

Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[flang] Lower more pointer assignments/disassociation cases
Valentin Clement [Tue, 15 Mar 2022 20:57:30 +0000 (21:57 +0100)]
[flang] Lower more pointer assignments/disassociation cases

This patch lowers more cases of pointer assignments and
disassociations.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld, schweitz

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

Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: mleair <leairmark@gmail.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years agoreland: [clang] Don't append the working directory to absolute paths
Keith Smiley [Tue, 15 Mar 2022 03:35:44 +0000 (20:35 -0700)]
reland: [clang] Don't append the working directory to absolute paths

This fixes a bug that happens when using -fdebug-prefix-map to remap an
absolute path to a relative path. Since the path was absolute before
remapping, it is safe to assume that concatenating the remapped working
directory would be wrong.

This was originally submitted as https://reviews.llvm.org/D113718, but
reverted because when testing with dwarf 5 enabled, the tests were too
strict.

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

2 years ago[clang-format] Fix crash with ObjC Blocks
Björn Schäpers [Mon, 14 Mar 2022 12:19:08 +0000 (13:19 +0100)]
[clang-format] Fix crash with ObjC Blocks

Fixes https://github.com/llvm/llvm-project/issues/54367
Fixes https://github.com/llvm/llvm-project/issues/54368

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

2 years ago[libc++] Add workaround to avoid breaking users of <span> when <ranges> are disabled
Louis Dionne [Mon, 14 Mar 2022 15:50:02 +0000 (11:50 -0400)]
[libc++] Add workaround to avoid breaking users of <span> when <ranges> are disabled

Back in 3a208c68942e, we implemented the range-based constructor for <span>.
However, in doing so, we removed a previous non-standard constructor that
we provided before shipping <ranges>. Unfortunately, that breaks code that
was relying on a range-based constructor until we ship all of <ranges>.

This patch reintroduces the old non-conforming constructors and tests
that were removed in 3a208c68942e and uses them whenever <ranges> is
not provided (e.g. in LLVM 14). This is only a temporary workaround
until we enable <ranges> by default in C++20, which should hopefully
happen by LLVM 15.

The goal is to cherry-pick this workaround back to the LLVM 14 release
branch, since I suspect the constructor removal may otherwise cause
breakage out there, like the breakage I saw internally.

We could have avoided this situation by waiting for C++20 to be finalized
before shipping std::span. For example, we could have guarded it with
something like _LIBCPP_HAS_NO_INCOMPLETE_RANGES to prevent users from
accidentally starting to depend on it before it is stable. We did not
have these mechanisms when std::span was first implemented, though.

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

2 years ago[lsan] Allow suppression of "unknown module"
Vitaly Buka [Tue, 15 Mar 2022 07:30:14 +0000 (00:30 -0700)]
[lsan] Allow suppression of "unknown module"

If sanitizer cannot determine name of the module it
will use "<unknown module>". Then it can be suppressed
if needed.

Reviewed By: kda

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

2 years ago[libc++] Update URL to old libc++ dylibs
Louis Dionne [Tue, 15 Mar 2022 20:18:45 +0000 (16:18 -0400)]
[libc++] Update URL to old libc++ dylibs

2 years ago[Concepts] Fix an assertion failure while diagnosing constrained
Roy Jacobson [Tue, 15 Mar 2022 19:54:18 +0000 (12:54 -0700)]
[Concepts] Fix an assertion failure while diagnosing constrained
function candidates

See: https://github.com/llvm/llvm-project/issues/54379

I tried to see if I can reuse ResolveAddressOfOverloadedFunction for
explicit function instantiation and so I managed to hit this ICE.

Bug was the diagnostic required an argument (%0) and specific code path
didn't pass an argument.

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

2 years agoAvoid using a variable-sized array for a tiny allocation.
Sterling Augustine [Tue, 15 Mar 2022 19:48:31 +0000 (12:48 -0700)]
Avoid using a variable-sized array for a tiny allocation.

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

2 years agoRe-land "[lldb] Synchronize output through the IOHandler"
Jonas Devlieghere [Tue, 15 Mar 2022 18:11:04 +0000 (11:11 -0700)]
Re-land "[lldb] Synchronize output through the IOHandler"

Add synchronization to the IOHandler to prevent multiple threads from
writing concurrently to the output or error stream.

A scenario where this could happen is when a thread (the default event
thread for example) is using the debugger's asynchronous stream. We
would delegate this operation to the IOHandler which might be running on
another thread. Until this patch there was nothing to synchronize the
two at the IOHandler level.

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

2 years ago[BOLT][NFC] Remove unused function
Maksim Panchenko [Tue, 15 Mar 2022 19:33:55 +0000 (12:33 -0700)]
[BOLT][NFC] Remove unused function

Reviewed By: yota9

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