platform/upstream/llvm.git
3 years ago[clang][AVR] Improve avr-ld command line options
Ben Shi [Tue, 17 Nov 2020 15:28:41 +0000 (23:28 +0800)]
[clang][AVR] Improve avr-ld command line options

Reviewed By: dylanmckay

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

3 years ago[OPENMP]Fix PR48076: mapping of data member pointer.
Alexey Bataev [Mon, 16 Nov 2020 17:43:53 +0000 (09:43 -0800)]
[OPENMP]Fix PR48076: mapping of data member pointer.

If the data member pointer is mapped, the compiler tries to optimize the
mapping of such data by discarding explicit mapping flags and trying to
emit combined data instead. In some cases, this optimization is not
quite correctly implemented and it leads to a program crash at the
runtime. Instead, if the data member is mapped, just emit it as is and
do not emit combined mapping flags for it.

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

3 years ago[Matrix] Add inline assembly test case.
Florian Hahn [Tue, 17 Nov 2020 14:24:37 +0000 (14:24 +0000)]
[Matrix] Add inline assembly test case.

This patch adds a new test cases which uses a matrix value as memory
inline assembly argument. Currently the pointer element type does not
match the vector type.

3 years ago[SLP] Make SLPVectorizer to use `llvm.masked.gather` intrinsic
Anton Afanasyev [Fri, 30 Oct 2020 07:22:50 +0000 (10:22 +0300)]
[SLP] Make SLPVectorizer to use `llvm.masked.gather` intrinsic

For the scattered operands of load instructions it makes sense
to use gathering load intrinsic, which can lower to native instruction
for X86/AVX512 and ARM/SVE. This also enables building
vectorization tree with entries containing scattered operands.
The next step is to add scattered store.

Fixes PR47629 and PR47623

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

3 years ago[WebAssembly][MC] Remove useless overrides in MCWasmStreamer
Andy Wingo [Tue, 17 Nov 2020 15:09:30 +0000 (07:09 -0800)]
[WebAssembly][MC] Remove useless overrides in MCWasmStreamer

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

3 years ago[AArch64][SVE] Support implicit lax vector conversions for SVE types
Joe Ellis [Tue, 17 Nov 2020 14:34:31 +0000 (14:34 +0000)]
[AArch64][SVE] Support implicit lax vector conversions for SVE types

Lax vector conversions was behaving incorrectly for implicit casts
between scalable and fixed-length vector types. For example, this:

    #include <arm_sve.h>

    #define N __ARM_FEATURE_SVE_BITS
    #define FIXED_ATTR __attribute__((arm_sve_vector_bits(N)))

    typedef svfloat32_t fixed_float32_t FIXED_ATTR;

    void allowed_depending() {
      fixed_float32_t fs32;
      svfloat64_t s64;

      fs32 = s64;
    }

... would fail because the vectors have differing lane sizes. This patch
implements the correct behaviour for
-flax-vector-conversions={none,all,integer}. Specifically:

- -flax-vector-conversions=none prevents all lax vector conversions
  between scalable and fixed-sized vectors.
- -flax-vector-conversions=integer allows lax vector conversions between
  scalable and fixed-size vectors whose element types are integers.
- -flax-vector-conversions=all allows all lax vector conversions between
  scalable and fixed-size vectors (including those with floating point
  element types).

The implicit conversions are implemented as bitcasts.

Reviewed By: fpetrogalli

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

3 years ago[TableGen] Clean up Target .td include files
Paul C. Anagnostopoulos [Sat, 14 Nov 2020 18:06:58 +0000 (13:06 -0500)]
[TableGen] Clean up Target .td include files

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

3 years ago[MLIR] Fix up integration tests after b7382ed3fea08da27530a6d6d53f168fc704e4c4
Benjamin Kramer [Tue, 17 Nov 2020 14:42:45 +0000 (15:42 +0100)]
[MLIR] Fix up integration tests after b7382ed3fea08da27530a6d6d53f168fc704e4c4

3 years ago[flang][nfc] Add missing dependency in CMake
Andrzej Warzynski [Tue, 17 Nov 2020 14:32:39 +0000 (14:32 +0000)]
[flang][nfc] Add missing dependency in CMake

This missing dependency has been causing the Flang buildbots
(with BUILD_SHARED_LIBS set to ON) to fail:
  * http://lab.llvm.org:8011/#/builders/66/builds/542
  * http://lab.llvm.org:8011/#/builders/33/builds/764

This missing dependency was exposed by this change:
  * https://reviews.llvm.org/D91461
This change is fine - the root cause of the failing builds is the
missing dependency.

3 years ago[ConstraintElimination] Add support for And.
Florian Hahn [Wed, 5 Aug 2020 14:24:54 +0000 (15:24 +0100)]
[ConstraintElimination] Add support for And.

When processing conditional branches, if the condition is an AND of 2 compares
and the true successor only has the current block as predecessor, queue both
conditions for the true successor.

3 years ago[clang-tidy] Make clang-format and include-order-check coherent
Kadir Cetinkaya [Tue, 17 Nov 2020 09:28:52 +0000 (10:28 +0100)]
[clang-tidy] Make clang-format and include-order-check coherent

LLVM style puts both gtest and gmock to the end of the include list.
But llvm-include-order-check was only moving gtest headers to the end, resulting
in a false tidy-warning.

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

3 years agoUpdate 'note-candiate' functions to skip lambda-conversion-op-overloads
Erich Keane [Mon, 16 Nov 2020 23:26:22 +0000 (15:26 -0800)]
Update 'note-candiate' functions to skip lambda-conversion-op-overloads

