platform/upstream/llvm.git
2 years agogn build: Add support for building the standalone ubsan runtime as a shared library...
Peter Collingbourne [Fri, 30 Sep 2022 04:38:54 +0000 (21:38 -0700)]
gn build: Add support for building the standalone ubsan runtime as a shared library on non-Mac.

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

2 years ago[NFC][sanitizer] Simplify symbolizer build script
Vitaly Buka [Fri, 30 Sep 2022 19:22:40 +0000 (12:22 -0700)]
[NFC][sanitizer] Simplify symbolizer build script

This checks are irrelevant with monorepo.

2 years ago[sanitizer] Fix build of 32bit symbolizer
Vitaly Buka [Fri, 30 Sep 2022 19:09:46 +0000 (12:09 -0700)]
[sanitizer] Fix build of 32bit symbolizer

2 years ago[TableGen] Add div bang operator
Michael Maitland [Fri, 16 Sep 2022 00:38:11 +0000 (17:38 -0700)]
[TableGen] Add div bang operator

This patch adds the div bang operator which performs division.

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

2 years ago[libunwind] Fix compile error with CROSS_UNWINDING
Florian Mayer [Fri, 30 Sep 2022 15:46:06 +0000 (08:46 -0700)]
[libunwind] Fix compile error with CROSS_UNWINDING

Reviewed By: #libunwind, MaskRay, mgorny

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

2 years ago[runtimes] Remove all traces of the legacy testing configuration system
Louis Dionne [Thu, 26 May 2022 14:58:28 +0000 (10:58 -0400)]
[runtimes] Remove all traces of the legacy testing configuration system

Now that all jobs have moved over to the new style of Lit configuration,
we can remove all traces of the legacy testing configuration system.
This includes:
- Cache settings that are not honored or useful anymore
- Several CMake options that were only useful in the context of the
  legacy Lit configuration system
- A bunch of Python support code that is not used anymore
- The legacy lit.cfg.in files themselves

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

2 years ago[libc++] Remove unique usage of the en_US locale in a test
Louis Dionne [Thu, 29 Sep 2022 22:15:23 +0000 (18:15 -0400)]
[libc++] Remove unique usage of the en_US locale in a test

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

2 years ago[ConstraintElimination] Simplify check lines in test added in 2812a141.
Florian Hahn [Fri, 30 Sep 2022 18:51:05 +0000 (19:51 +0100)]
[ConstraintElimination] Simplify check lines in test added in 2812a141.

The CHECK lines in the test are too specific and cause mis-matches on
some platforms. Reduce them to make them less fragile.

2 years ago[ConstraintElimination] Add test showing bug in analysis invalidation.
Florian Hahn [Fri, 30 Sep 2022 18:37:58 +0000 (19:37 +0100)]
[ConstraintElimination] Add test showing bug in analysis invalidation.

2 years ago[flang] Remove unused AffineMapAttr from fir.box type
Valentin Clement [Fri, 30 Sep 2022 18:35:25 +0000 (20:35 +0200)]
[flang] Remove unused AffineMapAttr from fir.box type

AffineMapAttr on fir.box type is not used. This patch
remove it. It can be added back later when needed.

Reviewed By: jeanPerier

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

2 years ago[test] Update some legacy PM tests
Arthur Eubanks [Fri, 30 Sep 2022 18:30:46 +0000 (11:30 -0700)]
[test] Update some legacy PM tests

2 years ago[DirectX backend] Support global ctor for DXILBitcodeWriter.
Xiang Li [Thu, 29 Sep 2022 17:23:41 +0000 (10:23 -0700)]
[DirectX backend] Support global ctor for DXILBitcodeWriter.

1. Save typed pointer type for GlobalVariable/Function instead of the ObjectType.
   This will allow use GlobalVariable/Function as value.
2. Save target type for global ctors for Constant.
3. In DXILBitcodeWriter::getTypeID, check PointerMap first for Constant case.

Reviewed By: beanz

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

2 years ago[Clang] Fix variant crashes from GH58028, GH57370
Roy Jacobson [Thu, 29 Sep 2022 15:38:46 +0000 (18:38 +0300)]
[Clang] Fix variant crashes from GH58028, GH57370

Fixes a null dereference in some diagnostic issuing code.

Closes https://github.com/llvm/llvm-project/issues/57370
Closes https://github.com/llvm/llvm-project/issues/58028

Reviewed By: shafik

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

2 years ago[mlir][sparse] Factoring out predicates on DimLevelTypes
wren romano [Fri, 30 Sep 2022 00:34:09 +0000 (17:34 -0700)]
[mlir][sparse] Factoring out predicates on DimLevelTypes

This way the predicates can be reused elsewhere, and can more easily be kept in sync with changes to the enum.

Reviewed By: aartbik

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

2 years ago[FixIrreducible][opt] Mark -fix-irreducible as a codegen pass
Arthur Eubanks [Fri, 30 Sep 2022 17:34:04 +0000 (10:34 -0700)]
[FixIrreducible][opt] Mark -fix-irreducible as a codegen pass

So we don't have to specify -enable-new-pm=0.

2 years ago[StructurizeCFG][opt] Mark -structurizecfg as a codegen pass
Arthur Eubanks [Fri, 30 Sep 2022 17:26:18 +0000 (10:26 -0700)]
[StructurizeCFG][opt] Mark -structurizecfg as a codegen pass

