platform/upstream/llvm.git
3 years ago[NFC] Removed unused prefixes in CodeGen/AMDGPU
Mircea Trofin [Wed, 6 Jan 2021 17:35:52 +0000 (09:35 -0800)]
[NFC] Removed unused prefixes in CodeGen/AMDGPU

This covers tests starting with m-r.

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

3 years ago[X86] Add commuted patterns test coverage for D93599
Simon Pilgrim [Wed, 6 Jan 2021 17:50:22 +0000 (17:50 +0000)]
[X86] Add commuted patterns test coverage for D93599

Suggested by @spatel

3 years ago[Clang] Remove unnecessary Attr.isArgIdent checks.
Florian Hahn [Wed, 6 Jan 2021 14:59:27 +0000 (14:59 +0000)]
[Clang] Remove unnecessary Attr.isArgIdent checks.

The MatrixType, ExtVectorType, VectorSize and AddressSpace attributes
have arguments defined as ExprArguments in Attr.td. So their arguments
should never be ArgIdents and the logic to handle this case can be
removed.

The logic has been replaced by an assertion to ensure the arguments
are always ArgExpressions

Reviewed By: erichkeane

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

3 years ago[X86] Remove [ER]SP from all CSR lists
Reid Kleckner [Tue, 5 Jan 2021 21:45:02 +0000 (13:45 -0800)]
[X86] Remove [ER]SP from all CSR lists

The CSR lists control which registers are spilled and reloaded in the
prologue and epilogue. The stack pointer is managed explicitly, and
should never be pushed or popped. Remove it from these lists. This
affected regcall and preserves all / most.

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

3 years agoRemove allow-unregistered-dialect from some tests that don't need it
Sanjoy Das [Sun, 3 Jan 2021 06:56:44 +0000 (22:56 -0800)]
Remove allow-unregistered-dialect from some tests that don't need it

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

3 years agoNit: fix spacing
Sanjoy Das [Sun, 3 Jan 2021 18:33:34 +0000 (10:33 -0800)]
Nit: fix spacing

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

3 years ago[mlir] NFC: fix trivial typos
Kazuaki Ishizaki [Wed, 6 Jan 2021 17:35:29 +0000 (02:35 +0900)]
[mlir] NFC: fix trivial typos
fix typos under docs, test, and tools directories

Reviewed By: ftynse

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

3 years ago[NFC] Removed unused prefixes from CodeGen/AMDGPU
Mircea Trofin [Wed, 6 Jan 2021 04:23:39 +0000 (20:23 -0800)]
[NFC] Removed unused prefixes from CodeGen/AMDGPU

All the 'l'-starting tests.

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

3 years agoAMDGPU/GlobalISel: Update fdiv lowering for denormal/ulp interaction
Matt Arsenault [Wed, 6 Jan 2021 02:14:42 +0000 (21:14 -0500)]
AMDGPU/GlobalISel: Update fdiv lowering for denormal/ulp interaction

Change the GlobalISel fast fdiv handling to match the changes in
2531535984ad989ce88aeee23cb92a827da6686e and
884acbb9e167d5668e43581630239d688edec8ad

3 years ago[llvm][NFC] Disallow all warnings in TypeSize tests
Peter Waller [Wed, 6 Jan 2021 17:16:38 +0000 (17:16 +0000)]
[llvm][NFC] Disallow all warnings in TypeSize tests

This is a follow-up to a request from a reviewer [0]. The text may change in
the future and these tests should not produce any warning output.

[0] https://reviews.llvm.org/D91806#inline-879243

Reviewed By: sdesmalen, david-arm

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

3 years ago[InstCombine] Update valueCoversEntireFragment to use TypeSize
Francesco Petrogalli [Wed, 6 Jan 2021 17:12:23 +0000 (17:12 +0000)]
[InstCombine] Update valueCoversEntireFragment to use TypeSize

* Update valueCoversEntireFragment to use TypeSize.
* Add a regression test.
* Assertions have been added to protect untested codepaths.

Reviewed By: sdesmalen

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

3 years agoAMDGPU/GlobalISel: Add baseline IR tests for fdiv
Matt Arsenault [Wed, 6 Jan 2021 02:33:42 +0000 (21:33 -0500)]
AMDGPU/GlobalISel: Add baseline IR tests for fdiv

The fdiv lowering is currently split between an IR pass and codegen,
so make sure this works end to end. We also currently differ from the
DAG on some edge cases, which this will show in a future change.

3 years agoAMDGPU: Explicitly use SelectionDAG in legacy intrinsic tests
Matt Arsenault [Thu, 30 Jul 2020 02:50:02 +0000 (22:50 -0400)]
AMDGPU: Explicitly use SelectionDAG in legacy intrinsic tests

GlobalISel will probably not support the legacy buffer intrinsics, so
don't fail when the default is switched.

3 years ago[flang][driver] Add support for `-D`, `-U`
Faris Rehman [Wed, 6 Jan 2021 15:42:24 +0000 (15:42 +0000)]
[flang][driver] Add support for `-D`, `-U`

Add support for options -D and -U in the new Flang driver.

Summary of changes:
  - Create PreprocessorOptions, to be used by the driver then translated
    into Fortran::parser::Options
  - Create CompilerInvocation::setFortranOpts to pass preprocessor
    options into the parser options
  - Add a dedicated method, Flang::AddPreprocessingOptions, to extract
    preprocessing options from the driver arguments into the preprocessor
    command arguments

Macros specified like -DName will default to definition 1.

When defining macros, the new driver will drop anything after an
end-of-line character. This is consistent with gfortran and clang, but
different to what currently f18 does. However, flang (which is a bash
wrapper for f18), also drops everything after an end-of-line character.
So gfortran-like behaviour felt like the natural choice. Test is added
to demonstrate this behaviour.

Reviewed By: awarzynski

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