In the wake of https://reviews.llvm.org/D89559, we discovered that a
couple of tests (the ones modified below to have additional triple
versions) would fail on Win32, for 1 of two reasons.  We seem to not
have a win32 buildbot anymore, so the triple is to make sure this
doesn't get broken in the future.

First, two of the three 'note-candidate' functions weren't appropriately
skipping the remaining conversion functions.

Second, in 1 situation (note surrogate candidates) we actually print the
type of the conversion operator.  The two tests that ran into that
needed updating to make sure it printed the proper one in the win32
case.

3 years agoReland [LoopVectorizer] NFCI: Calculate register usage based on TLI.getTypeLegalizati...
Sander de Smalen [Thu, 12 Nov 2020 12:33:36 +0000 (12:33 +0000)]
Reland [LoopVectorizer] NFCI: Calculate register usage based on TLI.getTypeLegalizationCost.

This relands https://reviews.llvm.org/D91059 and reverts commit
30fded75b48bcbc034120154a57a00c7f3d07e06.

GetRegUsage now returns 0 when Ty is not a valid vector element type.

3 years ago[VE] Implement JumpTable
Kazushi (Jam) Marukawa [Tue, 17 Nov 2020 13:38:49 +0000 (22:38 +0900)]
[VE] Implement JumpTable

Implement JumpTable to make BRIND work on VE.  Update an existing
br_jt regression test also.

Reviewed By: simoll

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

3 years ago[mlir][std] Canonicalize extract_element(tensor_cast).
Stephan Herhut [Tue, 17 Nov 2020 12:59:26 +0000 (13:59 +0100)]
[mlir][std] Canonicalize extract_element(tensor_cast).

Canonicalize extract_element(tensor_cast(v)) to just extract_element(v).

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

3 years ago[mlir][std] Fold dim(dynamic_tensor_from_elements, %cst)
Stephan Herhut [Tue, 17 Nov 2020 12:39:08 +0000 (13:39 +0100)]
[mlir][std] Fold dim(dynamic_tensor_from_elements, %cst)

The shape of the result of a dynamic_tensor_from_elements is defined via its
result type and operands. We already fold dim operations when they reference
one of the statically sized dimensions. Now, also fold dim on the dynamically
sized dimensions by picking the corresponding operand.

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

3 years ago[mlir][linalg] Allow tensor_to_memref in dependence analysis
Stephan Herhut [Tue, 17 Nov 2020 12:19:57 +0000 (13:19 +0100)]
[mlir][linalg] Allow tensor_to_memref in dependence analysis

This enables the use of fusion on buffers in partially lowered
programs.

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

3 years ago[VE] Correct getMnemonic
Kazushi (Jam) Marukawa [Tue, 17 Nov 2020 10:28:49 +0000 (19:28 +0900)]
[VE] Correct getMnemonic

https://reviews.llvm.org/D90039 breaks VE backend.  So, fix it.

Reviewed By: simoll

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

3 years ago[mlir] Allow for using interface class name in ODS interface definitions
Alex Zinenko [Sun, 15 Nov 2020 16:49:37 +0000 (17:49 +0100)]
[mlir] Allow for using interface class name in ODS interface definitions

It may be necessary for interface methods to process or return variables with
the interface class type, in particular for attribute and type interfaces that
can return modified attributes and types that implement the same interface.
However, the code generated by ODS in this case would not compile because the
signature (and the body if provided) appear in the definition of the Model
class and before the interface class, which derives from the Model. Change the ODS
interface method generator to emit only method declarations in the Model class
itself, and emit method definitions after the interface class. Mark as "inline"
since their definitions are still emitted in the header and are no longer
implicitly inline. Add a forward declaration of the interface class before the
Concept+Model classes to make the class name usable in declarations.

Reviewed By: rriddle

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

3 years ago[mlir] Fix Python tests after "module_terminator" migrated to ODS
Alex Zinenko [Tue, 17 Nov 2020 13:15:11 +0000 (14:15 +0100)]
[mlir] Fix Python tests after "module_terminator" migrated to ODS

The "module_terminator" op now has a custom syntax and therefore is
printed without quotes. Adapt Python tests to check for this syntax.

3 years ago[clang][NFC] Use SmallString instead of SmallVector<char
Nathan James [Tue, 17 Nov 2020 13:02:58 +0000 (13:02 +0000)]
[clang][NFC] Use SmallString instead of SmallVector<char

Simplifies code in some places and is more explicit about what is being used.
No additional includes were added here so no impact on compile time.

3 years ago[X86] vector-sext.ll - replace X32 check prefix with X86. NFC.
Simon Pilgrim [Tue, 17 Nov 2020 12:39:08 +0000 (12:39 +0000)]
[X86] vector-sext.ll - replace X32 check prefix with X86. NFC.

We typically use X32 for gnux32 triples

3 years ago[X86] insert-into-constant-vector.ll - replace X32 check prefix with X86. NFC.
Simon Pilgrim [Tue, 17 Nov 2020 12:37:59 +0000 (12:37 +0000)]
[X86] insert-into-constant-vector.ll - replace X32 check prefix with X86. NFC.

We typically use X32 for gnux32 triples

3 years ago[X86] avx-intel-ocl.ll - replace X32 check prefix with X86. NFC.
Simon Pilgrim [Tue, 17 Nov 2020 12:35:29 +0000 (12:35 +0000)]
[X86] avx-intel-ocl.ll - replace X32 check prefix with X86. NFC.

We typically use X32 for gnux32 triples

3 years ago[X86] 2011-10-19-widen_vselect.ll - replace X32 check prefix with X86. NFC.
Simon Pilgrim [Tue, 17 Nov 2020 12:34:10 +0000 (12:34 +0000)]
[X86] 2011-10-19-widen_vselect.ll - replace X32 check prefix with X86. NFC.

