platform/upstream/llvm.git
4 years ago[Matrix] Add align info to some more loads/stores (NFC).
Florian Hahn [Tue, 16 Jun 2020 16:02:09 +0000 (17:02 +0100)]
[Matrix] Add align info to some more loads/stores (NFC).

Some tests were missing alignment info. Subsequent changes properly
preserve the set alignment. Set it properly beforehand, to avoid
unnecessary test changes.

4 years ago[lit] Improve consistency for showing result groups
Julian Lettner [Tue, 16 Jun 2020 19:15:16 +0000 (12:15 -0700)]
[lit] Improve consistency for showing result groups

Before this change we showed all result groups with a code that was not
explicitly hard-coded set.  This set missed the FLAKYPASS result code.

Let's generalize the code to always show failures and the additionally
requested result codes.

4 years agoDriver: Accept multiple --config options if filenames are the same
Tom Stellard [Tue, 16 Jun 2020 18:20:20 +0000 (11:20 -0700)]
Driver: Accept multiple --config options if filenames are the same

Summary:
We're trying to use the --config options to pass distro specific
options for Fedora via the CFLAGS variable.  However, some projects
end up using the CFLAGS variable multiple times in their command line,
which leads to an error when --config is used.

This patch resolves this issue by allowing more than one --config option
on the command line as long as the file names are the same.

Reviewers: sepavloff, hfinkel

Reviewed By: sepavloff

Subscribers: cfe-commits, llvm-commits

Tags: #clang

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

4 years ago[mlir] refactor Linalg LoopNestBuilder to use common infra
Alex Zinenko [Tue, 16 Jun 2020 12:22:54 +0000 (14:22 +0200)]
[mlir] refactor Linalg LoopNestBuilder to use common infra

Recent work has introduced support for constructing loops via `::build` with
callbacks that construct loop bodies using only the core OpBuilder. This is now
supported on all loop types that Linalg lowers to. Refactor LoopNestBuilder in
Linalg to rely on this functionality instead of using a custom EDSC-based
approach to creating loop nests.

The specialization targeting parallel loops is also simplified by factoring out
the recursive call into a separate static function and considering only two
alternatives: top-level loop is parallel or sequential.

This removes the last remaining in-tree use of edsc::LoopBuilder, which is now
deprecated and will be removed soon.

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

4 years ago[mlir] Introduce callback-based builders to SCF Parallel and Reduce ops
Alex Zinenko [Tue, 16 Jun 2020 12:22:49 +0000 (14:22 +0200)]
[mlir] Introduce callback-based builders to SCF Parallel and Reduce ops

Similarly to `scf::ForOp`, introduce additional `function_ref` arguments to
`::build` functions of SCF `ParallelOp` and `ReduceOp`. The provided functions
will be called to construct the body of the respective operations while
constructing the operation itself. Exercise them in LoopUtils.

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

4 years agoGlobalISel: Use early return and reduce indentation
Matt Arsenault [Tue, 16 Jun 2020 00:59:50 +0000 (20:59 -0400)]
GlobalISel: Use early return and reduce indentation

4 years ago[MLIR] Add documentation for generate-check-lines.py
Tim Shen [Tue, 16 Jun 2020 18:38:26 +0000 (11:38 -0700)]
[MLIR] Add documentation for generate-check-lines.py

4 years agoGlobalISel: Make special case handling clearer
Matt Arsenault [Tue, 16 Jun 2020 15:32:52 +0000 (11:32 -0400)]
GlobalISel: Make special case handling clearer

The special case here is really G_UNMERGE_VALUES, not G_EXTRACT. The
other opcodes can hardcode index 1 like G_EXTRACT.

4 years agoGlobalISel: Use Register
Matt Arsenault [Tue, 16 Jun 2020 15:32:16 +0000 (11:32 -0400)]
GlobalISel: Use Register

4 years ago[MLIR] Remove generated spaces at eof for generate-test-checks.py.
Tim Shen [Tue, 16 Jun 2020 18:28:36 +0000 (11:28 -0700)]
[MLIR] Remove generated spaces at eof for generate-test-checks.py.

4 years ago[MLIR] Rework generate-test-checks.py to attach CHECK lines to the source (test)...
Tim Shen [Tue, 16 Jun 2020 02:41:03 +0000 (19:41 -0700)]
[MLIR] Rework generate-test-checks.py to attach CHECK lines to the source (test) file.

Summary:
This patch adds --source flag to indicate the source file. Then it tries to find insert
points in the source file and insert corresponding checks at those places.

Example output from Tensorflow XLA:

// -----

// CHECK-LABEL:   func @main.3(
// CHECK-SAME:                 %[[VAL_0:.*]]: memref<2x2xf32> {xla_lhlo.params = 0 : index},
// CHECK-SAME:                 %[[VAL_1:.*]]: memref<16xi8> {xla_lhlo.alloc = 0 : index, xla_lhlo.liveout = true}) {
// CHECK:           %[[VAL_2:.*]] = constant 0 : index
// CHECK:           %[[VAL_3:.*]] = constant 0 : index
// CHECK:           %[[VAL_4:.*]] = std.view %[[VAL_1]]{{\[}}%[[VAL_3]]][] : memref<16xi8> to memref<2x2xf32>
// CHECK:           "xla_lhlo.tanh"(%[[VAL_0]], %[[VAL_4]]) : (memref<2x2xf32>, memref<2x2xf32>) -> ()
// CHECK:           return
// CHECK:         }
func @main(%value0: tensor<2x2xf32>) -> tensor<2x2xf32> {
  %res = "xla_hlo.tanh"(%value0) : (tensor<2x2xf32>) -> tensor<2x2xf32>
  return %res : tensor<2x2xf32>
}

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