3 years ago[TargetLowering] Add icmp ne/eq (srl (ctlz x), log2(bw)) vector support.
Simon Pilgrim [Wed, 6 Jan 2021 16:13:36 +0000 (16:13 +0000)]
[TargetLowering] Add icmp ne/eq (srl (ctlz x), log2(bw)) vector support.

3 years ago[AArch64] Rearrange mul(dup(sext/zext)) to mul(sext/zext(dup))
Nicholas Guy [Wed, 2 Dec 2020 15:15:23 +0000 (15:15 +0000)]
[AArch64] Rearrange mul(dup(sext/zext)) to mul(sext/zext(dup))

Performing this rearrangement allows for existing patterns
to match cases where the vector may be built after an extend,
instead of before.

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

3 years agoRemove some unused <vector> includes. NFCI.
Simon Pilgrim [Wed, 6 Jan 2021 15:50:11 +0000 (15:50 +0000)]
Remove some unused <vector> includes. NFCI.

<vector> (unlike many other c++ headers) is relatively clean, so if the file doesn't use std::vector then it shouldn't need the header.

3 years ago[X86] Add icmp ne/eq (srl (ctlz x), log2(bw)) test coverage.
Simon Pilgrim [Wed, 6 Jan 2021 15:44:36 +0000 (15:44 +0000)]
[X86] Add icmp ne/eq (srl (ctlz x), log2(bw)) test coverage.