We typically use X32 for gnux32 triples

3 years ago[clang][driver] Fix definition/declaration argument name mismatches. NFCI.
Simon Pilgrim [Tue, 17 Nov 2020 12:22:33 +0000 (12:22 +0000)]
[clang][driver] Fix definition/declaration argument name mismatches. NFCI.

AddCXXStdlibLibArgs args were using the names for the clang equivalent methods.

Silences cppcheck warnings.

3 years ago[LLDB] Fix SVE reginfo for sequential offset in g packet
Muhammad Omair Javaid [Tue, 17 Nov 2020 12:15:38 +0000 (17:15 +0500)]
[LLDB] Fix SVE reginfo for sequential offset in g packet

This moves in the direction of our effort to synchronize register descriptions
between LLDB and GDB xml description. We want to able to send registers in a
way that their offset fields can be re-constructed based on register sizes
in the increasing order of register number.

In context to Arm64 SVE, FPCR and FPSR are same registers in FPU regset and
SVE regset. Previously FPSR/FPCR offset was set at the end of SVE data
because Linux ptrace data placed FPCR and FPSR at the end of SVE register set.

Considering interoperability with other stubs like QEMU and that g packets
should generate register data in increasing order of register numbers. We
have to move FPCR/FPSR offset up to its original location according to
register numbering scheme of ARM64 registers with SVE registers included.

Reviewed By: labath

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

3 years agoEscape command line arguments in backtraces
Luke Drummond [Wed, 4 Nov 2020 12:10:25 +0000 (12:10 +0000)]
Escape command line arguments in backtraces

A common routine is to have the compiler crash, and attempt to rerun the
cc1 command-line by copying and pasting the arguments printed by
`llvm::Support::PrettyStackProgram::print`. However, these arguments are
not quoted or escaped which means they must be manually edited before
working correctly. This patch ensures that shell-unfriendly characters
are C-escaped, and arguments with spaces are double-quoted reducing the
frustration of running cc1 inside a debugger.

As the quoting is C, this is "best effort for most shells", but should
be fine for at least bash, zsh, csh, and cmd.exe.

Reviewed by: jhenderson

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

3 years ago[LLDB] Update SVE Z reg info to remove invalidate regs
Muhammad Omair Javaid [Tue, 17 Nov 2020 12:11:42 +0000 (17:11 +0500)]
[LLDB] Update SVE Z reg info to remove invalidate regs

In our recent discussion we are aiming to make LLDB registers exchange minimum
possible information in qRegisterInfo or XMl register descriptions.
For SVE registers, Z registers are catagorized as primary registers and should
not have any infomration about any pseudo registers. All pseudo registers
should have the information on which primary register they belong to.
This patch removes invalidate_regs list from Z registers and will mitigate its
impact on SVE resize patch in a follow up update.

Reviewed By: labath

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

3 years ago[AsmPrinter] Use getMnemonic for instruction-mix remark.
Florian Hahn [Tue, 17 Nov 2020 11:53:01 +0000 (11:53 +0000)]
[AsmPrinter] Use getMnemonic for instruction-mix remark.

This patch uses the new `getMnemonic` helper from D90039
to display mnemonics instead of the internal opcodes.

The main motivation behind using the mnemonics is that they
are more user-friendly and more directly related to the assembly
the users will be presented.

Reviewed By: paquette

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

3 years ago[OpenCL] Stop opencl-c-base.h leaking extension enabling
Sven van Haastregt [Tue, 17 Nov 2020 12:07:40 +0000 (12:07 +0000)]
[OpenCL] Stop opencl-c-base.h leaking extension enabling

opencl-c.h disables all extensions at its end, but opencl-c-base.h
does not, and that causes any inclusion of only opencl-c-base.h to
leave some extensions (such as cl_khr_fp16) enabled.  This affects the
-fdeclare-opencl-builtins option for example.

This violates the OpenCL Extension Specification which specifies that
"The initial state of the compiler is as if the directive #pragma
OPENCL EXTENSION all : disable was issued".

Fix by disabling all extensions at the end of opencl-c-base.h and
enable extensions inside opencl.h which relied on opencl-c-base.h
enabling the cl_khr_fp16/64 extensions.

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

3 years ago[build] Fix dependencies of LLVMExegesis
Serge Guelton [Tue, 17 Nov 2020 11:15:02 +0000 (06:15 -0500)]
[build] Fix dependencies of LLVMExegesis

3 years ago[mlir] Add basic support for attributes in ODS-generated Python bindings
Alex Zinenko [Mon, 16 Nov 2020 15:17:03 +0000 (16:17 +0100)]
[mlir] Add basic support for attributes in ODS-generated Python bindings

In ODS, attributes of an operation can be provided as a part of the "arguments"
field, together with operands. Such attributes are accepted by the op builder
and have accessors generated.

Implement similar functionality for ODS-generated op-specific Python bindings:
the `__init__` method now accepts arguments together with operands, in the same
order as in the ODS `arguments` field; the instance properties are introduced
to OpView classes to access the attributes.

This initial implementation accepts and returns instances of the corresponding
attribute class, and not the underlying values since the mapping scheme of the
value types between C++, C and Python is not yet clear. Default-valued
attributes are not supported as that would require Python to be able to parse
C++ literals.

Since attributes in ODS are tightely related to the actual C++ type system,
provide a separate Tablegen file with the mapping between ODS storage type for
attributes (typically, the underlying C++ attribute class), and the
corresponding class name. So far, this might look unnecessary since all names
match exactly, but this is not necessarily the cases for non-standard,
out-of-tree attributes, which may also be placed in non-default namespaces or
Python modules. This also allows out-of-tree users to generate Python bindings
without having to modify the bindings generator itself. Storage type was
preferred over the Tablegen "def" of the attribute class because ODS
essentially encodes attribute _constraints_ rather than classes, e.g. there may
be many Tablegen "def"s in the ODS that correspond to the same attribute type
with additional constraints