4 years agoFix ubsan error in tblgen with signed left shift
Stanislav Mekhanoshin [Tue, 16 Jun 2020 17:21:09 +0000 (10:21 -0700)]
Fix ubsan error in tblgen with signed left shift

UBSAN complains when tblgen performs SHL of a negative
value.

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

4 years ago[TLI] Add four C++17 delete variants.
Hiroshi Yamauchi [Wed, 10 Jun 2020 21:06:25 +0000 (14:06 -0700)]
[TLI] Add four C++17 delete variants.

Summary:
delete(void*, unsigned int, align_val_t)
delete(void*, unsigned long, align_val_t)
delete[](void*, unsigned int, align_val_t)
delete[](void*, unsigned long, align_val_t)

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

4 years ago[AIX][compiler-rt] Pick the right form of COMPILER_RT_ALIAS for AIX
David Tenty [Tue, 16 Jun 2020 18:00:32 +0000 (14:00 -0400)]
[AIX][compiler-rt] Pick the right form of COMPILER_RT_ALIAS for AIX

Summary: we use the alias attribute, similar to what is done for ELF.

Reviewers: ZarkoCA, jasonliu, hubert.reinterpretcast, sfertile

Reviewed By: jasonliu

Subscribers: dberris, aheejin, mstorsjo, #sanitizers

Tags: #sanitizers

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

4 years ago[lldb/Python] Fix the infinitely looping Python prompt bug
Jonas Devlieghere [Tue, 16 Jun 2020 18:02:00 +0000 (11:02 -0700)]
[lldb/Python] Fix the infinitely looping Python prompt bug

Executing commands below will get you bombarded by a wall of Python
command prompts (>>> ).

$ echo 'foo' | ./bin/lldb -o script
$ cat /tmp/script
script
print("foo")
$ lldb --source /tmp/script

The issue is that our custom input reader doesn't handle EOF. According
to the Python documentation, file.readline always includes a trailing
newline character unless the file ends with an incomplete line. An empty
string signals EOF. This patch raises an EOFError when that happens.

[1] https://docs.python.org/2/library/stdtypes.html#file.readline

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

4 years ago[VectorCombine] scalarize compares with insertelement operand(s)
Sanjay Patel [Tue, 16 Jun 2020 17:30:40 +0000 (13:30 -0400)]
[VectorCombine] scalarize compares with insertelement operand(s)

Generalize scalarization (recently enhanced with D80885)
to allow compares as well as binops.
Similar to binops, we are avoiding scalarization of a loaded
value because that could avoid a register transfer in codegen.
This requires 1 extra predicate that I am aware of: we do not
want to scalarize the condition value of a vector select. That
might also invert a transform that we do in instcombine that
prefers a vector condition operand for a vector select.

I think this is the final step in solving PR37463:
https://bugs.llvm.org/show_bug.cgi?id=37463

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

4 years ago[libc++] Don't trigger unsigned conversion warnings in std::advance
Louis Dionne [Mon, 8 Jun 2020 20:16:01 +0000 (16:16 -0400)]
[libc++] Don't trigger unsigned conversion warnings in std::advance

The Standard documents the signature of std::advance as

    template <class Iter, class Distance>
    constexpr void advance(Iter& i, Distance n);

Furthermore, it does not appear to put any restriction on what the type
of Distance should be. While it is understood that it should usually
be std::iterator_traits::difference_type, I couldn't find any wording
that mandates that. Similarly, I couldn't find wording that forces the
distance to be a signed type.

This patch changes std::advance to accept any type in the second argument,
which appears to be what the Standard mandates. We then coerce it to the
iterator's difference type, but that's an implementation detail.

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

4 years ago[Clang] Skip adding begin source location for PragmaLoopHint'd loop when
Yuanfang Chen [Tue, 16 Jun 2020 17:13:44 +0000 (10:13 -0700)]
[Clang] Skip adding begin source location for PragmaLoopHint'd loop when
the range start is already set

The range start could be set already in some invalid cases. Fixes
PR46336.

4 years ago[AArch64][GlobalISel] Avoid creating redundant ubfx when selecting G_ZEXT
Jessica Paquette [Mon, 15 Jun 2020 23:32:01 +0000 (16:32 -0700)]
[AArch64][GlobalISel] Avoid creating redundant ubfx when selecting G_ZEXT

When selecting 32 b -> 64 b G_ZEXTs, we don't have to always emit the extend.

If the instruction feeding into the G_ZEXT implicitly zero extends the high
half of the register, we can just emit a SUBREG_TO_REG instead.

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

4 years ago[lldb/Test] Create dir if it doesn't yet exist in getReproducerArtifact
Jonas Devlieghere [Tue, 16 Jun 2020 16:39:57 +0000 (09:39 -0700)]
[lldb/Test] Create dir if it doesn't yet exist in getReproducerArtifact

The type test use this method to store the golden output. This currently
fails if the reproducer directory hasn't yet been created.

4 years ago[OPENMP][DOCS]Update status of the supported constrcuts, NFC.
Alexey Bataev [Tue, 16 Jun 2020 16:24:09 +0000 (12:24 -0400)]
[OPENMP][DOCS]Update status of the supported constrcuts, NFC.

4 years ago[Format] Add more proto enclosing function names
Sam McCall [Tue, 16 Jun 2020 16:05:01 +0000 (18:05 +0200)]
[Format] Add more proto enclosing function names