So we don't have to specify -enable-new-pm=0.

2 years ago[AMDGPU] Add test for FMAC_e64 dpp combine. NFC.
Joe Nash [Fri, 30 Sep 2022 15:38:42 +0000 (11:38 -0400)]
[AMDGPU] Add test for FMAC_e64 dpp combine. NFC.

2 years ago[ConstraintElimination] Make sure the variable is available before use.
Florian Hahn [Fri, 30 Sep 2022 17:09:01 +0000 (18:09 +0100)]
[ConstraintElimination] Make sure the variable is available before use.

This fixes a crash when trying to access an index for a value where we
don't have a known index.

Fixes #58009.

2 years ago[mlir][MemRef] Simplify extract_strided_metadata(collapse_shape)
Quentin Colombet [Wed, 28 Sep 2022 00:26:52 +0000 (00:26 +0000)]
[mlir][MemRef] Simplify extract_strided_metadata(collapse_shape)

The new pattern gets rid of the collapse_shape operation while
materializing its effects on the sizes, and the strides of the base
object.

In other words, this simplification replaces:

```
baseBuffer, offset, sizes, strides =
    extract_strided_metadata(collapse_shape(memref))
```

With

```
baseBuffer, offset, baseSizes, baseStrides =
    extract_strided_metadata(memref)
for reassDim in {0 .. collapseRank - 1}
  sizes#reassDim = product(baseSizes#i for i in group[reassDim])
  strides#reassDim = baseStrides[group[reassDim].back()]
```

Note: baseBuffer and offset are unaffected by the collapse_shape
operation.

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

2 years ago[DAG] Update foldSelectWithIdentityConstant to use llvm::isNeutralConstant
Simon Pilgrim [Fri, 30 Sep 2022 16:45:05 +0000 (17:45 +0100)]
[DAG] Update foldSelectWithIdentityConstant to use llvm::isNeutralConstant

D133866 added the llvm::isNeutralConstant helper to track neutral/passthrough constants

This patch updates foldSelectWithIdentityConstant to use the helper instead of maintaining its own opcode handling

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

2 years ago[mlir][sparse] minor edit in doc, removed TAB from test
Aart Bik [Fri, 30 Sep 2022 00:20:51 +0000 (17:20 -0700)]
[mlir][sparse] minor edit in doc, removed TAB from test

Reviewed By: Peiming

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

2 years ago[AArch64] Reflow comment in AArch64IselLowering.cpp (NFC).
Florian Hahn [Fri, 30 Sep 2022 15:53:56 +0000 (16:53 +0100)]
[AArch64] Reflow comment in AArch64IselLowering.cpp (NFC).

2 years ago[mlir][linalg] Use getIteratorTypeArray instead of raw iterator_type attribute.
Oleg Shyshkov [Fri, 30 Sep 2022 15:59:53 +0000 (15:59 +0000)]
[mlir][linalg] Use getIteratorTypeArray instead of raw iterator_type attribute.

Summary:
Also modify helper methods to take StringRefs instread of Attributes. It makes
the code cleaner and will help with future migration from StringRef to
utils::IteratorType ([RFC](https://discourse.llvm.org/t/rfc-enumattr-for-iterator-types-in-linalg/64535)).

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

2 years ago[AArch64] Refactor opcode selection for LowerMUL (NFC)
Zain Jaffal [Fri, 30 Sep 2022 15:47:59 +0000 (16:47 +0100)]
[AArch64] Refactor opcode selection for LowerMUL (NFC)

Move the logic for selecting `NewOpc` out of `LowerMUL`

Reviewed By: fhahn

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

2 years ago[RISCV] Address post commit review comments from D134881
Philip Reames [Fri, 30 Sep 2022 15:30:52 +0000 (08:30 -0700)]
[RISCV] Address post commit review comments from D134881

2 years agoRISCV: adjust relocation emission
Saleem Abdulrasool [Fri, 19 Aug 2022 21:30:36 +0000 (21:30 +0000)]
RISCV: adjust relocation emission

Simplify and make the pair-wise relocation more precise.  If either of
the symbol references are textual, the relocation must be delayed.  If
the difference is across sections, delay it as well which partially
matches the behaviour of gas.  We unfortunately do not handle the case
where the difference references a symbol that is not yet defined.  In
such a case, we simply fail to resolve the difference, which should
hopefully not be too onerous (particularly since no other target
supports cross-section references and it is not clear if this was
intentional on the part of RISCV).

Differential Revision: https://reviews.llvm.org/D132262
Reviewed By: @MaskRay

2 years agoRevert "[lldb] Fix member access in GetExpressionPath"
Andy Yankovsky [Fri, 30 Sep 2022 15:24:06 +0000 (15:24 +0000)]
Revert "[lldb] Fix member access in GetExpressionPath"

This reverts commit 14642dc74

Broke the tests on macOS -- https://reviews.llvm.org/D132734#3827245

2 years ago[RISCV] Branchless lowering for select (and (x , 0x1) == 0), y, (z ^ y) ) and select...
Philip Reames [Fri, 30 Sep 2022 15:11:35 +0000 (08:11 -0700)]
[RISCV] Branchless lowering for select (and (x , 0x1) == 0), y, (z ^ y) ) and select (and (x , 0x1) == 0), y, (z | y) )