The presence of the explicit mapping requires the change in the .td file
structure: instead of just calling the bindings generator directly on the main
ODS file of the dialect, it becomes necessary to create a new file that
includes the main ODS file of the dialect and provides the mapping for
attribute types. Arguably, this approach offers better separability of the
Python bindings in the build system as the main dialect no longer needs to know
that it is being processed by the bindings generator.

Reviewed By: stellaraccident

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

3 years ago[clang-tidy] Fix an abseil-redundant-strcat-calls crash on 0-parameter StrCat().
Haojian Wu [Tue, 17 Nov 2020 09:26:44 +0000 (10:26 +0100)]
[clang-tidy] Fix an abseil-redundant-strcat-calls crash on 0-parameter StrCat().

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

3 years ago[VE] Add vbrd intrinsic instructions
Kazushi (Jam) Marukawa [Sat, 14 Nov 2020 20:55:02 +0000 (05:55 +0900)]
[VE] Add vbrd intrinsic instructions

Add vbrd intrinsic instructions and a regression test.

Reviewed By: simoll

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

3 years ago[AVR] Optimize the 16-bit NEGW pseudo instruction
Ben Shi [Tue, 17 Nov 2020 09:51:58 +0000 (17:51 +0800)]
[AVR] Optimize the 16-bit NEGW pseudo instruction

Reviewed By: dylanmckay

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

3 years ago[AsmWriter] Factor out mnemonic generation to accessible getMnemonic.
Florian Hahn [Tue, 17 Nov 2020 09:38:17 +0000 (09:38 +0000)]
[AsmWriter] Factor out mnemonic generation to accessible getMnemonic.

This patch factors out the part of printInstruction that gets the
mnemonic string for a given MCInst. This is intended to be used
subsequently for the instruction-mix remarks to display the final
mnemonic (D90040).

Unfortunately making `getMnemonic` available to the AsmPrinter
seems to require making it virtual. Not sure if there's a way around
that with the current layering of the AsmPrinters.

Reviewed By: Paul-C-Anagnostopoulos

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

3 years ago[build] normalize components dependencies
serge-sans-paille [Fri, 13 Nov 2020 21:45:55 +0000 (22:45 +0100)]
[build] normalize components dependencies

Use LINK_COMPONENTS instead of explicit target_link_libraries for components.
This avoids redundancy and potential inconsistencies.

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

3 years ago[PowerPC] Add negated abs test using llvm.abs intrinsic. NFC.
Kai Luo [Tue, 17 Nov 2020 09:28:56 +0000 (09:28 +0000)]
[PowerPC] Add negated abs test using llvm.abs intrinsic. NFC.

3 years ago[clang-tidy] Verify the fixes in abseil-redundant-strcat-calls test, NFC
Haojian Wu [Tue, 17 Nov 2020 09:15:29 +0000 (10:15 +0100)]
[clang-tidy] Verify the fixes in abseil-redundant-strcat-calls test, NFC

3 years ago[mlir][NFC] Remove references to Module.h and Function.h
River Riddle [Tue, 17 Nov 2020 08:38:10 +0000 (00:38 -0800)]
[mlir][NFC] Remove references to Module.h and Function.h

These includes have been deprecated in favor of BuiltinDialect.h, which contains the definitions of ModuleOp and FuncOp.

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

3 years ago[mlir][IR] Use tablegen for the BuiltinDialect and operations
River Riddle [Tue, 17 Nov 2020 08:37:14 +0000 (00:37 -0800)]
[mlir][IR] Use tablegen for the BuiltinDialect and operations

This has been a long standing TODO, and cleans up a bit of IR/. This will also make it easier to move FuncOp out of IR/ at some point in the future. For now, Module.h and Function.h just forward BuiltinDialect.h. These files will be removed in a followup.

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

3 years ago[Driver] Quote executable in reports generated by -fproc-stat-report
Serge Pavlov [Tue, 17 Nov 2020 05:46:13 +0000 (12:46 +0700)]
[Driver] Quote executable in reports generated by -fproc-stat-report

The option -fproc-stat-report=<file> makes driver to generate child
process resource comsumption report. In the report executable name was
not quoted and it made parsing the report more difficult. With this
change the executable name is surrounded by quotation marks.

3 years ago[JumpThreading] Fix branch probabilities in DuplicateCondBranchOnPHIIntoPred()
Yevgeny Rouban [Tue, 17 Nov 2020 07:24:50 +0000 (14:24 +0700)]
[JumpThreading] Fix branch probabilities in DuplicateCondBranchOnPHIIntoPred()

When instructions are cloned from block BB to PredBB in the method
DuplicateCondBranchOnPHIIntoPred() number of successors of PredBB
changes from 1 to number of successors of BB. So we have to copy
branch probabilities from BB to PredBB.

Reviewed By: Kazu Hirata

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

3 years ago[Test] Add one more elaborate test with LCSSA users
Max Kazantsev [Tue, 17 Nov 2020 07:36:51 +0000 (14:36 +0700)]
[Test] Add one more elaborate test with LCSSA users

3 years ago[crashlog] Improve patch-crashlog.py script
Jonas Devlieghere [Tue, 17 Nov 2020 07:26:35 +0000 (23:26 -0800)]
[crashlog] Improve patch-crashlog.py script

Compute the real addresses and offsets for the json crashlog test.

3 years ago[NFC] Collect ext users into vector instead of finding them twice
Max Kazantsev [Tue, 17 Nov 2020 07:00:37 +0000 (14:00 +0700)]
[NFC] Collect ext users into vector instead of finding them twice