4 years ago[mlir][shape] Add a func to populate ShapeToShape patterns.
Alexander Belyaev [Tue, 16 Jun 2020 13:07:59 +0000 (15:07 +0200)]
[mlir][shape] Add a func to populate ShapeToShape patterns.

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

4 years ago[analyzer][MallocChecker] PR46253: Correctly recognize standard realloc
Kirstóf Umann [Fri, 12 Jun 2020 16:15:20 +0000 (18:15 +0200)]
[analyzer][MallocChecker] PR46253: Correctly recognize standard realloc

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

This is an obvious hack because realloc isn't any more affected than other
functions modeled by MallocChecker (or any user of CallDescription really),
but the nice solution will take some time to implement.

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

4 years ago[GlobalISel] Delete unused variable after r353432
Fangrui Song [Tue, 16 Jun 2020 15:32:09 +0000 (08:32 -0700)]
[GlobalISel] Delete unused variable after r353432

4 years agoFix debug line info when line markers are present inside macros.
Leandro Vaz [Thu, 21 May 2020 15:24:07 +0000 (16:24 +0100)]
Fix debug line info when line markers are present inside macros.

Compiling assembly files when newlines are reduced to line markers within a `.macro` context will generate wrong information in `.debug_line` section.
This patch fixes this issue by evaluating line markers within the macro scope but not when they are used and evaluated.

Reviewed By: probinson

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

4 years agoGlobalISel: Add a note to G_BITCAST documentation
Matt Arsenault [Sun, 7 Jun 2020 14:04:31 +0000 (10:04 -0400)]
GlobalISel: Add a note to G_BITCAST documentation

This is currently different from the IR rules.

4 years agoGlobalISel: Make LLT constructors constexpr
Matt Arsenault [Sun, 7 Jun 2020 00:27:02 +0000 (20:27 -0400)]
GlobalISel: Make LLT constructors constexpr

4 years ago[OpenMP][OMPT] Add callbacks for doacross loops
Joachim Protze [Mon, 15 Jun 2020 16:39:47 +0000 (18:39 +0200)]
[OpenMP][OMPT] Add callbacks for doacross loops

Adds the callbacks for ordered with source/sink dependencies.

The test for task dependencies changed, because callbach.h now actually prints
the passed dependencies and the test also checks for the address.

Reviewed by: hbae

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

4 years ago[mlir][Linalg] Retire C++ MatmulOp in favor of a linalg-ods-gen'd op.
Nicolas Vasilache [Tue, 16 Jun 2020 13:14:42 +0000 (09:14 -0400)]
[mlir][Linalg] Retire C++ MatmulOp in favor of a linalg-ods-gen'd op.

Summary:
This revision replaces MatmulOp, now that DRR rules have been dropped.
This revision also fixes minor parsing bugs and a plugs a few holes to get e2e paths working (e.g. library call emission).

During the replacement the i32 version had to be dropped because only the EDSC operators +, *, etc support type inference.

Deciding on a type-polymorphic behavior, and implementing it, is left for future work.

Reviewers: aartbik

Subscribers: mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, stephenneuendorffer, Joonsoo, grosul1, frgossen, Kayjukh, jurahul, msifontes

Tags: #mlir

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

4 years ago[Matrix] Specify missing alignment in tests (NFC).
Florian Hahn [Tue, 16 Jun 2020 14:24:39 +0000 (15:24 +0100)]
[Matrix] Specify missing alignment in tests (NFC).

Some tests were missing alignment info. Subsequent changes properly
preserve the set alignment. Set it properly beforehand, to avoid
unnecessary test changes.

It also updates cases where an alignment of 16 was specified, instead of
the vector element type alignment.

4 years ago[MLIR][NFC] Inline lambda to workaround gcc 9.1,9.2 bug
Kiran Chandramohan [Tue, 16 Jun 2020 14:26:25 +0000 (15:26 +0100)]
[MLIR][NFC] Inline lambda to workaround gcc 9.1,9.2 bug

gcc 9.1/9.2 has a bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90538)
which leads to an incorrect error when expanding parameter packs multiple
times in a lambda. Inlining this lambda to work around this issue.

Reviewed By: rriddle, CarolineConcatto

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

4 years ago[AArch64]: BFloat MatMul Intrinsics&CodeGen
Luke Geeson [Tue, 9 Jun 2020 18:44:33 +0000 (19:44 +0100)]
[AArch64]: BFloat MatMul Intrinsics&CodeGen

This patch upstreams support for BFloat Matrix Multiplication Intrinsics
and Code Generation from __bf16 to AArch64. This includes IR intrinsics. Unittests are
provided as needed. AArch32 Intrinsics + CodeGen will come after this
patch.

This patch is part of a series implementing the Bfloat16 extension of
the
Armv8.6-a architecture, as detailed here:

https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/arm-architecture-developments-armv8-6-a

The bfloat type, and its properties are specified in the Arm
Architecture
Reference Manual:

https://developer.arm.com/docs/ddi0487/latest/arm-architecture-reference-manual-armv8-for-armv8-a-architecture-profile

The following people contributed to this patch:

Luke Geeson
 - Momchil Velikov
 - Mikhail Maltsev
 - Luke Cheeseman

Reviewers: SjoerdMeijer, t.p.northover, sdesmalen, labrinea, miyuki,
stuij

Reviewed By: miyuki, stuij

Subscribers: kristof.beyls, hiraditya, danielkiss, cfe-commits,
llvm-commits, miyuki, chill, pbarrio, stuij

Tags: #clang, #llvm

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

Change-Id: I174f0fd0f600d04e3799b06a7da88973c6c0703f