This code is directly ported from the X86 backend which applies the same rewrite (along with several others). Planning on looking more closely at the other branchless variants from x86 to see if any are worth porting in future changes.

Motivation here is the coremark crc8 routine from https://github.com/eembc/coremark/blob/main/core_util.c#L165. This patch significantly reduces the number of unpredictable branches in the workload.

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

2 years ago[mlir][test] NFC - Fix some worst offenders "capture by SSA name" tests
Nicolas Vasilache [Fri, 30 Sep 2022 15:20:29 +0000 (08:20 -0700)]
[mlir][test] NFC - Fix some worst offenders "capture by SSA name" tests

Many tests still depend on specific names of SSA values (!!).
This commit is a best effort cleanup that will set the stage for adding some pretty SSA result names.

2 years ago[RISCV] Remove some unused var decl. NFC
Ray Wang [Fri, 30 Sep 2022 15:01:27 +0000 (08:01 -0700)]
[RISCV] Remove some unused var decl. NFC

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

2 years ago[BOLT] Fixed some typos
Gabriel Ravier [Fri, 30 Sep 2022 15:00:56 +0000 (17:00 +0200)]
[BOLT] Fixed some typos

I went over the output of the following mess of a command:

`(ulimit -m 2000000; ulimit -v 2000000; git ls-files -z | parallel --xargs -0 cat | aspell list --mode=none --ignore-case | grep -E '^[A-Za-z][a-z]*$' | sort | uniq -c | sort -n | grep -vE '.{25}' | aspell pipe -W3 | grep : | cut -d' ' -f2 | less)`

and proceeded to spend a few days looking at it to find probable typos
and fixed a few hundred of them in all of the llvm project (note, the
ones I found are not anywhere near all of them, but it seems like a
good start).

Reviewed By: Amir, maksfb

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

2 years agoRevert "[Driver][Fuchsia] Add default linker flags"
Alex Brachet [Fri, 30 Sep 2022 14:54:48 +0000 (14:54 +0000)]
Revert "[Driver][Fuchsia] Add default linker flags"

This reverts commit 5dfc8ebee5d688ee94607ccce655672c1a198b82.

2 years ago[NFC] Fix for doc typo in commit 9a4e52ebeb6d
Yitzhak Mandelbaum [Fri, 30 Sep 2022 14:53:07 +0000 (14:53 +0000)]
[NFC] Fix for doc typo in commit 9a4e52ebeb6d

2 years ago[X86] Tweak avx512-gfni-intrinsics.ll tests to avoid xor(select(c,x,0)) 'passthrough...
Simon Pilgrim [Fri, 30 Sep 2022 14:22:08 +0000 (15:22 +0100)]
[X86] Tweak avx512-gfni-intrinsics.ll tests to avoid xor(select(c,x,0)) 'passthrough' patterns

These can be manipulated by foldSelectWithIdentityConstant and lose the predicate/predicate-zero instruction test coverage - use an insertvalue chain into an aggregate instead to retain all the results.

Noticed while trying to convert foldSelectWithIdentityConstant to use llvm::isNeutralConstant

2 years ago[GlobalISel] Do not crash on widening vector result
Serge Pavlov [Fri, 24 Jun 2022 17:17:22 +0000 (00:17 +0700)]
[GlobalISel] Do not crash on widening vector result

Function buildCopyToRegs did not handle properly the case when it should
make wider vector result. It happened, for example, in a function that
returns value of type <2 x f32>, which should be widen to <4 x f32> to
fit XMM register. The function eventually calls
MachineIRBuilder.buildUnmerge, which does not expect that only one
destination register is specified.

Now this case is treated specifically in buildCopyToRegs.

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

2 years ago[clang-tidy] Add an IgnoreMacros option to readability-avoid-const-params-in-decls
Yitzhak Mandelbaum [Fri, 30 Sep 2022 14:14:11 +0000 (14:14 +0000)]
[clang-tidy] Add an IgnoreMacros option to readability-avoid-const-params-in-decls

readability-avoid-const-params-in-decls.IgnoreMacros is enabled by default to be consistent with most other checks.

Reviewed By: ymandel

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

2 years ago[SCCP] regenerate test checks; NFC
Sanjay Patel [Fri, 30 Sep 2022 14:20:03 +0000 (10:20 -0400)]
[SCCP] regenerate test checks; NFC

Avoid names with "tmp" because that can go wrong with the auto-generated script names.

2 years ago[AST] Use BatchAA in aliasesPointer() (NFC)
Nikita Popov [Fri, 9 Sep 2022 14:24:14 +0000 (16:24 +0200)]
[AST] Use BatchAA in aliasesPointer() (NFC)

2 years ago[lldb] Fix deprecation warning for using std::iterator
Nico Weber [Thu, 29 Sep 2022 00:18:27 +0000 (20:18 -0400)]
[lldb] Fix deprecation warning for using std::iterator

std::iterator was deprecated in C++17.

No behavior change.

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

2 years ago[AMDGPU][GISel] Update `isCanonicalized`
Pierre van Houtryve [Thu, 29 Sep 2022 08:30:20 +0000 (08:30 +0000)]
[AMDGPU][GISel] Update `isCanonicalized`