3 years ago[NPM] Add remaining test of -slsr
Ta-Wei Tu [Tue, 17 Nov 2020 06:40:44 +0000 (14:40 +0800)]
[NPM] Add remaining test of -slsr

Add RUN lines for NPM of -slsr tests that require -separate-const-offset-from-gep

Reviewed By: aeubanks

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

3 years ago[NFC] Add const qualifier to isEmpty()
Ta-Wei Tu [Tue, 17 Nov 2020 06:39:33 +0000 (14:39 +0800)]
[NFC] Add const qualifier to isEmpty()

Reviewed By: aeubanks

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

3 years ago[Transforms] Use pred_empty (NFC)
Kazu Hirata [Tue, 17 Nov 2020 06:09:14 +0000 (22:09 -0800)]
[Transforms] Use pred_empty (NFC)

3 years ago[Test] One more widening opportunity test
Max Kazantsev [Tue, 17 Nov 2020 05:52:08 +0000 (12:52 +0700)]
[Test] One more widening opportunity test

3 years ago[SanitizerCoverage] Use [&] for lambdas (NFC)
Kazu Hirata [Tue, 17 Nov 2020 05:45:21 +0000 (21:45 -0800)]
[SanitizerCoverage] Use [&] for lambdas (NFC)

3 years ago[NFC][PowerPC] Add testcase of constant-i64.
Esme-Yi [Tue, 17 Nov 2020 04:49:19 +0000 (04:49 +0000)]
[NFC][PowerPC] Add testcase of constant-i64.

3 years ago[Debugify] Skip debugifying on special/immutable passes
Arthur Eubanks [Mon, 16 Nov 2020 19:47:50 +0000 (11:47 -0800)]
[Debugify] Skip debugifying on special/immutable passes

With a function pass manager, it would insert debuginfo metadata before
getting to function passes while processing the pass manager, causing
debugify to skip while running the function passes.

Skip special passes + verifier + printing passes. Compared to the legacy
implementation of -debugify-each, this additionally skips verifier
passes. Probably no need to update the legacy version since it will be
obsolete soon.

This fixes 2 instcombine tests using -debugify-each under NPM.

Reviewed By: MaskRay

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

3 years agoFix python bindings tests after change in visibility requirement for symbol declarations
Mehdi Amini [Tue, 17 Nov 2020 04:08:35 +0000 (04:08 +0000)]
Fix python bindings tests after change in visibility requirement for symbol declarations

3 years agoELFAsmParser: Remove non-SHF_ALLOC or non-executable sections' line info/address...
Fangrui Song [Tue, 17 Nov 2020 04:02:25 +0000 (20:02 -0800)]
ELFAsmParser: Remove non-SHF_ALLOC or non-executable sections' line info/address ranges contribution for -g

I filed the issue https://sourceware.org/bugzilla/show_bug.cgi?id=26850 ,
which was acknowledged and fixed in GNU binutils 2.36

This patch adds the similar behavior to MC.

Reviewed By: #debug-info, dblaikie

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

3 years agoAdd const qualifier to Type's utility functions
Tei Jeong [Tue, 17 Nov 2020 03:56:04 +0000 (03:56 +0000)]
Add const qualifier to Type's utility functions

Reviewed By: rriddle

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

3 years ago[Polly] Add override qualifiers.
Michael Kruse [Tue, 17 Nov 2020 03:26:37 +0000 (21:26 -0600)]
[Polly] Add override qualifiers.

Silence compiler warnings that suggest to add override qualifiers.

3 years ago[CodeGen][X86] Remove some unused check-prefixes and regenerate tests.
Wang, Pengfei [Tue, 17 Nov 2020 02:17:07 +0000 (10:17 +0800)]
[CodeGen][X86] Remove some unused check-prefixes and regenerate tests.

3 years ago[ORC] Include config.h in RegisterEHFrames.cpp.
Lang Hames [Tue, 17 Nov 2020 03:10:53 +0000 (14:10 +1100)]
[ORC] Include config.h in RegisterEHFrames.cpp.

RegisterEHFrames.cpp needs access to the HAVE_REGISTER_FRAME /
HAVE_DEREGISTER_FRAME defines.

rdar://71458921

3 years ago[flang] Duplicate names for ac-implied-do variables erroneously cause errors
Peter Steinfeld [Mon, 16 Nov 2020 20:06:44 +0000 (12:06 -0800)]
[flang] Duplicate names for ac-implied-do variables erroneously cause errors

According to section 19.4, paragraph 5, the scope of an ac-implied-do variable
is the enclosing ac-implied-do.  But we were not creating new scopes upon
entry to an ac-implied-do.  This was causing error messages to be erroneously
emitted.

I fixed, the code, added a test to array-constr-values.f90, added the test
folding15.f90 and corrected the test symbol05.f90.

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

3 years ago[AMDGPU] Add option -munsafe-fp-atomics
Yaxun (Sam) Liu [Mon, 16 Nov 2020 15:58:48 +0000 (10:58 -0500)]
[AMDGPU] Add option -munsafe-fp-atomics

Add an option -munsafe-fp-atomics for AMDGPU target.

When enabled, clang adds function attribute "amdgpu-unsafe-fp-atomics"
to any functions for amdgpu target. This allows amdgpu backend to use
unsafe fp atomic instructions in these functions.

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

3 years ago[CodeGen] Apply 'nonnull' and 'dereferenceable(N)' to 'this' pointer
CJ Johnson [Mon, 16 Nov 2020 23:04:55 +0000 (15:04 -0800)]
[CodeGen] Apply 'nonnull' and 'dereferenceable(N)' to 'this' pointer
arguments.