4 years ago[AArch64]: BFloat Load/Store Intrinsics&CodeGen
Luke Geeson [Tue, 9 Jun 2020 13:51:03 +0000 (14:51 +0100)]
[AArch64]: BFloat Load/Store Intrinsics&CodeGen

This patch upstreams support for ld / st variants of BFloat intrinsics
in from __bf16 to AArch64. This includes IR intrinsics. Unittests are
provided as needed.

This patch is part of a series implementing the Bfloat16 extension of
the
Armv8.6-a architecture, as detailed here:

https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/arm-architecture-developments-armv8-6-a

The bfloat type, and its properties are specified in the Arm
Architecture
Reference Manual:

https://developer.arm.com/docs/ddi0487/latest/arm-architecture-reference-manual-armv8-for-armv8-a-architecture-profile

The following people contributed to this patch:

 - Luke Geeson
 - Momchil Velikov
 - Luke Cheeseman

Reviewers: fpetrogalli, SjoerdMeijer, sdesmalen, t.p.northover, stuij

Reviewed By: stuij

Subscribers: arsenm, pratlucas, simon_tatham, labrinea, kristof.beyls,
hiraditya, danielkiss, cfe-commits, llvm-commits, pbarrio, stuij

Tags: #clang, #llvm

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

Change-Id: I22e1dca2a8a9ec25d1e4f4b200cb50ea493d2575

4 years ago[clang][amdgpu] Prefer not using `fp16` conversion intrinsics.
Michael Liao [Tue, 2 Jun 2020 19:39:52 +0000 (15:39 -0400)]
[clang][amdgpu] Prefer not using `fp16` conversion intrinsics.

Reviewers: yaxunl, arsenm

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, dstuttard, tpr, t-tye, kerbowa, cfe-commits

Tags: #clang

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

4 years ago[analyzer] Fix StdLibraryFunctionsChecker crash on macOS
Valeriy Savchenko [Tue, 16 Jun 2020 09:02:11 +0000 (12:02 +0300)]
[analyzer] Fix StdLibraryFunctionsChecker crash on macOS

Summary:
EOF macro token coming from a PCH file on macOS while marked as literal,
doesn't contain any literal data.  This causes crash on every project
using PCHs.

This commit doesn't resolve the problem with PCH (maybe it was
designed like this for a purpose) or with `tryExpandAsInteger`, but
rather simply shoots off a crash itself.

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

4 years ago[clang-tidy] simplify-bool-expr ignores template instantiations
Nathan James [Tue, 16 Jun 2020 12:54:48 +0000 (13:54 +0100)]
[clang-tidy] simplify-bool-expr ignores template instantiations