Recognize more opcodes in the function.
Fixes some regressions introduced in D134857 for fdiv.f16 too.

Depends on D134857

Reviewed By: arsenm, foad

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

2 years ago[GISel] Add more cases to isKnownNeverNaN
Pierre van Houtryve [Thu, 29 Sep 2022 07:57:29 +0000 (07:57 +0000)]
[GISel] Add more cases to isKnownNeverNaN

Make it even with the DAG implementation as of D134854

Reviewed By: arsenm, foad

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

2 years ago[LICM] Collect more scalar promotion stats (NFC)
Nikita Popov [Fri, 9 Sep 2022 14:31:36 +0000 (16:31 +0200)]
[LICM] Collect more scalar promotion stats (NFC)

Collect more statistics for scalar promotion. In particular,
keep track of how many promotion candidates there were, and
whether it is a load or a load/store promotion.

2 years ago[Driver][Fuchsia] Add default linker flags
Alex Brachet [Fri, 30 Sep 2022 14:06:51 +0000 (14:06 +0000)]
[Driver][Fuchsia] Add default linker flags

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

2 years ago[AMDGPU][GISel] Add Identity BUILD_VECTOR Combines
Pierre van Houtryve [Fri, 30 Sep 2022 13:44:30 +0000 (13:44 +0000)]
[AMDGPU][GISel] Add Identity BUILD_VECTOR Combines

Folds-away BUILD_VECTOR-related noops in the post-legalizer combiner.

Depends on D134433

Reviewed By: arsenm

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

2 years ago[AMDGPU][GISel] Legalize V2S16 G_BUILD_VECTOR
Pierre van Houtryve [Fri, 30 Sep 2022 11:08:29 +0000 (11:08 +0000)]
[AMDGPU][GISel] Legalize V2S16 G_BUILD_VECTOR

Preparation patch for D134354 to make V2S16 G_BUILD_VECTOR legal.
Also removes RegBankInfo's scalarization of small BUILD_VECTORs,
replacing it with InstructionSelector logic instead.

This allows for V2S16 BUILD_VECTOR instructions to survive
all the way to ISel so we can select FMA/MAD_MIX instructions
in D134354.

Reviewed By: arsenm

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

2 years ago[SCCP] add tests for sitofp; NFC
Sanjay Patel [Fri, 30 Sep 2022 12:58:13 +0000 (08:58 -0400)]
[SCCP] add tests for sitofp; NFC

Adapted from the existing tests for ashr, sdiv, srem.

2 years ago[AMDGPU][SetWavePriority] Fix dealing with MBBInfo records.
Ivan Kosarev [Fri, 30 Sep 2022 13:24:08 +0000 (14:24 +0100)]
[AMDGPU][SetWavePriority] Fix dealing with MBBInfo records.

Happened earlier than I anticipated. :)

Reviewed By: arsenm

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

2 years ago[lldb] Fix 'error: non-const lvalue...' caused by SWIG 4.1.0
Jitka Plesnikova [Wed, 21 Sep 2022 09:42:46 +0000 (11:42 +0200)]
[lldb] Fix 'error: non-const lvalue...' caused by SWIG 4.1.0

Fix the failure caused by change in SwigValueWraper for C++11 and later
for improved move semantics in SWIG commit.

https://github.com/swig/swig/commit/d1055f4b3d51cb8060893f8036846ac743302dab

2 years ago[NFC] Fix erroneous indentation.
Amaury Séchet [Fri, 30 Sep 2022 12:30:27 +0000 (12:30 +0000)]
[NFC] Fix erroneous indentation.

2 years ago[InstSimplify] look through vector select (shuffle) in min/max fold
Sanjay Patel [Fri, 30 Sep 2022 11:56:15 +0000 (07:56 -0400)]
[InstSimplify] look through vector select (shuffle) in min/max fold

This is an extension of the existing min/max+select fold (which already
has a very large number of variations) to allow a vector shuffle because
that's what we have in the motivating example from issue #42100.

A couple of Alive2 checks of variants (I don't know how to generalize
these in Alive):
https://alive2.llvm.org/ce/z/jUFAqT

And verify the PR42100 test:
https://alive2.llvm.org/ce/z/3EcASf

It's possible there is some generalization of the fold or a
VectorCombine/SLP answer for the motivating test, but I haven't found a
better/smaller solution yet.

We can also add even more variants here as follow-up patches. For example,
we can have shuffle followed by min/max; we also don't have this
canonicalization or the reverse:
https://alive2.llvm.org/ce/z/StHD9f

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

2 years ago[SLP][X86] Add test coverage for Issue #58054
Simon Pilgrim [Fri, 30 Sep 2022 12:26:24 +0000 (13:26 +0100)]
[SLP][X86] Add test coverage for Issue #58054

2 years ago[InstCombine] Add test for PR57488 (NFC)
Nikita Popov [Fri, 30 Sep 2022 12:24:58 +0000 (14:24 +0200)]
[InstCombine] Add test for PR57488 (NFC)

2 years agotsan: fix deadlock/crash in signal handling
Dmitry Vyukov [Fri, 30 Sep 2022 11:58:27 +0000 (13:58 +0200)]
tsan: fix deadlock/crash in signal handling

We set in_blocking_func around some blocking C functions so that we don't
delay signal infinitely (if in_blocking_func is set we deliver signals
synchronously).