* Adds 'nonnull' and 'dereferenceable(N)' to 'this' pointer arguments
* Gates 'nonnull' on -f(no-)delete-null-pointer-checks
* Introduces this-nonnull.cpp and microsoft-abi-this-nullable.cpp tests to
  explicitly test the behavior of this change
* Refactors hundreds of over-constrained clang tests to permit these
  attributes, where needed
* Updates Clang12 patch notes mentioning this change

Reviewed-by: rsmith, jdoerfert
Differential Revision: https://reviews.llvm.org/D17993

3 years agoFix flang MLIR unit test verification failures
Rahul Joshi [Tue, 17 Nov 2020 01:31:11 +0000 (17:31 -0800)]
Fix flang MLIR unit test verification failures

- Eliminate public function declarations in these tests

3 years agotest commit for new client
Philip Reames [Tue, 17 Nov 2020 01:26:24 +0000 (17:26 -0800)]
test commit for new client

3 years ago[Polly] Move SimplifyVisitor into polly namespace.
Michael Kruse [Tue, 17 Nov 2020 00:55:05 +0000 (18:55 -0600)]
[Polly] Move SimplifyVisitor into polly namespace.

Declarations in headers should not be in the anonymous
namespace. Compilers also warn about the use of
<anon namespace>::SimplifyVisitor as a public field in
polly::SimplifyPass and polly::SimplifyPrinterPass.

3 years ago[sanitizers-test]add definition for %device_rm on android so it stops complaining
Vy Nguyen [Mon, 16 Nov 2020 22:53:34 +0000 (17:53 -0500)]
[sanitizers-test]add definition for %device_rm on android so it stops complaining

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

3 years ago[MC][test] Strengthen dwarf-asm-multiple-sections.s by adding more CHECK lines
Fangrui Song [Tue, 17 Nov 2020 00:48:19 +0000 (16:48 -0800)]
[MC][test] Strengthen dwarf-asm-multiple-sections.s by adding more CHECK lines

And change DWARF-DL-4 to DWARF-DL-3 since DWARF v3/DWARF v4 have same
output and using DWARF-DL-3 makes it clear that the lowest standard
having the behavior is version 3.

3 years ago[MLIR] Extend Symbol verification to reject public symbol declarations.
Rahul Joshi [Fri, 13 Nov 2020 21:04:53 +0000 (13:04 -0800)]
[MLIR] Extend Symbol verification to reject public symbol declarations.

- Extend the Symbol interface with `isDeclaration` to identify operations that declare
  a symbol as opposed to define it.
- Extend verification to disallow public declarations as per the discussion in
   https://llvm.discourse.group/t/rfc-symbol-definition-declaration-x-visibility-checks/2140
- Adopt the new interface for `FuncOp` and fix test and code to not have/create public
  function declarations.

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

3 years agoAdd an optional argument for pattern rewriter max iteration count (NFC)
Lex Augusteijn [Mon, 16 Nov 2020 22:47:42 +0000 (22:47 +0000)]
Add an optional argument for pattern rewriter max iteration count (NFC)

Some rewriters take more iterations to converge, add a parameter to overwrite
the built-in maximum iteration count.

Fix PR48073.

Reviewed By: mehdi_amini

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

3 years agoRevert "Revert "[analyzer] NFC: Separate PathDiagnosticConsumer options from Analyzer...
Artem Dergachev [Tue, 10 Nov 2020 22:03:57 +0000 (14:03 -0800)]
Revert "Revert "[analyzer] NFC: Separate PathDiagnosticConsumer options from AnalyzerOptions.""

This reverts commit 10f1ca99b498347186ec74b01046ad292bde9a4c.

(cherry picked from commit c599fc738a70e482976c6cc0ea31bef561641279)

3 years ago[LoopFlatten] Disable IV widening
Sjoerd Meijer [Mon, 16 Nov 2020 22:30:52 +0000 (22:30 +0000)]
[LoopFlatten] Disable IV widening

Disable widening of the IV in LoopFlatten while I investigate an assertion
failures. Please note that the pass is also not yet enabled by default.

3 years ago[AArch64][GlobalISel] Fold G_XOR x, -1 into G_SELECT and select CSINV
Jessica Paquette [Fri, 13 Nov 2020 22:09:08 +0000 (14:09 -0800)]
[AArch64][GlobalISel] Fold G_XOR x, -1 into G_SELECT and select CSINV

When we see

```
xor = G_XOR xor_lhs, -1
select = G_SELECT cc, tval, xor
```

Fold this into

```
select = CSINV tval, xor_lhs, cc
```

Update select-select.mir to reflect the changes.

For now, only handle the case where the G_XOR is the false-value for the
G_SELECT. It may make more sense to handle the true-value case in post-legalizer
lowering.

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

3 years ago[clang-tidy] performance-unnecessary-copy-initialization: Check for const reference...
Felix Berger [Thu, 22 Oct 2020 18:38:38 +0000 (14:38 -0400)]
[clang-tidy] performance-unnecessary-copy-initialization: Check for const reference arguments that are replaced template parameter type.

This fixes false positive cases where a non-const reference is passed to a
std::function but interpreted as a const reference.

Fix the definition of the fake std::function added in the test to match
std::function and make the bug reproducible.

Reviewed-by: aaron.ballman
Differential Revision: https://reviews.llvm.org/D90042

3 years ago[InferAddrSpace] Teach to handle assumed address space.
Michael Liao [Sat, 7 Nov 2020 11:47:57 +0000 (06:47 -0500)]
[InferAddrSpace] Teach to handle assumed address space.

- In certain cases, a generic pointer could be assumed as a pointer to
  the global memory space or other spaces. With a dedicated target hook
  to query that address space from a given value, infer-address-space
  pass could infer and propagate that to all its users.

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

