Commit graph

357435 commits

Author SHA1 Message Date
Tim Shen 25b3806788 [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
2020-06-16 11:15:46 -07:00
Stanislav Mekhanoshin 3f0c9c1634 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
2020-06-16 11:15:09 -07:00
Hiroshi Yamauchi 6bc2b042f4 [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
2020-06-16 11:12:02 -07:00
David Tenty 8aef01eed4 [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
2020-06-16 14:10:40 -04:00
Jonas Devlieghere 4dd3dfe8e3 [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
2020-06-16 11:05:19 -07:00
Sanjay Patel ed67f5e7ab [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
2020-06-16 13:48:10 -04:00
Louis Dionne 12b01ab7fa [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
2020-06-16 13:47:47 -04:00
Yuanfang Chen 4676cf444e [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.
2020-06-16 10:19:36 -07:00
Jessica Paquette 7caa9caa80 [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
2020-06-16 09:50:47 -07:00
Jonas Devlieghere e4a84590e8 [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.
2020-06-16 09:46:48 -07:00
Alexey Bataev 993c43aea5 [OPENMP][DOCS]Update status of the supported constrcuts, NFC. 2020-06-16 12:25:08 -04:00
Sam McCall f1ef237df7
[Format] Add more proto enclosing function names 2020-06-16 18:05:01 +02:00
Alexander Belyaev 7a9258e9bb [mlir][shape] Add a func to populate ShapeToShape patterns.
Differential Revision: https://reviews.llvm.org/D81933
2020-06-16 17:52:34 +02:00
Kirstóf Umann 1614e35408 [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
2020-06-16 17:50:06 +02:00
Fangrui Song 4799fb63b5 [GlobalISel] Delete unused variable after r353432 2020-06-16 08:32:09 -07:00
Leandro Vaz 56262a74c3 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
2020-06-16 16:13:11 +01:00
Matt Arsenault 59ce6ffe2d GlobalISel: Add a note to G_BITCAST documentation
This is currently different from the IR rules.
2020-06-16 11:04:46 -04:00
Matt Arsenault 5a95be22d2 GlobalISel: Make LLT constructors constexpr 2020-06-16 11:04:46 -04:00
Joachim Protze cbea36903e [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
2020-06-16 16:53:40 +02:00
Nicolas Vasilache eae76faeea [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
2020-06-16 10:46:35 -04:00
Florian Hahn e02c964969 [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.
2020-06-16 15:37:35 +01:00
Kiran Chandramohan 6cd232056c [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
2020-06-16 15:31:06 +01:00
Luke Geeson 10b6567f49 [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
2020-06-16 15:23:30 +01:00
Luke Geeson 508a4764c0 [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
2020-06-16 15:23:30 +01:00
Michael Liao e830fa260d [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
2020-06-16 10:21:56 -04:00
Valeriy Savchenko 14b947f306 [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
2020-06-16 16:10:07 +03:00
Nathan James e1ba7241c3 [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
2020-06-16 13:54:48 +01:00
Georgii Rymar 66fb3c39cb [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
2020-06-16 15:46:26 +03:00
Georgii Rymar cdd7f24c3a [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
2020-06-16 15:43:16 +03:00
David Truby 245b299edc [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
2020-06-16 13:35:42 +01:00
Tyker d7deef1206 Revert "[AssumeBundles] add cannonicalisation to the assume builder"
This reverts commit 90c50cad19.
2020-06-16 14:34:55 +02:00
Georgii Rymar 3961438c78 [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
2020-06-16 15:01:24 +03:00
Ayke van Laethem 5aa8014ca8
[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
2020-06-16 13:53:32 +02:00
Ayke van Laethem 3ab1c97e35
[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
2020-06-16 13:53:32 +02:00
Alexander Belyaev 71c1080328 [mlir][shape] Fix the comment in ShapeToStandard.cpp. 2020-06-16 13:50:40 +02:00
Ilya Leoshkevich ccd8b7b103 [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
2020-06-16 13:45:29 +02:00
David Green f269bb7da0 [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
2020-06-16 12:27:24 +01:00
sstefan1 06a744afd3 [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.
2020-06-16 13:16:07 +02:00
Simon Pilgrim 9d11822f09 Fix comment typo - Uexpected -> Unexpected. NFC. 2020-06-16 12:14:51 +01:00
Tyker 90c50cad19 [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
2020-06-16 13:12:35 +02:00
njames93 740575dc23 [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
2020-06-16 12:01:56 +01:00
Kristof Beyls 503a26d8e4 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.
2020-06-16 11:42:52 +01:00
sstefan1 e099c7b64a [NFC][OpenMPOpt] Provide function-specific foreachUse. 2020-06-16 12:33:15 +02:00
Alexandros Lamprineas f6189da938 [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
2020-06-16 11:32:17 +01:00
Valeriy Savchenko 38b455e91a [analyzer] SATest: Add option to specify projects to test
Differential Revision: https://reviews.llvm.org/D81569
2020-06-16 13:30:01 +03:00
Valeriy Savchenko dc8a77de7d [analyzer] ProjectMap: Do not serialize fields with default values
Differential Revision: https://reviews.llvm.org/D81568
2020-06-16 13:30:01 +03:00
Valeriy Savchenko d9944da273 [analyzer] SATest: Introduce a single entrypoint for regression scripts
Differential Revision: https://reviews.llvm.org/D81567
2020-06-16 13:30:01 +03:00
Valeriy Savchenko 35dd0147cd [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
2020-06-16 13:30:01 +03:00
Valeriy Savchenko 4a7b3d406f [analyzer] SATestAdd.py: Parse arguments with argparse
Differential Revision: https://reviews.llvm.org/D81565
2020-06-16 13:30:00 +03:00
Valeriy Savchenko bbb8f17136 [analyzer] SATest: Add posibility to download source from git and zip
Differential Revision: https://reviews.llvm.org/D81564
2020-06-16 13:30:00 +03:00