However, pthread_join is blocking but also call munmap/free to free thread
resources. If we are inside the munmap/free interceptors called from
pthread_join and deliver a signal synchronously, it can lead to deadlocks
and crashes since we re-enter runtime and try to lock the same mutexes
or use the same per-thread data structures.

If we re-enter runtime via an interceptor when in_blocking_func is set,
temporary reset in_blocking_func around the interceptor and restore it back
when we return from the recursive interceptor.

Also move in_blocking_func from ThreadSignalContext to ThreadContext
so that we can CHECK that it's not set in SlotLocker ctor.

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

Reviewed By: melver

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

2 years ago[mlir] fix DiagnosedSilenceableFailure::takeDiagnostics
Alex Zinenko [Fri, 30 Sep 2022 11:07:39 +0000 (11:07 +0000)]
[mlir] fix DiagnosedSilenceableFailure::takeDiagnostics

This function was returning an rvalue reference to an object that was
also cleared via RAII when the function returned, making it always
return an empty object. Make it accept the mutable reference to the
object instead to avoid this dangerous behavior.

Reviewed By: guraypp

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

2 years ago[AArch64] Add additional tests for SMULL instruction selection
Zain Jaffal [Fri, 30 Sep 2022 11:32:25 +0000 (12:32 +0100)]
[AArch64] Add additional tests for SMULL instruction selection

Add tests where the operands are switched and where the top bit of the operand is set to 1

Reviewed By: fhahn

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

2 years ago[lldb] Fix member access in GetExpressionPath
Tonko Sabolčec [Fri, 30 Sep 2022 11:10:32 +0000 (11:10 +0000)]
[lldb] Fix member access in GetExpressionPath

This change fixes two issues in ValueObject::GetExpressionPath method:

 1. Accessing members of struct references used to produce expression
    paths such as "str.&str.member" (instead of the expected
    "str.member"). This is fixed by assigning the flag tha the child
    value is a dereference when calling Dereference() on references
    and adjusting logic in expression path creation.

 2. If the parent of member access is dereference, the produced
    expression path was "*(ptr).member". This is incorrect, since it
    dereferences the member instead of the pointer. This is fixed by
    wrapping dereference expression into parenthesis, resulting with
    "(*(ptr)).member".

Reviewed By: werat, clayborg

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

2 years ago[InstCombine] Add test for phi translation during select of phi fold (NFC)
Nikita Popov [Fri, 30 Sep 2022 11:06:53 +0000 (13:06 +0200)]
[InstCombine] Add test for phi translation during select of phi fold (NFC)

The phi translation performed during this fold is important for
correctness, but was apparently untested.

2 years agoCleanup: avoid referring to std::vector<T> members when T is incomplete.
Alexander Kornienko [Fri, 30 Sep 2022 11:04:07 +0000 (13:04 +0200)]
Cleanup: avoid referring to std::vector<T> members when T is incomplete.

This is not legal according to the C++ standard, and causes build errors in
particular in C++20 mode. Fix it by defining the vector's type before using the
vector.

Patch by poompatai@google.com.

2 years ago[InstCombine] Regenerate test checks (NFC)
Nikita Popov [Fri, 30 Sep 2022 11:04:23 +0000 (13:04 +0200)]
[InstCombine] Regenerate test checks (NFC)

2 years ago[lldb][Windows] Always call SetExecutableModule on debugger connected
Alvin Wong [Wed, 28 Sep 2022 09:58:51 +0000 (12:58 +0300)]
[lldb][Windows] Always call SetExecutableModule on debugger connected

In `ProcessWindows::OnDebuggerConnected` (triggered from
`CREATE_PROCESS_DEBUG_EVENT`), we should always call
`Target::SetExecutableModule` regardless of whether LLDB has already
preloaded the executable modules. `SetExecutableModule` has the side
effect of clearing the module list of the Target, which help make sure
that module #0 is the executable module and the rest of the modules are
listed according to the DLL load order in the process (technically this
has no real consequences but it seems to make more sense anyway.) It
also fixes an issue where the modules preloaded by LLDB will be
duplicated when the debuggee process actually loads the DLL.

Reviewed By: labath

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

2 years ago[mlir][SCF] Apply ClangTidyPerformance finding (NFC)
Adrian Kuegel [Fri, 30 Sep 2022 10:47:32 +0000 (12:47 +0200)]
[mlir][SCF] Apply ClangTidyPerformance finding (NFC)

2 years agoRevert rG1b7089fe67b924bdd5ecef786a34bdba7a88778f "[SLP] Add ScalarizationOverheadBui...
Simon Pilgrim [Fri, 30 Sep 2022 10:19:30 +0000 (11:19 +0100)]
Revert rG1b7089fe67b924bdd5ecef786a34bdba7a88778f "[SLP] Add ScalarizationOverheadBuilder helper to track vector extractions"
Revert rGef89409a59f3b79ae143b33b7d8e6ee6285aa42f "Fix 'unused-lambda-capture' gcc warning. NFCI."
Revert rG926ccfef032d206dcbcdf74ca1e3a9ebf4d1be45 "[SLP] ScalarizationOverheadBuilder - demand all elements for scalarization if the extraction index is unknown / out of bounds"