3 years ago[VE] Add lvm/svm intrinsic instructions
Kazushi (Jam) Marukawa [Sat, 14 Nov 2020 14:37:46 +0000 (23:37 +0900)]
[VE] Add lvm/svm intrinsic instructions

Add lvm/svm intrinsic instructions and a regression test.  Change
RegisterInfo to specify that VM0/VMP0 are constant and reserved
registers.  This modifies a vst regression test, so update it.
Also add pseudo instructions for VM512 register classes
and mechanism to expand them after register allocation.

Reviewed By: simoll

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

3 years ago[crashlog] Implement parser for JSON encoded crashlogs
Jonas Devlieghere [Mon, 16 Nov 2020 21:46:44 +0000 (13:46 -0800)]
[crashlog] Implement parser for JSON encoded crashlogs

Add a parser for JSON crashlogs. The CrashLogParser now defers to either
the JSONCrashLogParser or the TextCrashLogParser. It first tries to
interpret the input as JSON, and if that fails falling back to the
textual parser.

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

3 years ago[ConstraintElimination] Add support for Or.
Florian Hahn [Mon, 16 Nov 2020 21:44:13 +0000 (21:44 +0000)]
[ConstraintElimination] Add support for Or.

When processing conditional branches, if the condition is an OR of 2 compares
and the false successor only has the current block as predecessor, queue both
negated conditions for the false successor

3 years ago[LoopVec] Introduce an api for detecting uniform memory ops
Philip Reames [Mon, 16 Nov 2020 21:29:45 +0000 (13:29 -0800)]
[LoopVec] Introduce an api for detecting uniform memory ops

Split off D91398 at request of reviewer.

3 years ago[libc++] Move the GDB pretty printer tests to the DSL
Louis Dionne [Fri, 13 Nov 2020 16:24:20 +0000 (11:24 -0500)]
[libc++] Move the GDB pretty printer tests to the DSL

Also, enable them whenever we detect that gdb is available. Previously,
these tests would basically never run because they relied on a CMake
configuration option that defaulted to OFF.

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

3 years ago[scudo][standalone] Correct min/max region indices
Kostya Kortchinsky [Mon, 9 Nov 2020 23:14:49 +0000 (15:14 -0800)]
[scudo][standalone] Correct min/max region indices

The original code to keep track of the minimum and maximum indices
of allocated 32-bit primary regions was sketchy at best.

`MinRegionIndex` & `MaxRegionIndex` were shared between all size
classes, and could (theoretically) have been updated concurrently. This
didn't materialize anywhere I could see, but still it's not proper.

This changes those min/max indices by making them class specific rather
than global: classes are locked when growing, so there is no
concurrency there. This also allows to simplify some of the 32-bit
release code, that now doesn't have to go through all the regions to
get the proper min/max. Iterate and unmap will no longer have access to
the global min/max, but they aren't used as much so this is fine.

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

3 years ago[mlir] Add DecomposeCallGraphTypes pass.
Sean Silva [Fri, 6 Nov 2020 03:35:15 +0000 (19:35 -0800)]
[mlir] Add DecomposeCallGraphTypes pass.

This replaces the old type decomposition logic that was previously mixed
into bufferization, and makes it easily accessible.

This also deletes TestFinalizingBufferize, because after we remove the type
decomposition, it doesn't do anything that is not already provided by
func-bufferize.

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

3 years agolld/mach-o: Infer darwinnew from filename ld64.lld.darwinnew too
Nico Weber [Mon, 16 Nov 2020 20:23:02 +0000 (15:23 -0500)]
lld/mach-o: Infer darwinnew from filename ld64.lld.darwinnew too

`-flavor` is difficult to use through the clang driver since it
must be the first argument.