Ignore template instantiations in the matchers, Addresses [[ https://bugs.llvm.org/show_bug.cgi?id=46226 | readability-simplify-boolean-expr false-positive for bool from template. ]]

Reviewed By: aaron.ballman, lebedev.ri

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

4 years ago[DebugInfo/DWARF] - Report .eh_frame sections of version != 1.
Georgii Rymar [Tue, 9 Jun 2020 13:58:21 +0000 (16:58 +0300)]
[DebugInfo/DWARF] - Report .eh_frame sections of version != 1.

Specification (https://refspecs.linuxbase.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/ehframechpt.html#AEN1349)
says that the value of Version field for .eh_frame should be 1.

Though we accept other values and might perform an attempt to read
it as a .debug_frame because of that, what is wrong.

This patch adds a version check.

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

4 years ago[llvm-readelf] - Do not omit a zero symbol value when printing relocations.
Georgii Rymar [Mon, 15 Jun 2020 12:18:29 +0000 (15:18 +0300)]
[llvm-readelf] - Do not omit a zero symbol value when printing relocations.

Previously we only printed a symbol value when it has a non-empty name
or non-zero value.

This patch changes the behavior. Now we only omit a symbols value when
a relocation does not reference a symbol (i.e. symbol index == 0).

Seems it is what GNU readelf does, looking on its output.

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

4 years ago[mlir][OpenMP] Add custom parser and pretty printer for parallel construct
David Truby [Fri, 5 Jun 2020 15:01:15 +0000 (16:01 +0100)]
[mlir][OpenMP] Add custom parser and pretty printer for parallel construct

Reviewers: jdoerfert

Subscribers: yaxunl, guansong, mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, stephenneuendorffer, Joonsoo, grosul1, frgossen, Kayjukh, jurahul, sstefan1, msifontes

Tags: #mlir

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

4 years agoRevert "[AssumeBundles] add cannonicalisation to the assume builder"
Tyker [Tue, 16 Jun 2020 12:34:31 +0000 (14:34 +0200)]
Revert "[AssumeBundles] add cannonicalisation to the assume builder"

This reverts commit 90c50cad1983c5e29107a78382dead0fe2a9562c.

4 years ago[llvm-readelf] - Do not crash when relocation references a STT_SECTION symbol for...
Georgii Rymar [Mon, 15 Jun 2020 11:54:46 +0000 (14:54 +0300)]
[llvm-readelf] - Do not crash when relocation references a STT_SECTION symbol for the null section.

Currently, llvm-readelf crashes when there is a STT_SECTION symbol for the null section
and this symbol is used in a relocation.

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

4 years ago[AVR] Remove faulty stack pushing behavior
Ayke van Laethem [Tue, 21 Apr 2020 12:17:21 +0000 (14:17 +0200)]
[AVR] Remove faulty stack pushing behavior

An instruction like this will need to allocate some stack space for the
last parameter:

  %x = call addrspace(1) i16 @bar(i64 undef, i64 undef, i16 undef, i16 0)

This worked fine when passing an actual value (in this case 0). However,
when passing undef, no value was pushed to the stack and therefore no
push instructions were created. This caused an unbalanced stack leading
to interesting results.

This commit fixes that by replacing the push logic with a regular stack
adjustment and stack-relative load/stores. This is less efficient but at
least it correctly compiles the code.

I can think of a few improvements in the future:

  * The stack should have been adjusted in the function prologue when
    there are no allocas in the function.
  * Many (if not most) stack adjustments can be replaced by
    pushing/popping the values directly. Exactly like the previous code
    attempted but didn't do correctly.
  * Small stack adjustments can be done more efficiently with a few
    push/pop instructions (pushing/popping bogus values), both for code
    size and for speed.

All in all, as long as there are no allocas in the function I think that
it is almost always more efficient to emit regular push/pop
instructions. This is however left for future optimizations.

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

4 years ago[AVR] Fix stack size in functions with a frame pointer
Ayke van Laethem [Tue, 21 Apr 2020 18:19:56 +0000 (20:19 +0200)]
[AVR] Fix stack size in functions with a frame pointer

This patch fixes a bug in stack save/restore code. Because the frame
pointer was saved/restored manually (not by marking it as clobbered) the
StackSize variable was not updated accordingly. Most code still worked,
but code that tried to load a parameter passed on the stack did not.

This commit fixes this by marking the frame pointer as a
callee-clobbered register. This will let it be saved without any effort
in prolog/epilog code and will make sure the correct address is
calculated for loading parameters that are passed on the stack.

This approach is used by most other targets (such as X86, AArch64 and
RISC-V).

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

4 years ago[mlir][shape] Fix the comment in ShapeToStandard.cpp.
Alexander Belyaev [Tue, 16 Jun 2020 11:49:54 +0000 (13:49 +0200)]
[mlir][shape] Fix the comment in ShapeToStandard.cpp.

4 years ago[LSan] Enable for SystemZ
Ilya Leoshkevich [Tue, 16 Jun 2020 11:45:07 +0000 (13:45 +0200)]
[LSan] Enable for SystemZ

Summary: Add runtime support, adjust the tests and enable LSan.

Reviewers: vitalybuka, eugenis, uweigand, jonpa

Reviewed By: uweigand

Subscribers: mgorny, cfe-commits, #sanitizers

Tags: #clang, #sanitizers

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

4 years ago[ARM] Fix crash trying to generate i1 immediates
David Green [Tue, 16 Jun 2020 09:14:07 +0000 (10:14 +0100)]
[ARM] Fix crash trying to generate i1 immediates

These code patterns attempt to call isVMOVModifiedImm on a splat of i1
values, leading to an unreachable being hit. I've guarded the call on a
more specific set of sizes, as i1 vectors are legal under MVE.

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

4 years ago[NFC][Attributor] Expose getOrCreateAAFor and lookupAAFor
sstefan1 [Tue, 16 Jun 2020 11:11:03 +0000 (13:11 +0200)]
[NFC][Attributor] Expose getOrCreateAAFor and lookupAAFor

We are starting to use the Attributor outside the Attributor itself and
we need these to be able to seed and querry AAs.

4 years agoFix comment typo - Uexpected -> Unexpected. NFC.
Simon Pilgrim [Tue, 16 Jun 2020 09:32:43 +0000 (10:32 +0100)]
Fix comment typo - Uexpected -> Unexpected. NFC.

4 years ago[AssumeBundles] add cannonicalisation to the assume builder
Tyker [Mon, 15 Jun 2020 08:57:17 +0000 (10:57 +0200)]
[AssumeBundles] add cannonicalisation to the assume builder

Summary:
this reduces significantly the number of assumes generated without aftecting too much
the information that is preserved. this improves the compile-time cost
of enable-knowledge-retention significantly.

Reviewers: jdoerfert, sstefan1

Reviewed By: jdoerfert

Subscribers: hiraditya, asbirlea, llvm-commits

Tags: #llvm

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

4 years ago[clangd] Fix readability-else-after-return 'Adding a note without main diagnostic...
njames93 [Tue, 16 Jun 2020 11:01:56 +0000 (12:01 +0100)]
[clangd] Fix readability-else-after-return 'Adding a note without main diagnostic' crash

Fix a crash in clangd caused by an (admittidly incorrect) Remark diagnositic being emitted from readability-else-after-return.
This crash doesn't occur in clang-tidy so there are no tests there for this.

Reviewed By: hokein

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

4 years agoSilence GCC 7 warning
Kristof Beyls [Tue, 16 Jun 2020 09:49:30 +0000 (10:49 +0100)]
Silence GCC 7 warning

GCC 7 was reporting "enumeral and non-enumeral type in conditional expression"
as a warning.
The code casts an instruction opcode enum to unsigned implicitly, in
line with intentions; so this commit silences the warning by making the
cast to unsigned explicit.

4 years ago[NFC][OpenMPOpt] Provide function-specific foreachUse.
sstefan1 [Tue, 16 Jun 2020 10:26:46 +0000 (12:26 +0200)]
[NFC][OpenMPOpt] Provide function-specific foreachUse.

4 years ago[ARM][NFC] Explicitly specify the fp16 value type in codegen patterns.
Alexandros Lamprineas [Tue, 16 Jun 2020 09:48:07 +0000 (10:48 +0100)]
[ARM][NFC] Explicitly specify the fp16 value type in codegen patterns.

We are planning to add the bf16 value type in the HPR register class
and this will make the codegen patterns ambiguous.

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

4 years ago[analyzer] SATest: Add option to specify projects to test
Valeriy Savchenko [Wed, 3 Jun 2020 15:04:31 +0000 (18:04 +0300)]
[analyzer] SATest: Add option to specify projects to test

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

4 years ago[analyzer] ProjectMap: Do not serialize fields with default values
Valeriy Savchenko [Wed, 3 Jun 2020 13:58:55 +0000 (16:58 +0300)]
[analyzer] ProjectMap: Do not serialize fields with default values

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

4 years ago[analyzer] SATest: Introduce a single entrypoint for regression scripts
Valeriy Savchenko [Wed, 3 Jun 2020 12:29:42 +0000 (15:29 +0300)]
[analyzer] SATest: Introduce a single entrypoint for regression scripts

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

4 years ago[analyzer] CmpRuns.py: Decouple main functionality from argparse
Valeriy Savchenko [Wed, 3 Jun 2020 09:29:41 +0000 (12:29 +0300)]
[analyzer] CmpRuns.py: Decouple main functionality from argparse

Summary:
It makes it much harder to use from other modules when one of the
parameters is an argparse Namespace.  This commit makes it easier
to use CmpRuns programmatically.

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

4 years ago[analyzer] SATestAdd.py: Parse arguments with argparse
Valeriy Savchenko [Tue, 2 Jun 2020 15:21:45 +0000 (18:21 +0300)]
[analyzer] SATestAdd.py: Parse arguments with argparse

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

4 years ago[analyzer] SATest: Add posibility to download source from git and zip
Valeriy Savchenko [Tue, 2 Jun 2020 14:46:50 +0000 (17:46 +0300)]
[analyzer] SATest: Add posibility to download source from git and zip

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

4 years ago[analyzer] SATest: Move from csv to json project maps
Valeriy Savchenko [Mon, 1 Jun 2020 14:15:38 +0000 (17:15 +0300)]
[analyzer] SATest: Move from csv to json project maps

Summary:
JSON format is a bit more verbose and easier to reason about
and extend.  For this reason, before extending SATestBuild
functionality it is better to refactor the part of how we
configure the whole system.

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

4 years ago[analyzer] CmpRuns.py: Fix error due to statistics differences
Valeriy Savchenko [Mon, 25 May 2020 14:24:28 +0000 (17:24 +0300)]
[analyzer] CmpRuns.py: Fix error due to statistics differences

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

4 years ago[analyzer] CmpRuns.py: Refactor and add type annotations. NFC.
Valeriy Savchenko [Mon, 25 May 2020 12:56:51 +0000 (15:56 +0300)]
[analyzer] CmpRuns.py: Refactor and add type annotations. NFC.

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

4 years ago[gn build] Port b7084d8ede1
LLVM GN Syncbot [Tue, 16 Jun 2020 10:13:47 +0000 (10:13 +0000)]
[gn build] Port b7084d8ede1

4 years ago[AST][RecoveryExpr] Fix a crash on a field decl with invalid type.
Haojian Wu [Tue, 16 Jun 2020 07:25:17 +0000 (09:25 +0200)]
[AST][RecoveryExpr] Fix a crash on a field decl with invalid type.

Summary:
The field decl (in the testcase) was still valid, which results in a
valid RecordDecl, it led to crash when performing struct layout,
and computing struct size etc.

Reviewers: sammccall

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[ELF] Fixing an issue in Elf_Note_Impl::getDescAsStringRef
Dineshkumar Bhaskaran [Tue, 16 Jun 2020 10:00:46 +0000 (10:00 +0000)]
[ELF] Fixing an issue in Elf_Note_Impl::getDescAsStringRef

Summary:
Fix in getDescAsStringRef to not use a reference to a
temporary type and added a testcase.

Reviewers: arsenm, saiislam, scott.linder

Reviewed By: scott.linder

Subscribers: wdng, mgorny, llvm-commits

Tags: #llvm

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

4 years agoRevert "[IR] Clean up dead instructions after simplifying a conditional branch"
Jay Foad [Tue, 16 Jun 2020 09:17:21 +0000 (10:17 +0100)]
Revert "[IR] Clean up dead instructions after simplifying a conditional branch"

This reverts commit 69bdfb075b293c4b3363f2dc0ac732ca03c3c9ca.

Reverting to investigate https://bugs.llvm.org/show_bug.cgi?id=46343

4 years ago[OpenMPOpt] initial tests for ICV tracking. Only nthreads is used.
sstefan1 [Tue, 16 Jun 2020 09:03:00 +0000 (11:03 +0200)]
[OpenMPOpt] initial tests for ICV tracking. Only nthreads is used.

Summary: Couple of tests to showcase what will be done and what to expect with ICV tracking.

Reviewers: jdoerfert, JonChesterfield

Subscribers: yaxunl, guansong, llvm-commits

Tags: #llvm

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

4 years ago[asan] Unpoison signal alternate stack.
Vitaly Buka [Tue, 16 Jun 2020 09:07:24 +0000 (02:07 -0700)]
[asan] Unpoison signal alternate stack.

Summary:
Before unwinding the stack, `__asan_handle_no_return` is supposed to
unpoison the entire stack - that is, remove the entries in the shadow
memory corresponding to stack (e.g. redzone markers around variables).
This does not work correctly if `__asan_handle_no_return` is called from
the alternate stack used in signal handlers, because the stack top is
read from a cache, which yields the default stack top instead of the
signal alternate stack top.

It is also possible to jump between the default stack and the signal
alternate stack. Therefore, __asan_handle_no_return needs to unpoison
both.

Reviewers: vitalybuka, kubamracek, kcc, eugenis

Reviewed By: vitalybuka

Subscribers: phosek, #sanitizers

Tags: #sanitizers

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

4 years ago[clang-tidy] For `run-clang-tidy.py` escape the paths that are used for analysis.
Andi-Bogdan Postelnicu [Tue, 16 Jun 2020 09:17:43 +0000 (12:17 +0300)]
[clang-tidy] For `run-clang-tidy.py` escape the paths that are used for analysis.
Some paths can have special chars like `file++c.cpp` in this case the regex will
fail if we don't escape it.

4 years ago[X86][SSE] combineVectorSizedSetCCEquality - remove unused AVX2 MOVMSK path. NFCI.
Simon Pilgrim [Mon, 15 Jun 2020 16:45:30 +0000 (17:45 +0100)]
[X86][SSE] combineVectorSizedSetCCEquality - remove unused AVX2 MOVMSK path. NFCI.

If PTEST is not available, then we're guaranteed to be performing a 128-bit vector comparison using MOVMSK(PCMPEQB(v16i8)).

4 years ago[clangd] Make sure working directory is set during preamble validation
Kadir Cetinkaya [Tue, 16 Jun 2020 09:02:08 +0000 (11:02 +0200)]
[clangd] Make sure working directory is set during preamble validation

4 years agoRevert "[mlir][Linalg] Retire C++ MatmulOp in favor of a linalg-ods-gen'd op."
Kirill Bobyrev [Tue, 16 Jun 2020 09:02:28 +0000 (11:02 +0200)]
Revert "[mlir][Linalg] Retire C++ MatmulOp in favor of a linalg-ods-gen'd op."

This reverts commit 8c6c49f293fc85e14d811d772bdc9a68464d67b4.

As discussed offline, this patch breaks internal builds and tests so I'm
reverting it for now.

4 years ago[gn build] (manualy) merge e2cc854
Hans Wennborg [Tue, 16 Jun 2020 08:49:19 +0000 (10:49 +0200)]
[gn build] (manualy) merge e2cc854

4 years ago[asan] Refactor stack unpoisoning.
Robert Schneider [Tue, 16 Jun 2020 08:39:47 +0000 (01:39 -0700)]
[asan] Refactor stack unpoisoning.

Summary: This adds a customization point to support unpoisoning of signal alternate stacks on POSIX.

Reviewers: vitalybuka

Reviewed By: vitalybuka

Subscribers: #sanitizers

Tags: #sanitizers

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

4 years ago[MC] Generate .debug_frame in the 64-bit DWARF format [7/7]
Igor Kudrin [Wed, 3 Jun 2020 09:52:02 +0000 (16:52 +0700)]
[MC] Generate .debug_frame in the 64-bit DWARF format [7/7]

Note that .eh_frame sections are generated in the 32-bit format even
when debug sections are 64-bit, for compatibility reasons. They use
relative references between entries, so they hardly benefit from the
64-bit format.

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

4 years ago[MC] Fix DWARF forms for 64-bit DWARFv3 files [6/7]
Igor Kudrin [Wed, 3 Jun 2020 09:51:07 +0000 (16:51 +0700)]
[MC] Fix DWARF forms for 64-bit DWARFv3 files [6/7]

DW_FORM_sec_offset was introduced in DWARFv4, so, for 64-bit DWARFv3,
DW_FORM_data8 should be used instead.

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

4 years ago[MC] Generate .debug_rnglists in the 64-bit DWARF format [5/7]
Igor Kudrin [Wed, 3 Jun 2020 09:51:51 +0000 (16:51 +0700)]
[MC] Generate .debug_rnglists in the 64-bit DWARF format [5/7]

In addition, the patch fixes referencing the section within
a compilation unit.

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

4 years ago[MC] Generate .debug_aranges in the 64-bit DWARF format [4/7]
Igor Kudrin [Wed, 3 Jun 2020 09:51:27 +0000 (16:51 +0700)]
[MC] Generate .debug_aranges in the 64-bit DWARF format [4/7]

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

4 years ago[MC] Generate a compilation unit in the 64-bit DWARF format [3/7]
Igor Kudrin [Wed, 3 Jun 2020 14:27:26 +0000 (21:27 +0700)]
[MC] Generate a compilation unit in the 64-bit DWARF format [3/7]

The patch enables producing DWARF64 compilation units and fixes
generating references to .debug_abbrev and .debug_line sections.
A similar change for .debug_ranges/.debug_rnglists will be added
in a forthcoming patch.

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

4 years ago[MC] Generate .debug_line in the 64-bit DWARF format [2/7]
Igor Kudrin [Wed, 3 Jun 2020 09:48:37 +0000 (16:48 +0700)]
[MC] Generate .debug_line in the 64-bit DWARF format [2/7]

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

4 years ago[MC] Add --dwarf64 to generate DWARF64 debug info [1/7]
Igor Kudrin [Wed, 3 Jun 2020 06:15:51 +0000 (13:15 +0700)]
[MC] Add --dwarf64 to generate DWARF64 debug info [1/7]

The patch adds an option `--dwarf64` to instruct a tool to generate
debug information in the 64-bit DWARF format. There is no real
implementation yet, only a few compatibility checks.

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

4 years ago[X86][SSE] MatchVectorAllZeroTest - handle OR vector reductions
Simon Pilgrim [Tue, 16 Jun 2020 08:42:11 +0000 (09:42 +0100)]
[X86][SSE] MatchVectorAllZeroTest - handle OR vector reductions

This patch extends MatchVectorAllZeroTest to handle OR vector reduction patterns where the result is compared against zero.

Fixes PR45378

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

4 years ago[X86][SSE] combineVectorSizedSetCCEquality - move single Subtarget.hasAVX() use into...
Simon Pilgrim [Mon, 15 Jun 2020 20:47:39 +0000 (21:47 +0100)]
[X86][SSE] combineVectorSizedSetCCEquality - move single Subtarget.hasAVX() use into condition. NFC.

We already have Subtarget.hasSSE2() and Subtarget.useAVX512Regs() in the condition - seems to be a legacy from when we had multiple uses.

4 years ago[MLIR] Fix memref region compute for 0-d memref accesses
Uday Bondhugula [Sat, 13 Jun 2020 19:20:26 +0000 (00:50 +0530)]
[MLIR] Fix memref region compute for 0-d memref accesses

Fix memref region compute for 0-d memref accesses in certain cases (when
there are loops surrounding such 0-d accesses).

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

4 years agoNFC: cleanup the "(void)" case trick since the assertion is wrapped in NDEBUG.
Haojian Wu [Tue, 16 Jun 2020 07:44:02 +0000 (09:44 +0200)]
NFC: cleanup the "(void)" case trick since the assertion is wrapped in NDEBUG.

4 years ago[CostModel] Unify getCFInstrCost
Sam Parker [Tue, 16 Jun 2020 07:33:28 +0000 (08:33 +0100)]
[CostModel] Unify getCFInstrCost

Have TTI::getInstructionThroughput call getUserCost for Br, Ret and
PHI. This now means that eveything in getInstructionThroughput is
handled by getUserCost.

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

4 years agoNFC: Inline unused variable
Kirill Bobyrev [Tue, 16 Jun 2020 06:29:52 +0000 (08:29 +0200)]
NFC: Inline unused variable

The variable was not used anywhere except assert and causes build
warnings in the optimized builds.

Clanup after 913bc312b5516f0c7113fe14ea90097587ac5ca5

4 years ago[lib][NFC] Split the floating point util functions into multiple files.
Siva Chandra Reddy [Tue, 16 Jun 2020 04:06:24 +0000 (21:06 -0700)]
[lib][NFC] Split the floating point util functions into multiple files.

The grouping now reflects the grouping on cppreference.com.

4 years ago[mlir][StandardDialect] Add some folding for operations in standard dialect.
MaheshRavishankar [Tue, 16 Jun 2020 05:28:43 +0000 (22:28 -0700)]
[mlir][StandardDialect] Add some folding for operations in standard dialect.

Add the following canonicalization
- and(x, 1) -> x
- subi(x, 0) -> x

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

4 years ago[MLIR] Modify HasParent trait to allow one of several op's as a parent
Rahul Joshi [Tue, 16 Jun 2020 04:50:48 +0000 (04:50 +0000)]
[MLIR] Modify HasParent trait to allow one of several op's as a parent

- Modify HasParent trait to allow one of several op's as a parent -
- Expose this trait in the ODS framework using the ParentOneOf<> trait.

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

4 years ago[lldb] Remove redundant access specifiers (NFC)
Jonas Devlieghere [Tue, 16 Jun 2020 04:34:12 +0000 (21:34 -0700)]
[lldb] Remove redundant access specifiers (NFC)

4 years ago[lldb/Lua] Fix override/virtual in ScriptInterpreterLua (NFC)
Jonas Devlieghere [Tue, 16 Jun 2020 04:15:35 +0000 (21:15 -0700)]
[lldb/Lua] Fix override/virtual in ScriptInterpreterLua (NFC)

4 years ago[lldb/Python] Various cleanups in ScriptInterpreterPython (NFC)
Jonas Devlieghere [Tue, 16 Jun 2020 04:06:13 +0000 (21:06 -0700)]
[lldb/Python] Various cleanups in ScriptInterpreterPython (NFC)

4 years ago[AArch64] Print the immediate operand for SPACE pseudo instruction
Fangrui Song [Tue, 16 Jun 2020 03:55:53 +0000 (20:55 -0700)]
[AArch64] Print the immediate operand for SPACE pseudo instruction

Reviewed By: dmgreen

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

4 years ago[AArch64][GlobalISel] Emit constant pool loads for 64 bit fp immediates.
Amara Emerson [Mon, 15 Jun 2020 23:14:47 +0000 (16:14 -0700)]
[AArch64][GlobalISel] Emit constant pool loads for 64 bit fp immediates.

Note: don't do this for integer 64 bit materialization to match SDAG.

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

4 years ago[lldb/Interpreter] Use std::make_shared<StreamString> (NFC)
Jonas Devlieghere [Tue, 16 Jun 2020 03:48:35 +0000 (20:48 -0700)]
[lldb/Interpreter] Use std::make_shared<StreamString> (NFC)

4 years ago[LLParser] Delete temp CallInst when error occurs
Qiu Chaofan [Tue, 16 Jun 2020 03:41:25 +0000 (11:41 +0800)]
[LLParser] Delete temp CallInst when error occurs

Only functions with floating-point return type accepts fast-math flags.
When adding such flags to function returning integer, we'll see a crash,
because there's still an undeleted value referencing the argument. This
patch manually removes the temporary instruction when error occurs.

Reviewed By: arsenm

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

4 years ago[llvm][TextAPI/MachO] clean up auto usages in tests, NFC
Cyndy Ishida [Tue, 16 Jun 2020 02:59:42 +0000 (19:59 -0700)]
[llvm][TextAPI/MachO] clean up auto usages in tests, NFC

4 years ago[ObjectYAML][DWARF] Implement the .debug_addr section.
Xing GUO [Tue, 16 Jun 2020 02:50:49 +0000 (10:50 +0800)]
[ObjectYAML][DWARF] Implement the .debug_addr section.

This patch implements the .debug_addr section.

Reviewed By: jhenderson, grimar

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