Revert ScalarizationOverheadBuilder sequence from D134605 - when accumulating extraction costs by Type (instead of specific Value), we are not distinguishing enough when they are coming from the same source or not, and we always just count the cost once. This needs addressing before we can use getScalarizationOverhead properly.

2 years ago[LoopDeletion] Clear block & loop dispo cache after breaking backedge.
Florian Hahn [Fri, 30 Sep 2022 10:21:58 +0000 (11:21 +0100)]
[LoopDeletion] Clear block & loop dispo cache after breaking backedge.

breakLoopBackedge may remove blocks and loops. Also clear block &
loop disposition to avoid the cache containing invalid blocks and loops.

The coverage for the change is provided when using an ASAN build of opt
to run the LoopDeletion unit tests; without the fix, pointers to invalid
objects would be used.

Reviewed By: nikic

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

2 years ago[SLP][X86] Add test case for crash reported on D134605
Simon Pilgrim [Fri, 30 Sep 2022 10:07:46 +0000 (11:07 +0100)]
[SLP][X86] Add test case for crash reported on D134605

2 years ago[SLP][AArch64] Add test case for vectorization regression case reported on D134605
Simon Pilgrim [Fri, 30 Sep 2022 10:03:14 +0000 (11:03 +0100)]
[SLP][AArch64] Add test case for vectorization regression case reported on D134605

2 years ago[mlir] Rename getTied* methods to getMatching* in LinalgInterface.
Oleg Shyshkov [Fri, 30 Sep 2022 10:03:00 +0000 (10:03 +0000)]
[mlir] Rename getTied* methods to getMatching* in LinalgInterface.

Summary:
As mentioned in the comment to https://reviews.llvm.org/D134444, the term `tied`
is a misnomer in this context and `matching` sounds much better.

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

2 years ago[AArch64] Add support for 128-bit non temporal loads.
Zain Jaffal [Fri, 30 Sep 2022 10:03:48 +0000 (11:03 +0100)]
[AArch64] Add support for 128-bit non temporal loads.

Adding to the work done in `D131773` here we add support to 128-bit loads.

Reviewed By: fhahn

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

2 years ago[DebugInfo][LICM] Drop DebugLoc from IntrinsicInst when hoisting
Juan Manuel MARTINEZ CAAMAÑO [Tue, 27 Sep 2022 12:15:36 +0000 (12:15 +0000)]
[DebugInfo][LICM] Drop DebugLoc from IntrinsicInst when hoisting

The DebugLoc is conserved when hoisting function calls, to ensure the
DIScope is preserved if inlining occurs.

This commit drops the DebugLoc in the case the call is an intrinsic
call that won't be lowered into a function call.

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

2 years ago[LoongArch] Clean up redundant code introduced by conflict resolution. NFC
gonglingqin [Fri, 30 Sep 2022 06:49:35 +0000 (14:49 +0800)]
[LoongArch] Clean up redundant code introduced by conflict resolution. NFC

2 years agoRevert "[Clang] Fix variant crashes from GH58028, GH57370"
Roy Jacobson [Fri, 30 Sep 2022 08:24:46 +0000 (11:24 +0300)]
Revert "[Clang] Fix variant crashes from GH58028, GH57370"

This reverts commit 9706bb3165f5e508d5e2247ad8a3f45077df546d, some CI workers complain about the test.

2 years ago[Clang] define __cpp_named_character_escapes
Roy Jacobson [Thu, 29 Sep 2022 20:19:45 +0000 (23:19 +0300)]
[Clang] define __cpp_named_character_escapes

Define the feature test macro for named character escapes.
I assume this was not done because it was implemented before formally accepted, right? cxx_status says the paper is implemented.

Reviewed By: cor3ntin

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

2 years ago[Clang] Fix variant crashes from GH58028, GH57370
Roy Jacobson [Thu, 29 Sep 2022 15:38:46 +0000 (18:38 +0300)]
[Clang] Fix variant crashes from GH58028, GH57370

Fixes a null dereference in some diagnostic issuing code.

Closes https://github.com/llvm/llvm-project/issues/57370
Closes https://github.com/llvm/llvm-project/issues/58028

Reviewed By: shafik

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

2 years ago[libc] Re-enable functions from signal.h and re-enable abort.
Siva Chandra Reddy [Wed, 7 Sep 2022 23:04:09 +0000 (23:04 +0000)]
[libc] Re-enable functions from signal.h and re-enable abort.

They were disabled because we were including linux/signal.h from our
signal.h. Linux's signal.h is not designed to be included from user
programs as it causes a lot of non-standard name pollution. Also, it is
not self-contained. This change defines types and macros relevant for
signal related syscalls within libc's headers and removes inclusion of
Linux headers.

This patch enables the funtions only for x86_64. They will be enabled
for aarch64 also in a follow up patch after testing.

Reviewed By: abrachet, lntue

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

2 years ago[TableGen] Add `countRendererFns` to `InstructionOperandMatcher`
Pierre van Houtryve [Thu, 29 Sep 2022 08:11:09 +0000 (08:11 +0000)]
[TableGen] Add `countRendererFns` to `InstructionOperandMatcher`

Without it, the count of renderer functions is inaccurate and, in some
edge cases (like the patterns added in D134354), we can actually
go out of bounds (run out of pre-allocated renderer function spaces
in the GISel state)

Reviewed By: arsenm

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