Add vector coverage as well (which isn't currently supported).

3 years ago[Hexagon] Wrap functions only used in asserts in ifndef NDEBUG
Krzysztof Parzyszek [Wed, 6 Jan 2021 15:11:04 +0000 (09:11 -0600)]
[Hexagon] Wrap functions only used in asserts in ifndef NDEBUG

3 years ago[mlir][spirv] Update pass docs
Lei Zhang [Wed, 6 Jan 2021 15:28:01 +0000 (10:28 -0500)]
[mlir][spirv] Update pass docs

Reviewed By: hanchung

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

3 years agoFix MaterializeTemporaryExpr's type when its an incomplete array.
Erich Keane [Wed, 6 Jan 2021 14:46:01 +0000 (06:46 -0800)]
Fix MaterializeTemporaryExpr's type when its an incomplete array.

Like the VarDecl that gets its type updated based on an init-list, this
patch corrects the MaterializeTemporaryExpr's type to make sure it isn't
creating an incomplete type, which leads to a handful of CodeGen crashes
(see PR 47636).

Based on @rsmith 's comments on D88236

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

3 years ago[Driver][MachineOutliner] Support outlining option with LTO
Yvan Roux [Wed, 6 Jan 2021 15:01:38 +0000 (16:01 +0100)]
[Driver][MachineOutliner] Support outlining option with LTO

This patch propagates the -moutline flag when LTO is enabled and avoids
passing it explicitly to the linker plugin.

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

3 years ago[LoopDeletion] Also consider loops with subloops for deletion.
Florian Hahn [Wed, 6 Jan 2021 11:51:52 +0000 (11:51 +0000)]
[LoopDeletion] Also consider loops with subloops for deletion.

Currently, LoopDeletion does skip loops that have sub-loops, but this
means we currently fail to remove some no-op loops.

One example are inner loops with live-out values. Those cannot be
removed by itself. But the containing loop may itself be a no-op and the
whole loop-nest can be deleted.

The legality checks do not seem to rely on analyzing inner-loops only
for correctness.

With LoopDeletion being a LoopPass, the change means that we now
unfortunately need to do some extra work in parent loops, by checking
some conditions we already checked. But there appears to be no
noticeable compile time impact:
http://llvm-compile-time-tracker.com/compare.php?from=02d11f3cda2ab5b8bf4fc02639fd1f4b8c45963e&to=843201e9cf3b6871e18c52aede5897a22994c36c&stat=instructions

This changes patch leads to ~10 more loops being deleted on
MultiSource, SPEC2000, SPEC2006 with -O3 & LTO

This patch is also required (together with a few others) to eliminate a
no-op loop in omnetpp as discussed on llvm-dev 'LoopDeletion / removal of
empty loops.' (http://lists.llvm.org/pipermail/llvm-dev/2020-December/147462.html)

This change becomes relevant after removing potentially infinite loops
is made possible in 'must-progress' loops (D86844).

Note that I added a function call with side-effects to an outer loop in
`llvm/test/Transforms/LoopDeletion/update-scev.ll` to preserve the
original spirit of the test.

Reviewed By: reames

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

3 years ago[lldb] Simplify some lldb-server tests
Pavel Labath [Tue, 5 Jan 2021 19:28:31 +0000 (20:28 +0100)]
[lldb] Simplify some lldb-server tests

Remove manual test duplication.

3 years ago[MLIR][SPIRV] Add `UnsignedOp` trait.
KareemErgawy-TomTom [Wed, 6 Jan 2021 13:56:53 +0000 (14:56 +0100)]
[MLIR][SPIRV] Add `UnsignedOp` trait.

This commit adds a new trait that can be attached to ops that have
unsigned semantics.

TODO:
- Check if other places in code can use the new attribute (possibly in this patch).
- Add a similar `SignedOp` attribute (in a new patch).

Reviewed By: antiagainst

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

3 years ago[TableGen] RegisterBankEmitter - Pass Twine by const reference instead of by value...
Simon Pilgrim [Wed, 6 Jan 2021 14:19:59 +0000 (14:19 +0000)]
[TableGen] RegisterBankEmitter - Pass Twine by const reference instead of by value. NFCI.

3 years ago[MIPS] MipsAsmParser - Pass Twine by const reference instead of by value. NFCI.
Simon Pilgrim [Wed, 6 Jan 2021 14:11:08 +0000 (14:11 +0000)]
[MIPS] MipsAsmParser - Pass Twine by const reference instead of by value. NFCI.

3 years ago[ProfileData] Pass Twine by const reference instead of by value.
Simon Pilgrim [Wed, 6 Jan 2021 14:04:37 +0000 (14:04 +0000)]
[ProfileData] Pass Twine by const reference instead of by value.

Its only used by DiagnosticInfoSampleProfile which takes a const reference anyhow.

3 years ago[OpenCL][NFC] Improve OpenCL test file naming
Sven van Haastregt [Wed, 6 Jan 2021 14:16:44 +0000 (14:16 +0000)]
[OpenCL][NFC] Improve OpenCL test file naming

Change "negative" into "invalid" and put "invalid" at the beginning of
the file name, following the bulk of the invalid tests in the
SemaOpenCL directory.

Use the "invalid-" prefix only for tests that contain only invalid
constructs.

Drop the "valid" suffix for CodeGen tests, as inputs in this directory
are supposed to be valid anyway.

3 years ago[Hexagon] Regenerate zext-v4i1.ll tests
Simon Pilgrim [Wed, 6 Jan 2021 12:55:52 +0000 (12:55 +0000)]
[Hexagon] Regenerate zext-v4i1.ll tests

This will be improved by part of the work for D86578

3 years agoReapply multiple "[clang][cli]" patches
Jan Svoboda [Tue, 5 Jan 2021 16:00:46 +0000 (17:00 +0100)]
Reapply multiple "[clang][cli]" patches

This reverts 7ad666798f12 and 1876a2914fe0 that reverted:

741978d727a4 [clang][cli] Port CodeGen option flags to new option parsing system
383778e2171b [clang][cli] Port LangOpts option flags to new option parsing system
aec2991d083a [clang][cli] Port LangOpts simple string based options to new option parsing system
95d3cc67caac [clang][cli] Port CodeGenOpts simple string flags to new option parsing system
27b7d646886d [clang][cli] Streamline MarshallingInfoFlag description
70410a264949 [clang][cli] Let denormalizer decide how to render the option based on the option class
63a24816f561 [clang][cli] Implement `getAllArgValues` marshalling

Commit 741978d727a4 accidentally changed the `Group` attribute of `g[no_]column_info` options from `g_flags_Group` to `g_Group`, which changed the debug info options passed to cc1 by the driver.

Similar change was also present in 383778e2171b, which accidentally added `Group<f_Group>` to `f[no_]const_strings` and `f[no_]signed_wchar`.

This patch corrects all three accidental changes by replacing `Bool{G,F}Option` with `BoolCC1Option`.

3 years ago[AArch64] Add BRB IALL and BRB INJ instructions
Tomas Matheson [Tue, 29 Dec 2020 11:42:03 +0000 (11:42 +0000)]
[AArch64] Add BRB IALL and BRB INJ instructions

BRB IALL: Invalidate the Branch Record Buffer
BRB INJ: Branch Record Injection into the Branch Record Buffer

Parser changes based on work by Simon Tatham.

These are two-word mnemonics. The assembly parser works by special-casing
the mnemonic in order to parse the second word as a plain identifier token.

Reviewed by: MarkMurrayARM

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

3 years ago[libc] Align src buffer instead of dst buffer
Guillaume Chatelet [Wed, 6 Jan 2021 12:04:53 +0000 (12:04 +0000)]
[libc] Align src buffer instead of dst buffer

We used to align destination buffer instead of source buffer for the loop of block copy.
This is a mistake.

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

3 years ago[libc] remove modulo from CircularArrayRef iterator
Guillaume Chatelet [Wed, 6 Jan 2021 12:03:34 +0000 (12:03 +0000)]
[libc] remove modulo from CircularArrayRef iterator

3 years ago[X86] Add scalar/vector test coverage for D93599
Simon Pilgrim [Wed, 6 Jan 2021 11:40:58 +0000 (11:40 +0000)]
[X86] Add scalar/vector test coverage for D93599

This expands the test coverage beyond just the boolvector/movmsk concat pattern

3 years ago[PowerPC] Fix issue where vsrq is given incorrect shift vector
Stefan Pintilie [Tue, 5 Jan 2021 20:42:53 +0000 (14:42 -0600)]
[PowerPC] Fix issue where vsrq is given incorrect shift vector

The new Power10 instruction vsrq was being given the wrong shift vector.
The original code assumed that the shift would be found in bits 121 to 127.
This is not correct. The shift is found in bits 57 to 63.
This can be fixed by swaping the first and second double words.

Reviewed By: nemanjai, #powerpc

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

3 years ago[VPlan] Keep start value in VPWidenIntOrFpInductionRecipe (NFC).
Florian Hahn [Wed, 6 Jan 2021 11:30:23 +0000 (11:30 +0000)]
[VPlan] Keep start value in VPWidenIntOrFpInductionRecipe (NFC).

This patch updates VPWidenIntOrFpInductionRecipe to hold the start value
for the induction variable. This makes the start value explicit and
allows for adjusting the start value for a VPlan.

The flexibility will be used in further patches.

Reviewed By: Ayal

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

3 years ago[AArch64][SVE] Emit DWARF location expr for SVE (dbg.declare)
Sander de Smalen [Wed, 6 Jan 2021 11:38:30 +0000 (11:38 +0000)]
[AArch64][SVE] Emit DWARF location expr for SVE (dbg.declare)

When using dbg.declare, the debug-info is generated from a list of
locals rather than through DBG_VALUE instructions in the MIR.
This patch is different from D90020 because it emits the DWARF
location expressions from that list of locals directly.

Reviewed By: jmorse

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

3 years ago[ValueTypes] Fix formatting on scalable vector warning (NFC)
Fraser Cormack [Wed, 6 Jan 2021 11:26:11 +0000 (11:26 +0000)]
[ValueTypes] Fix formatting on scalable vector warning (NFC)

3 years ago[LiveDebugValues] Handle spill locations with a fixed and scalable component.
Sander de Smalen [Wed, 6 Jan 2021 10:54:41 +0000 (10:54 +0000)]
[LiveDebugValues] Handle spill locations with a fixed and scalable component.

This patch fixes the two LiveDebugValues implementations
(InstrRef/VarLoc)Based to handle cases where the StackOffset contains
both a fixed and scalable component.

This depends on the `TargetRegisterInfo::prependOffsetExpression` being
added in D90020. Feel free to leave comments on that patch if you have them.

Reviewed By: djtodoro, jmorse

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

3 years ago[ARM] Handle any extend whilst lowering addw/addl/subw/subl
David Green [Wed, 6 Jan 2021 11:26:39 +0000 (11:26 +0000)]
[ARM] Handle any extend whilst lowering addw/addl/subw/subl

Same as a9b6440edd, use zanyext to treat any_extends as zero extends
during lowering to create addw/addl/subw/subl nodes.

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

3 years ago[VPlan] Add getLiveInIRValue accessor to VPValue.
Florian Hahn [Wed, 6 Jan 2021 10:57:46 +0000 (10:57 +0000)]
[VPlan] Add getLiveInIRValue accessor to VPValue.

This patch adds a new getLiveInIRValue accessor to VPValue, which
returns the underlying value, if the VPValue is defined outside of
VPlan. This is required to handle scalars in VPTransformState, which
requires dealing with scalars defined outside of VPlan.

We can simply check VPValue::Def to determine if the value is defined
inside a VPlan.

Reviewed By: Ayal

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

3 years ago[mlir] Use thread_local stack in LLVM dialect type parsing and printing
Alex Zinenko [Tue, 5 Jan 2021 16:01:41 +0000 (17:01 +0100)]
[mlir] Use thread_local stack in LLVM dialect type parsing and printing

LLVM dialect type parsing and printing have been using a local stack object
forwarded between recursive functions responsible for parsing or printing
specific types. This stack is necessary to intercept (mutually) recursive
structure types and avoid inifinite recursion. This approach works only thanks
to the closedness of the LLVM dialect type system: types that don't belong to
the dialect are not allowed. Switch the approach to using a `thread_local`
stack inside the functions parsing the structure types. This makes the code
slightly cleaner by avoiding the need to pass the stack object around and, more
importantly, makes it possible to reconsider the closedness of the LLVM dialect
type system. As a nice side effect of this change, container LLVM dialect types
now support type aliases in their body (although it is currently impossible to
also use the alises when printing).

Depends On D93713

Reviewed By: mehdi_amini

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

3 years ago[RISCV][NFC] Add new test cases for mul
Ben Shi [Wed, 6 Jan 2021 10:55:56 +0000 (18:55 +0800)]
[RISCV][NFC] Add new test cases for mul

3 years ago[ARM] Handle any extend whilst lowering mull
David Green [Wed, 6 Jan 2021 10:51:12 +0000 (10:51 +0000)]
[ARM] Handle any extend whilst lowering mull

Similar to 78d8a821e23e but for ARM, this handles any_extend whilst
creating MULL nodes, treating them as zextends.

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

3 years ago[VPlan] Use public VPValue constructor in VPPRedInstPHIRecipe (NFC).
Florian Hahn [Wed, 6 Jan 2021 10:23:40 +0000 (10:23 +0000)]
[VPlan] Use public VPValue constructor in VPPRedInstPHIRecipe (NFC).

VPPredInstPHIRecipe does not need access to VPValue via friendship. It
can just use the public constructor,

Discussed as part of D92281.

3 years agoFix test failure in a7e3339f3b0eb71e43d44e6f59cc8db6a7b110bf
Sander de Smalen [Wed, 6 Jan 2021 10:42:05 +0000 (10:42 +0000)]
Fix test failure in a7e3339f3b0eb71e43d44e6f59cc8db6a7b110bf

Set the target-triple to aarch64 in debug-info-sve-dbg-value.mir
to avoid "'+sve' is not a recognized feature for this target"
diagnostic.

3 years ago[flang][driver] Update error messages (nfc)
Andrzej Warzynski [Wed, 6 Jan 2021 10:35:00 +0000 (10:35 +0000)]
[flang][driver] Update error messages (nfc)

As per Flang's coding guidelines
(flang/docs/C++style.md#error-messages):
```
Messages should start with a capital letter.
```

This patch updates error messages in the driver (new and old) so that
they conform with the guideline above.

This change was suggested in one of the recent reviews:
https://reviews.llvm.org/D93712. It felt like this deserved a dedicated
patch, so sending it separately.

3 years ago[AArch64] Handle any extend whilst lowering addw/addl/subw/subl
David Green [Wed, 6 Jan 2021 10:35:23 +0000 (10:35 +0000)]
[AArch64] Handle any extend whilst lowering addw/addl/subw/subl

This adds an extra tablegen PatFrag, zanyext, which matches either any
extend or zext and uses that in the aarch64 backend to handle any
extends in addw/addl/subw/subl patterns.

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

3 years agoRevert "[sanitizer] Define SANITIZER_GLIBC to refine SANITIZER_LINUX feature detectio...
Oliver Stannard [Wed, 6 Jan 2021 10:31:59 +0000 (10:31 +0000)]
Revert "[sanitizer] Define SANITIZER_GLIBC to refine SANITIZER_LINUX feature detection and support musl"

This reverts commit b7718b617557aa9827f994a16267537236634095, because it
is causing build failures on all 32-bit ARM bots which build
compiler-rt.

3 years ago[flang][driver] Add checks for errors from `Prescan` and `Parse`
Andrzej Warzynski [Wed, 6 Jan 2021 09:54:30 +0000 (09:54 +0000)]
[flang][driver] Add checks for errors from `Prescan` and `Parse`

If either `Prescan` or `Parse` generate any fatal errors, the new driver
will:
  * report it (i.e. issue an error diagnostic)
  * exit early
  * return non-zero exit code
This behaviour is consistent with f18 (i.e. the old driver).

Reviewed By: sameeranjoshi

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

3 years ago[AArch64] Handle any extend whilst lowering mull
David Green [Wed, 6 Jan 2021 10:08:43 +0000 (10:08 +0000)]
[AArch64] Handle any extend whilst lowering mull

Demanded bits may turn a sext or zext into an anyext if the top bits are
not needed. This currently prevents the lowering to instructions like
mull, addl and addw. This patch fixes the mull generation by keeping it
simple and treating them like zextends.

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

3 years ago[AArch64][SVE] Emit DWARF location expression for SVE stack objects.
Sander de Smalen [Wed, 6 Jan 2021 09:37:57 +0000 (09:37 +0000)]
[AArch64][SVE] Emit DWARF location expression for SVE stack objects.

Extend PEI to emit a DWARF expression for StackOffsets that have
a fixed and scalable component. This means the expression that needs
to be added is either:
  <base> + offset
or:
  <base> + offset + scalable_offset * scalereg

where for SVE, the scale reg is the Vector Granule Dwarf register, which
encodes the number of 64bit 'granules' in an SVE vector and which
the debugger can evaluate at runtime.

Reviewed By: jmorse

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

3 years ago[AArch64] Use faddp to implement fadd reductions.
Sander de Smalen [Tue, 5 Jan 2021 09:39:59 +0000 (09:39 +0000)]
[AArch64] Use faddp to implement fadd reductions.

Custom-expand legal VECREDUCE_FADD SDNodes
to benefit from pair-wise faddp instructions.

Reviewed By: dmgreen

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

3 years ago[MC][WebAssembly] Avoid recalculating indexes in -gsplit-dwarf mode
Sam Clegg [Mon, 21 Dec 2020 18:24:32 +0000 (10:24 -0800)]
[MC][WebAssembly] Avoid recalculating indexes in -gsplit-dwarf mode

Be consistent about asserting before setting WasmIndices.  Adding
these assertions revealed that we were duplicating a lot of work
and setting these indexed twice when running in DWO mode.

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

3 years ago[RISCV] Add vector integer mul/mulh/div/rem ISel patterns
Fraser Cormack [Mon, 4 Jan 2021 10:41:49 +0000 (10:41 +0000)]
[RISCV] Add vector integer mul/mulh/div/rem ISel patterns

There is no test coverage for the mulhs or mulhu patterns as I can't get
the DAGCombiner to generate them for scalable vectors. There are a few
places in that still need updating for that to work. I left the patterns
in regardless as they are correct.

Reviewed By: craig.topper

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

3 years ago[clangd][fuzzyFind] Do not show stale symbols in the result.
Aleksandr Platonov [Wed, 6 Jan 2021 07:07:12 +0000 (10:07 +0300)]
[clangd][fuzzyFind] Do not show stale symbols in the result.

This is follow up to D93393.
Without this patch `MergedIndex::fuzzyFind()` returns stale symbols from the static index even if these symbols were removed.

Reviewed By: sammccall

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

3 years ago[OpenMP][AMDGPU] Use AMDGPU_KERNEL calling convention for entry function
Pushpinder Singh [Mon, 4 Jan 2021 11:46:31 +0000 (06:46 -0500)]
[OpenMP][AMDGPU] Use AMDGPU_KERNEL calling convention for entry function

AMDGPU backend requires entry functions/kernels to have AMDGPU_KERNEL
calling convention for proper linking.

Reviewed By: JonChesterfield

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

3 years ago[libc] Add implementations of nextafter[f|l] functions.
Siva Chandra Reddy [Mon, 4 Jan 2021 06:33:48 +0000 (22:33 -0800)]
[libc] Add implementations of nextafter[f|l] functions.

A differential fuzzer for these functions has also been added.
Along the way, a small correction has been done to the normal/subnormal
limits of x86 long double values.

Reviewed By: lntue

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

3 years ago[libc] Add implementations of nearbyint[f|l].
Siva Chandra Reddy [Sat, 2 Jan 2021 05:19:31 +0000 (21:19 -0800)]
[libc] Add implementations of nearbyint[f|l].

The implementation is exactly the same as rint* as even rint does not
raise any floating point exceptions currently. [Note that the standards
do not specify that floating point exceptions must be raised - they
leave it up to the implementation to choose to raise FE_INEXACT when
rounding non-integral values.]

Reviewed By: lntue

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

3 years ago[llvm] Use llvm::lower_bound and llvm::upper_bound (NFC)
Kazu Hirata [Wed, 6 Jan 2021 05:15:59 +0000 (21:15 -0800)]
[llvm] Use llvm::lower_bound and llvm::upper_bound (NFC)

3 years ago[MachineSink] Construct SmallVector with iterator ranges (NFC)
Kazu Hirata [Wed, 6 Jan 2021 05:15:57 +0000 (21:15 -0800)]
[MachineSink] Construct SmallVector with iterator ranges (NFC)

3 years ago[tools] Use llvm::append_range (NFC)
Kazu Hirata [Wed, 6 Jan 2021 05:15:56 +0000 (21:15 -0800)]
[tools] Use llvm::append_range (NFC)

3 years ago[GlobalISel] Base implementation for sret demotion.
Christudasan Devadasan [Wed, 23 Dec 2020 06:52:36 +0000 (12:22 +0530)]
[GlobalISel] Base implementation for sret demotion.

If the return values can't be lowered to registers
SelectionDAG performs the sret demotion. This patch
contains the basic implementation for the same in
the GlobalISel pipeline.

Furthermore, targets should bring relevant changes
during lowerFormalArguments, lowerReturn and
lowerCall to make use of this feature.

Reviewed By: arsenm

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

3 years ago[NFC] Removed unused prefixes in CodeGen/AMDGPU
Mircea Trofin [Wed, 6 Jan 2021 03:24:37 +0000 (19:24 -0800)]
[NFC] Removed unused prefixes in CodeGen/AMDGPU

This covers the tests starting with h-k.

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

3 years ago[-Wcalled-once-parameter][NFC] Fix operator precedence warning
Yang Fan [Wed, 6 Jan 2021 03:49:34 +0000 (11:49 +0800)]
[-Wcalled-once-parameter][NFC] Fix operator precedence warning

3 years agoscudo: Update a comment to match the Linux kernel behavior. NFCI.
Peter Collingbourne [Wed, 6 Jan 2021 03:48:10 +0000 (19:48 -0800)]
scudo: Update a comment to match the Linux kernel behavior. NFCI.

3 years agoELF: Teach the linker about the 'B' augmentation string character.
Peter Collingbourne [Thu, 31 Dec 2020 06:11:45 +0000 (22:11 -0800)]
ELF: Teach the linker about the 'B' augmentation string character.

This character indicates that when return pointer authentication is
being used, the function signs the return address using the B key.

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

3 years ago[NFC] Removed unused prefixes in test/CodeGen/AMDGPU
Mircea Trofin [Tue, 5 Jan 2021 22:37:29 +0000 (14:37 -0800)]
[NFC] Removed unused prefixes in test/CodeGen/AMDGPU

More patches to follow. This covers the pertinent tests starting with e,
f, and g.

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

3 years ago[mlir] Print the correct tool name in mlirTranslateMain
Andrew Young [Tue, 5 Jan 2021 21:38:29 +0000 (13:38 -0800)]
[mlir] Print the correct tool name in mlirTranslateMain

    The passed in tool name is not used, causing the wrong tool name to be printed by the help text.

Reviewed By: mehdi_amini

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

3 years ago[Constant] Add containsPoisonElement
Juneyoung Lee [Tue, 5 Jan 2021 01:09:49 +0000 (10:09 +0900)]
[Constant] Add containsPoisonElement

This patch

- Adds containsPoisonElement that checks existence of poison in constant vector elements,
- Renames containsUndefElement to containsUndefOrPoisonElement to clarify its behavior & updates its uses properly

With this patch, isGuaranteedNotToBeUndefOrPoison's tests w.r.t constant vectors are added because its analysis is improved.

Thanks!

Reviewed By: nikic

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

3 years ago[X86] Update X86InstCombineIntrinsic to use CreateShuffleVector with one vector
Juneyoung Lee [Tue, 5 Jan 2021 04:37:53 +0000 (13:37 +0900)]
[X86] Update X86InstCombineIntrinsic to use CreateShuffleVector with one vector

This patch updates X86InstCombineIntrinsic.cpp to use the newly updated CreateShuffleVector.

The tests are updated because the updated CreateShuffleVector uses poison value for the second vector.
If I didn't miss something, the masks in the tests are choosing elements from the first vector only; therefore the tests are having equivalent behavior.

Reviewed By: RKSimon

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

3 years ago[SLP,LV] Use poison constant vector for shufflevector/initial insertelement
Juneyoung Lee [Tue, 5 Jan 2021 05:11:50 +0000 (14:11 +0900)]
[SLP,LV] Use poison constant vector for shufflevector/initial insertelement

This patch makes SLP and LV emit operations with initial vectors set to poison constant instead of undef.
This is a part of efforts for using poison vector instead of undef to represent "doesn't care" vector.
The goal is to make nice shufflevector optimizations valid that is currently incorrect due to the tricky interaction between undef and poison (see https://bugs.llvm.org/show_bug.cgi?id=44185 ).

Reviewed By: fhahn

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

3 years ago[mlir] Fix MathJax rendering in Affine doc
lewuathe [Wed, 6 Jan 2021 01:59:45 +0000 (01:59 +0000)]
[mlir] Fix MathJax rendering in Affine doc

MathJax is not properly imported in Affine doc. It causes the invalid rendering
of math formulas in the Affine doc page.

https://mlir.llvm.org/docs/Dialects/Affine/#affine-expressions

Importing MathJax code from CDN resolved the rendering issue as follows.

{F14942131}

Reviewed By: ftynse

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

3 years ago[Sema] Fix deleted function problem in implicitly movable test
Yang Fan [Mon, 4 Jan 2021 09:36:58 +0000 (17:36 +0800)]
[Sema] Fix deleted function problem in implicitly movable test

In implicitly movable test, a two-stage overload resolution is performed.
If the first overload resolution selects a deleted function, Clang directly
performs the second overload resolution, without checking whether the
deleted function matches the additional criteria.

This patch fixes the above problem.

Reviewed By: Quuxplusone

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

3 years agoSuppress GCC Wdangling-else warning on gtest macros
Reid Kleckner [Wed, 6 Jan 2021 01:32:56 +0000 (17:32 -0800)]
Suppress GCC Wdangling-else warning on gtest macros

See https://github.com/google/googletest/issues/1119

3 years ago[sanitizer][Darwin] Suppress -Wno-non-virtual-dtor warning
Julian Lettner [Wed, 6 Jan 2021 00:09:46 +0000 (16:09 -0800)]
[sanitizer][Darwin] Suppress -Wno-non-virtual-dtor warning

Suppress the warning:
```
'fake_shared_weak_count' has virtual functions but non-virtual destructor [-Wnon-virtual-dtor]
```

The warning has been recently enabled [1], but the associated cleanup
missed this instance in Darwin code [2].

[1] 9c31e12609e1935eb84a2497ac08a49e3139859a
[2] d48f2d7c02743571075bb7812bb4c9e634e51ed1

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

3 years agoMake DWARFUnit use the dwo_id from the DWARF5 CU header.
Jorge Gorbe Moya [Thu, 17 Dec 2020 05:35:16 +0000 (21:35 -0800)]
Make DWARFUnit use the dwo_id from the DWARF5 CU header.

In split DWARF v5 files, the DWO id is no longer in the DW_AT_GNU_dwo_id
attribute. It's in the CU header instead. This change makes lldb look in
both places.

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

3 years agoDebugInfo: Add support for always using ranges (rather than low/high pc) in DWARFv5
David Blaikie [Fri, 18 Dec 2020 04:51:20 +0000 (20:51 -0800)]
DebugInfo: Add support for always using ranges (rather than low/high pc) in DWARFv5

Given the ability provided by DWARFv5 rnglists to reuse addresses in the
address pool, it can be advantageous to object file size to use range
encodings even when the range could be described by a direct low/high
pc.

Add a flag to allow enabling this in DWARFv5 for the purpose of
experimentation/data gathering.

It might be that it makes sense to enable this functionality by default
for DWARFv5 + Split DWARF at least, where the tradeoff/desire to
optimize for .o file size is more explicit and .o bytes are higher
priority than .dwo bytes.

3 years agoReland D93848 "[sanitizer] Define SANITIZER_GLIBC to refine SANITIZER_LINUX feature...
Fangrui Song [Wed, 6 Jan 2021 00:18:43 +0000 (16:18 -0800)]
Reland D93848 "[sanitizer] Define SANITIZER_GLIBC to refine SANITIZER_LINUX feature detection and support musl""

Several `#if SANITIZER_LINUX && !SANITIZER_ANDROID` guards are replaced
with the more appropriate `#if SANITIZER_GLIBC` (the headers are glibc
extensions, not specific to Linux (i.e. if we ever support GNU/kFreeBSD
or Hurd, the guards may automatically work)).

Several `#if SANITIZER_LINUX && !SANITIZER_ANDROID` guards are refined
with `#if SANITIZER_GLIBC` (the definitions are available on Linux glibc,
but may not be available on other libc (e.g. musl) implementations).

This patch makes `ninja asan cfi msan stats tsan ubsan xray` build on a musl based Linux distribution (apk install musl-libintl)
Notes about disabled interceptors for musl:

* `SANITIZER_INTERCEPT_GLOB`: musl does not implement `GLOB_ALTDIRFUNC` (GNU extension)
* Some ioctl structs and functions operating on them.
* `SANITIZER_INTERCEPT___PRINTF_CHK`: `_FORTIFY_SOURCE` functions are GNU extension
* `SANITIZER_INTERCEPT___STRNDUP`: `dlsym(RTLD_NEXT, "__strndup")` errors so a diagnostic is formed. The diagnostic uses `write` which hasn't been intercepted => SIGSEGV
* `SANITIZER_INTERCEPT_*64`: the `_LARGEFILE64_SOURCE` functions are glibc specific. musl does something like `#define pread64 pread`
* Disabled `msg_iovlen msg_controllen cmsg_len` checks: musl is conforming while many implementations (Linux/FreeBSD/NetBSD/Solaris) are non-conforming. Since we pick the glibc definition, exclude the checks for musl (incompatible sizes but compatible offsets)

Pass through LIBCXX_HAS_MUSL_LIBC to make check-msan/check-tsan able to build libc++ (https://bugs.llvm.org/show_bug.cgi?id=48618).

Many sanitizer features are available now.

```
% ninja check-asan
(known issues:
* ASAN_OPTIONS=fast_unwind_on_malloc=0 odr-violations hangs
)
...
Testing Time: 53.69s
  Unsupported      : 185
  Passed           : 512
  Expectedly Failed:   1
  Failed           :  12

% ninja check-ubsan check-ubsan-minimal check-memprof # all passed

% ninja check-cfi
( all cross-dso/)
...
Testing Time: 8.68s
  Unsupported      : 264
  Passed           :  80
  Expectedly Failed:   8
  Failed           :  32

% ninja check-lsan
(With GetTls (D93972), 10 failures)
Testing Time: 4.09s
  Unsupported:  7
  Passed     : 65
  Failed     : 22

% ninja check-msan
(Many are due to functions not marked unsupported.)
Testing Time: 23.09s
  Unsupported      :   6
  Passed           : 764
  Expectedly Failed:   2
  Failed           :  58

% ninja check-tsan
Testing Time: 23.21s
  Unsupported      :  86
  Passed           : 295
  Expectedly Failed:   1
  Failed           :  25
```

Used `ASAN_OPTIONS=verbosity=2` to verify there is no unneeded interceptor.

Partly based on Jari Ronkainen's https://reviews.llvm.org/D63785#1921014

Reviewed By: vitalybuka

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

3 years ago[libomptarget] Allow calls to omp_target_memcpy with 0 size.
George Rokos [Wed, 6 Jan 2021 00:03:53 +0000 (16:03 -0800)]
[libomptarget] Allow calls to omp_target_memcpy with 0 size.

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

3 years ago[mlir] Fully specify removeAttr return type
Tres Popp [Tue, 5 Jan 2021 23:39:04 +0000 (00:39 +0100)]
[mlir] Fully specify removeAttr return type

This was added without full specification like other generated methods.
This then leads to other downstream dialects failing to compile the
generated code when they are not in the mlir namespace.

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

3 years agoAllow dependent alias template specializations in the preferred_name
Richard Smith [Tue, 5 Jan 2021 23:32:44 +0000 (15:32 -0800)]
Allow dependent alias template specializations in the preferred_name
attribute.

This was intended to work, but didn't match the checks because these
types are modeled as TemplateSpecializationTypes not TypedefTypes.

3 years ago[mlir][sparse] adjust output shape inference to new tensor abstraction
Aart Bik [Tue, 5 Jan 2021 21:29:28 +0000 (13:29 -0800)]
[mlir][sparse] adjust output shape inference to new tensor abstraction

Nicolas changed the tensor abstraction so that every output has
its own shape definition. This simplifies the "inference" that
was used in the sparse compiler.

Reviewed By: penpornk

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

3 years ago[SimplifyCFG] SimplifyEqualityComparisonWithOnlyPredecessor(): really don't delete...
Roman Lebedev [Tue, 5 Jan 2021 19:02:53 +0000 (22:02 +0300)]
[SimplifyCFG] SimplifyEqualityComparisonWithOnlyPredecessor(): really don't delete DomTree edges multiple times

3 years ago[NFC][SimplifyCFG] Add a test where SimplifyEqualityComparisonWithOnlyPredecessor...
Roman Lebedev [Tue, 5 Jan 2021 19:01:22 +0000 (22:01 +0300)]
[NFC][SimplifyCFG] Add a test where SimplifyEqualityComparisonWithOnlyPredecessor() deletes existing edge

3 years ago[SimplifyCFG] SwitchToLookupTable(): switch to non-permissive DomTree updates
Roman Lebedev [Tue, 5 Jan 2021 16:59:16 +0000 (19:59 +0300)]
[SimplifyCFG] SwitchToLookupTable(): switch to non-permissive DomTree updates

... which requires not deleting a DomTree edge that we just deleted.

3 years ago[NFC][SimplifyCFG] SwitchToLookupTable(): pull out SI->getParent() into a variable
Roman Lebedev [Tue, 5 Jan 2021 15:19:41 +0000 (18:19 +0300)]
[NFC][SimplifyCFG] SwitchToLookupTable(): pull out SI->getParent() into a variable

3 years ago[SimplifyCFG] FoldValueComparisonIntoPredecessors(): deal with each predecessor only...
Roman Lebedev [Tue, 5 Jan 2021 14:04:44 +0000 (17:04 +0300)]
[SimplifyCFG] FoldValueComparisonIntoPredecessors(): deal with each predecessor only once

If the predecessor is a switch, and BB is not the default destination,
multiple cases could have the same destination. and it doesn't
make sense to re-process the predecessor, because we won't make any changes,
once is enough.

I'm not sure this can be really tested, other than via the assertion
being added here, which fires without the fix.

3 years ago[SimplifyCFG] FoldValueComparisonIntoPredecessors(): switch to non-permissive DomTree...
Roman Lebedev [Tue, 5 Jan 2021 13:23:59 +0000 (16:23 +0300)]
[SimplifyCFG] FoldValueComparisonIntoPredecessors(): switch to non-permissive DomTree updates

... which requires not adding a DomTree edge that we just added.

3 years ago[SimplifyCFG] simplifyUnreachable(): fix handling of degenerate same-destination...
Roman Lebedev [Tue, 5 Jan 2021 11:49:54 +0000 (14:49 +0300)]
[SimplifyCFG] simplifyUnreachable(): fix handling of degenerate same-destination conditional branch

One would hope that it would have been already canonicalized into an
unconditional branch, but that isn't really guaranteed to happen
with SimplifyCFG's visitation order.

3 years ago[NFC][SimplifyCFG] Add a test with same-destination condidional branch
Roman Lebedev [Tue, 5 Jan 2021 11:57:07 +0000 (14:57 +0300)]
[NFC][SimplifyCFG] Add a test with same-destination condidional branch

Reported by Mikael Holmén as post-commit feedback on
https://reviews.llvm.org/rG2d07414ee5f74a09fb89723b4a9bb0818bdc2e18#968162

3 years ago[SimplifyCFG] simplifyUnreachable(): switch to non-permissive DomTree updates
Roman Lebedev [Tue, 5 Jan 2021 09:30:10 +0000 (12:30 +0300)]
[SimplifyCFG] simplifyUnreachable(): switch to non-permissive DomTree updates

... which requires not removing a DomTree edge if the switch's default
still points at that destination, because it can't be removed;
... and not processing the same predecessor more than once.

3 years agoAMDGPU: Annotate amdgpu.noclobber for global loads only
Changpeng Fang [Tue, 5 Jan 2021 22:47:19 +0000 (14:47 -0800)]
AMDGPU: Annotate amdgpu.noclobber for global loads only

Summary:
  This is to avoid unnecessary analysis since amdgpu.noclobber is only used for globals.

Reviewers:
  arsenm

Fixes:
   SWDEV-239161

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

3 years ago[SLP] reduce code for finding reduction costs; NFC
Sanjay Patel [Tue, 5 Jan 2021 22:23:24 +0000 (17:23 -0500)]
[SLP] reduce code for finding reduction costs; NFC

We can get both (vector/scalar) costs in a single switch
instead of sequentially.

3 years ago[NFC] Removed unused prefixes in test/CodeGen/AMDGPU
Mircea Trofin [Tue, 5 Jan 2021 22:15:20 +0000 (14:15 -0800)]
[NFC] Removed unused prefixes in test/CodeGen/AMDGPU

More patches to follow.

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

3 years ago[NFC] Removed unused prefixes in CodeGen/AMDGPU
Mircea Trofin [Tue, 5 Jan 2021 21:06:10 +0000 (13:06 -0800)]
[NFC] Removed unused prefixes in CodeGen/AMDGPU

This is part of the pertinent tests, more to follow in subsequent
patches.

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

3 years ago[ASTMatchers] Fix child traversal over range-for loops
Stephen Kelly [Sat, 26 Dec 2020 21:07:14 +0000 (21:07 +0000)]
[ASTMatchers] Fix child traversal over range-for loops

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

3 years ago[FuncAttrs] Infer noreturn
Arthur Eubanks [Wed, 30 Dec 2020 06:58:14 +0000 (22:58 -0800)]
[FuncAttrs] Infer noreturn

A function is noreturn if all blocks terminating with a ReturnInst
contain a call to a noreturn function. Skip looking at naked functions
since there may be asm that returns.

This can be further refined in the future by checking unreachable blocks
and taking into account recursion. It looks like the attributor pass
does this, but that is not yet enabled by default.

This seems to help with code size under the new PM since PruneEH does
not run under the new PM, missing opportunities to mark some functions
noreturn, which in turn doesn't allow simplifycfg to clean up dead code.
https://bugs.llvm.org/show_bug.cgi?id=46858.

Reviewed By: rnk

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

3 years agoscudo: Fix compilation for non-Linux aarch64
Roland McGrath [Tue, 5 Jan 2021 19:55:11 +0000 (11:55 -0800)]
scudo: Fix compilation for non-Linux aarch64

Linux-specific aarch64 code was deconditionalized in commit
dfa40840e0e2fa094c5d3f441affe0785cdc8d09.  This broke builds for
non-Linux aarch64 platforms.

Reviewed By: cryptoad

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