clang's `-fuse-ld=foo` looks for `ld64.foo` when targeting darwin,
so it's easiest if darwinnew accepts some `ld64.foo`. Let's go with
`ld64.lld.darwinnew`, so that `clang -fuse-ld=lld.darwinnew` does
the right thing (assuming a symlink with the name `ld64.ld.darwinnew
exists in the right place).

This is temporary until darwinnew replaces ld64.lld, and it only
exists to make testing the new lld port easier.

3 years ago[SCEV] Factor out part of wrap flag detection logic [NFC](try 2)
Philip Reames [Mon, 16 Nov 2020 18:51:31 +0000 (10:51 -0800)]
[SCEV] Factor out part of wrap flag detection logic [NFC](try 2)

This is a cut down version of 1ec6e1 which was reverted due to a compile time issue.  The key changes made from that patch: 1) only infer the flags needed along each path, 2) be careful to preserve order of checks, and 3) avoid computing NW flags at all since we need to prove the stronger property (does not cross 0) in the caller anyways.

Assuming this doesn't trip regressions, I'm going to try weakening (1).  My end objective is to move flag inference into addrec construction.  If I can't weaken (1) without compile time impact, I'll have a problem.

3 years ago[coro] Async coroutines: Make sure we can handle control flow in suspend point dispat...
Arnold Schwaighofer [Mon, 16 Nov 2020 15:51:20 +0000 (07:51 -0800)]
[coro] Async coroutines: Make sure we can handle control flow in suspend point dispatch function

Create a valid basic block with a terminator before we call
InlineFunction.

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

3 years ago[ConstraintElimination] Add complex test cases.
Florian Hahn [Mon, 16 Nov 2020 16:03:05 +0000 (16:03 +0000)]
[ConstraintElimination] Add complex test cases.

3 years agoRevert "[InstCombine] add multi-use demanded bits fold for add with low-bit mask"
Sanjay Patel [Mon, 16 Nov 2020 19:20:46 +0000 (14:20 -0500)]
Revert "[InstCombine] add multi-use demanded bits fold for add with low-bit mask"

This reverts commit e56103d25016c9ce4e98f652ac1a09379793ccf5.
There is a stage2 msan failure blamed on this commit:
http://lab.llvm.org:8011/#/builders/74/builds/888/steps/9/logs/stdio

3 years agoAnother speculative fix for lldb related to ConstexprSpecKind
Aaron Ballman [Mon, 16 Nov 2020 19:39:34 +0000 (14:39 -0500)]
Another speculative fix for lldb related to ConstexprSpecKind

3 years agoSpeculatively fix the lldb build
Aaron Ballman [Mon, 16 Nov 2020 19:23:04 +0000 (14:23 -0500)]
Speculatively fix the lldb build

Pick up the changes from 41b65f166b51760f77d0f9e465b3858f46e101f0.

3 years agoConvert ConstexprKind from Specifiers.h to a scoped enum; NFC
Thorsten [Mon, 16 Nov 2020 19:08:33 +0000 (14:08 -0500)]
Convert ConstexprKind from Specifiers.h to a scoped enum; NFC

3 years ago[dsymutil] Generalize handling of aliases external symbols
Jonas Devlieghere [Mon, 16 Nov 2020 19:02:40 +0000 (11:02 -0800)]
[dsymutil] Generalize handling of aliases external symbols

In f9fb9da36c34d2745b74dc30e6c26f7d3f48466c we fixed spurious warnings
caused by aliases to private extern symbols. This patch generalizes that
to regular external symbols as well.

3 years ago[AArch64][GlobalISel] Look through a G_ZEXT when trying to match shift-extended regis...
Amara Emerson [Sat, 14 Nov 2020 07:08:47 +0000 (23:08 -0800)]
[AArch64][GlobalISel] Look through a G_ZEXT when trying to match shift-extended register offsets.

The G_ZEXT in these cases seems to actually come from a combine that we do but
SelectionDAG doesn't. Looking through it allows us to match "uxtw #2" addressing
modes.

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

3 years ago[YAMLIO] Correctly diagnose empty alias/anchor
Scott Linder [Mon, 16 Nov 2020 18:41:25 +0000 (18:41 +0000)]
[YAMLIO] Correctly diagnose empty alias/anchor

The `Range` of an alias/anchor token includes the leading `&` or `*`,
but it is skipped while parsing the name. The check for an empty name
fails to account for the skipped leading character and so the error is
never hit.

Fix the off-by-one and add a couple regression tests.

Reviewed By: dexonsmith

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

3 years ago[RISCV] Add MC tests for the User Vector CSRs
Craig Topper [Mon, 16 Nov 2020 18:12:45 +0000 (10:12 -0800)]
[RISCV] Add MC tests for the User Vector CSRs

Make sure we can parse and print the user CSR names

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

3 years ago[libc++] Remove transitional #error message
Louis Dionne [Mon, 16 Nov 2020 18:35:14 +0000 (13:35 -0500)]
[libc++] Remove transitional #error message

It's been more than 4 years now, so anyone that was defining
_LIBCPP_TRIVIAL_PAIR_COPY_CTOR has had ample time to see that
error and fix their code.

3 years agoReland "[AsmPrinter] fix -disable-debug-info option"
Jameson Nash [Mon, 16 Nov 2020 17:34:43 +0000 (12:34 -0500)]
Reland "[AsmPrinter] fix -disable-debug-info option"

This reverts commit 105ed27ed80dd47a9d32e72bbdd2a776a3318f38, and
removes the offending line from the tests.

3 years ago[Flang][OpenMP] Add semantic checks for OpenMP Depend clause.
Praveen G [Mon, 16 Nov 2020 17:56:04 +0000 (12:56 -0500)]
[Flang][OpenMP] Add semantic checks for OpenMP Depend clause.

Add the semantic checks for the OpenMP 4.5 - 2.13.9 Depend clause.

1. List items in depend clause should not be zero length array sections.
2. A variable that is part of another variable like structure component
   should not be specified on a depend clause.

Test cases : omp-depend01.f90, omp-depend02.f90, omp-depend03.f90

Reviewed By: kiranchandramohan

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

3 years ago[RISCV] When matching SROIW, check all 64 bits of the OR mask
Craig Topper [Mon, 16 Nov 2020 17:22:42 +0000 (09:22 -0800)]
[RISCV] When matching SROIW, check all 64 bits of the OR mask

We need to make sure the upper 32 bits are all ones to ensure the result is properly sign extended. Previously we only checked the lower 32 bits of the mask. I've also added a check that the shift amount is less than 32. Without that the original code asserts inside maskLeadingOnes if the SROI check is removed or the SROIW pattern is checked first. I've refactored the code to use early outs to reduce nesting.

I've also updated SLOIW matching with the same changes, but I couldn't find a broken test case with the existing code.

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

3 years ago[SimplifyCFG] Respect optforfuzzing in NPM pass
Arthur Eubanks [Sat, 14 Nov 2020 02:34:34 +0000 (18:34 -0800)]
[SimplifyCFG] Respect optforfuzzing in NPM pass

Regression caused by refactoring in
cdd006eec9409923f9a56b9026ce2cb72e7b71dc.

See discussion in https://reviews.llvm.org/D89917.

Reviewed By: arsenm, morehouse

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

3 years ago[lldb] Skip TestCppKeywordsAsCIdentifiers on Windows
Raphael Isemann [Mon, 16 Nov 2020 17:41:00 +0000 (18:41 +0100)]
[lldb] Skip TestCppKeywordsAsCIdentifiers on Windows

Somehow static_assert is a keyword with C on Windows (maybe the Windows
default is C11?). Skipping the test for now.