2 years ago[clang] [Driver] Disable default configs via envvar during testing
Michał Górny [Thu, 29 Sep 2022 20:38:52 +0000 (22:38 +0200)]
[clang] [Driver] Disable default configs via envvar during testing

Add support for a CLANG_NO_DEFAULT_CONFIG envvar that works like
the --no-default-config option when set to a non-empty value.  Use it
to disable loading system configuration files during the test suite
runs.

Configuration files can change the driver behavior in extensive ways,
and it is neither really possible nor feasible to account for or undo
the effects of even the most common configuration uses.  Therefore,
the most reasonable option seems to be to ignore configuration files
while running the majority of tests (with the notable exception of tests
for configuration file support).

Due to the diversity of ways that %clang is used in the test suite,
including using it to copy or symlink the clang executable, as well to
call -cc1 and -cc1as modes, it is not feasible to pass the explicit
options to disable config loading either.  Using an environment variable
has the advantage of being easily applied across the test suite
and easily unset for default configuration file loading tests.

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

2 years ago[lldb] Get rid of __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS
serge-sans-paille [Thu, 29 Sep 2022 19:48:38 +0000 (21:48 +0200)]
[lldb] Get rid of __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS

C++11 made the use of these macro obsolete, see https://sourceware.org/bugzilla/show_bug.cgi?id=15366

As a side effect this prevents https://github.com/swig/swig/issues/2193.

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

2 years ago[mlir][Linalg] Reland Add ReduceOp to Linalg structured ops.
Adrian Kuegel [Fri, 30 Sep 2022 06:36:32 +0000 (08:36 +0200)]
[mlir][Linalg] Reland Add ReduceOp to Linalg structured ops.

This op will allow to model (variadic) reductions with this special op
instead of using GenericOp.

This reverts commit 535fd753ef8dcfe5c73219ea7173e015a74e4f59.
Additional fix: implement a getLibraryName method.

2 years ago[mlir][Bazel] Port 11069cbcb47845074d526490fff8daff8afda11d
Adrian Kuegel [Fri, 30 Sep 2022 06:33:10 +0000 (08:33 +0200)]
[mlir][Bazel] Port 11069cbcb47845074d526490fff8daff8afda11d

2 years ago[sanitizer] Fix symbolizer build script
Vitaly Buka [Fri, 30 Sep 2022 06:32:16 +0000 (23:32 -0700)]
[sanitizer] Fix symbolizer build script

2 years ago[clang][Interp] Handle enums
Timm Bäder [Fri, 16 Sep 2022 07:17:52 +0000 (09:17 +0200)]
[clang][Interp] Handle enums

Handle DeclRefExprs of enum types. They are otherwise handled like
integers.

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

2 years ago[clang] [test] Use --implicit-check-not in config-file3 tests
Michał Górny [Fri, 30 Sep 2022 05:59:41 +0000 (07:59 +0200)]
[clang] [test] Use --implicit-check-not in config-file3 tests

Thanks to Fangrui Song for the suggestion.

2 years ago[Doc] Fix typo. NFC
Phoebe Wang [Fri, 30 Sep 2022 06:00:42 +0000 (14:00 +0800)]
[Doc] Fix typo. NFC

Fixes #56429

2 years agoRevert "[CMake] Use libcxx targets for in-tree sanitizer C++ ABI"
Petr Hosek [Fri, 30 Sep 2022 05:52:49 +0000 (05:52 +0000)]
Revert "[CMake] Use libcxx targets for in-tree sanitizer C++ ABI"

This reverts commit 7dbdffefb768062f28599c256b5e013ee26ff04e since
it appears to have broken several ASan tests.

2 years agoFix spelling in Co-authored-by documentation
Kristof Beyls [Fri, 30 Sep 2022 05:42:06 +0000 (07:42 +0200)]
Fix spelling in Co-authored-by documentation

2 years ago[ELF] Reset verdefIndex for Defined preempting SharedSymbol
Fangrui Song [Fri, 30 Sep 2022 04:26:53 +0000 (21:26 -0700)]
[ELF] Reset verdefIndex for Defined preempting SharedSymbol

to avoid spurious "attempt to reassign symbol '...'" warning after
7a58dd1046a8052619d173b769f32f2df3aafbe8

2 years ago[JITLink] Update external symbol scopes to reflect scopes of resolved defs.
Lang Hames [Fri, 30 Sep 2022 02:16:19 +0000 (19:16 -0700)]
[JITLink] Update external symbol scopes to reflect scopes of resolved defs.

This is a counterpart to ffe2dda29f3, and does for scope what that commit did
for linkage.

Making the scope of external definitions visible to JITLink plugins will
allow us to distinguish hidden weak defs (which do not need to be tracked by
default) from default-scoped weak defs (which need to be updated to point at
a single chosen definition at runtime).

2 years ago[SelectionDAG] Add helper function to check whether a SDValue is neutral element...
Yeting Kuo [Wed, 14 Sep 2022 08:29:53 +0000 (16:29 +0800)]
[SelectionDAG] Add helper function to check whether a SDValue is neutral element. NFC.

Using this helper makes work about neutral elements more easier. Although I only
find one case now, I think it will have more chance to be used since so many
combine works are related to neutral elements.

Reviewed By: RKSimon

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

2 years ago[mlir][spirv] Handle dynamic/static cases differntly for kernel capability
Nirvedh Meshram [Thu, 29 Sep 2022 18:14:18 +0000 (11:14 -0700)]
[mlir][spirv] Handle dynamic/static cases differntly for kernel capability

Reviewed By: antiagainst

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

2 years ago[gn build] Port 91c96a806cae
LLVM GN Syncbot [Fri, 30 Sep 2022 01:33:02 +0000 (01:33 +0000)]
[gn build] Port 91c96a806cae

2 years ago[CMake] Use correct include flag for MSVC
Petr Hosek [Thu, 29 Sep 2022 08:48:03 +0000 (08:48 +0000)]
[CMake] Use correct include flag for MSVC

When building using the MSVC driver, we need to use /imsvc rather than
-isystem for system headers.

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

2 years ago[CMake] Use libcxx targets for in-tree sanitizer C++ ABI
Petr Hosek [Thu, 29 Sep 2022 07:53:06 +0000 (07:53 +0000)]
[CMake] Use libcxx targets for in-tree sanitizer C++ ABI

When in-tree libcxx is selected as the sanitizer C++ ABI, use libcxx
targets rather than libcxxabi and libunwind, since those may not be
available on all platforms (Windows for example).

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

2 years agoRevert "[MLGO] ML Regalloc Priority Advisor"
Mircea Trofin [Fri, 30 Sep 2022 01:26:40 +0000 (18:26 -0700)]
Revert "[MLGO] ML Regalloc Priority Advisor"

This reverts commit 8f4f26ba5bd04f7b335836021e5e63b4236c0305.

Buildbot failures, e.g. https://lab.llvm.org/buildbot/#/builders/6/builds/14041

2 years ago[mlir][sparse] Fixing case coverage warning
wren romano [Fri, 30 Sep 2022 00:24:01 +0000 (17:24 -0700)]
[mlir][sparse] Fixing case coverage warning

Followup to D133835 for fixing the warning on LLVM's Windows buildbot

Reviewed By: aartbik, Peiming, stella.stamenova

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

2 years ago[DAG] Simplify the select of constant combine code. NFC
Amaury Séchet [Fri, 30 Sep 2022 00:58:04 +0000 (00:58 +0000)]
[DAG] Simplify the select of constant combine code. NFC

2 years ago[DAG] select Cond, C, -1 --> or (sext (not Cond)), C when C is MVT::i1
Amaury Séchet [Sat, 6 Aug 2022 02:10:22 +0000 (02:10 +0000)]
[DAG] select Cond, C, -1 --> or (sext (not Cond)), C when C is MVT::i1

In the spirit of D130765 . Get rid of cbranches and/or cmov. Usually shorter, but sometime not, becaus eit's hard to prededict when dependency breaking xor will be introduced.

Reviewed By: RKSimon

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

2 years ago[mlir][sparse] refactoring: split translateIndices.
Peiming Liu [Thu, 29 Sep 2022 21:59:02 +0000 (21:59 +0000)]
[mlir][sparse] refactoring: split translateIndices.

TranslateIndicesArray take an array of SSA value and convert them into another array of SSA values based on reassociation. Which makes it easier to be reused by `foreach` operator (as the indices array are given as an array of SSA values).

Reviewed By: aartbik, bixia

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

2 years ago[libc][windows] rename fenv internals for windows
Michael Jones [Tue, 27 Sep 2022 23:52:21 +0000 (16:52 -0700)]
[libc][windows] rename fenv internals for windows

On windows, including math.h causes macros for "OVERFLOW" and
"UNDERFLOW" to be defined. This patch renames some variables internal to
FEnvImpl.h to avoid colliding with those.

Reviewed By: sivachandra

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

2 years ago[mlir][sparse] Allow the push_back operator to skip capacity check and reallocation.
bixia1 [Thu, 29 Sep 2022 21:50:42 +0000 (14:50 -0700)]
[mlir][sparse] Allow the push_back operator to skip capacity check and reallocation.

Add UnitAttr `inbounds` for this purpose.

Reviewed By: aartbik

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

2 years ago[IR] Don't allow DLL storage-class and local linkage
Ben Dunbobbin [Thu, 29 Sep 2022 23:21:31 +0000 (00:21 +0100)]
[IR] Don't allow DLL storage-class and local linkage

Disallow this meaningless combination. Doing so simplifies analysis
of LLVM code w.r.t t DLL storage-class, and prevents mistakes with
DLL storage class.

- Change the assembler to reject DLL storage class on symbols with
  local linkage.
- Change the bitcode reader to clear the DLL Storage class when the
  linkage is local for auto-upgrading
- Update LangRef.

There is an existing restriction on non-default visibility and local
linkage which this is modelled on.

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

2 years ago[mlir][sparse] implement singleton dimension level type
Aart Bik [Sat, 17 Sep 2022 00:55:50 +0000 (17:55 -0700)]
[mlir][sparse] implement singleton dimension level type

This is a first step towards fully implementing the new dimension
level types and properties, illustrating with a fully functional
sorted COO of any dimension. Note that the sparsification part is
pretty complete. The required parts in the runtime support library
have been kept to a minimum, to avoid huge conflicts with Wren's
ongoing refactoring. The missing parts will be filled in later.

Reviewed By: Peiming

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