platform/upstream/llvm.git
3 years ago[clangd] Add Random Forest runtime for code completion.
Utkarsh Saxena [Tue, 14 Jul 2020 21:12:45 +0000 (23:12 +0200)]
[clangd] Add Random Forest runtime for code completion.

Summary:
[WIP]
- Proposes a json format for representing Random Forest model.
- Proposes a way to test the generated runtime using a test model.

TODO:
- Add generated source code snippet for easier review.
- Fix unused label warning.
- Figure out required using declarations for CATEGORICAL columns from Features.json.
- Necessary Google3 internal modifications for blaze before landing.
- Add documentation for format of the model.
- Document more.

Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

3 years ago[mlir][shape] Extend shape.cstr_require with a message.
Sean Silva [Fri, 18 Sep 2020 01:16:41 +0000 (18:16 -0700)]
[mlir][shape] Extend shape.cstr_require with a message.

I realized when using this that one can't get very good error messages
without an additional message attribute.

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

3 years ago[clang-format] NFC ensure the clang-format tests remain clang-formatted
mydeveloperday [Fri, 18 Sep 2020 17:16:02 +0000 (18:16 +0100)]
[clang-format] NFC ensure the clang-format tests remain clang-formatted

3 years ago[clang-format] Add a option for the position of Java static import
mydeveloperday [Fri, 18 Sep 2020 17:11:33 +0000 (18:11 +0100)]
[clang-format] Add a option for the position of Java static import

 Some Java style guides and IDEs group Java static imports after
 non-static imports. This patch allows clang-format to control
 the location of static imports.

Patch by: @bc-lee

Reviewed By: MyDeveloperDay, JakeMerdichAMD

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

3 years ago[libomptarget] Disable build of amdgpu plugin as it doesn't build with rocm.
JonChesterfield [Fri, 18 Sep 2020 17:10:27 +0000 (18:10 +0100)]
[libomptarget] Disable build of amdgpu plugin as it doesn't build with rocm.

3 years ago[NFC][ScheduleDAG] Remove unused EntrySU SUnit
Francis Visoiu Mistrih [Thu, 17 Sep 2020 22:41:01 +0000 (15:41 -0700)]
[NFC][ScheduleDAG] Remove unused EntrySU SUnit

EntrySU doesn't seem to be used at all when building the ScheduleDAG.

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

3 years agoUse one more byte to silence a warning from Vistual C++
Jianzhou Zhao [Fri, 18 Sep 2020 16:41:18 +0000 (16:41 +0000)]
Use one more byte to silence a warning from Vistual C++

3 years agoExtending Baremetal toolchain's support for the rtlib option.
Jon Roelofs [Fri, 18 Sep 2020 15:47:37 +0000 (08:47 -0700)]
Extending Baremetal toolchain's support for the rtlib option.

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

Patch by Manuel Carrasco!

3 years ago[MLIR][ODS] Add constBuilderCall for TypeArrayAttr
Andy Ly [Fri, 18 Sep 2020 15:18:12 +0000 (15:18 +0000)]
[MLIR][ODS] Add constBuilderCall for TypeArrayAttr

constBuilderCall was not defined for TypeArrayAttr, resulting in tblgen not emitting the correct code when TypeArrayAttr is used with a default valued attribute.

Reviewed By: antiagainst

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

3 years ago[X86][AVX] lowerBuildVectorAsBroadcast - improve i64 BROADCASTM lowering on 32-bit...
Simon Pilgrim [Fri, 18 Sep 2020 15:35:39 +0000 (16:35 +0100)]
[X86][AVX] lowerBuildVectorAsBroadcast - improve i64 BROADCASTM lowering on 32-bit targets

We already handle the the cases where we have a 'zero extended splat' build vector (a, 0, 0, 0, a, 0, 0, 0, ...) but were missing the case where the 'a' scalar was zero-extended as well - such as i64 -> vXi64 splat cases on 32-bit targets.

3 years ago[DFSan] Add strpbrk wrapper.
Matt Morehouse [Fri, 18 Sep 2020 15:47:31 +0000 (08:47 -0700)]
[DFSan] Add strpbrk wrapper.

Reviewed By: vitalybuka

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

3 years ago[MLIR][SPIRV] Create new ctx for deserialization in roundtrips.
ergawy [Fri, 18 Sep 2020 15:47:37 +0000 (11:47 -0400)]
[MLIR][SPIRV] Create new ctx for deserialization in roundtrips.

Roundtripping SPIR-V modules used the same MLIRContext object for both
ways of the trip. This resulted in deserialization using a context
object already containing Types constructed during serialization.
This commit rectifies that by creating a new MLIRContext during
deserialization.

Reviewed By: mravishankar, antiagainst

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

3 years ago[mlir][openacc] Add missing operands for acc.data operation
Valentin Clement [Fri, 18 Sep 2020 15:52:02 +0000 (11:52 -0400)]
[mlir][openacc] Add missing operands for acc.data operation

Add missing operands to represent copyin with readonly modifier, copyout with zero modifier
and create with zero modifier.

Reviewed By: ftynse

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

3 years ago[mlir][openacc] Support Index and AnyInteger in loop op
Valentin Clement [Fri, 18 Sep 2020 15:37:34 +0000 (11:37 -0400)]
[mlir][openacc] Support Index and AnyInteger in loop op

Following patch D87712, this patch switch AnyInteger for operands gangNum, gangStatic,
workerNum, vectoreLength and tileOperands to Index and AnyInteger.

Reviewed By: ftynse

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

3 years ago[X86][AVX] Add missing i686 broadcastm test coverage
Simon Pilgrim [Fri, 18 Sep 2020 15:10:09 +0000 (16:10 +0100)]
[X86][AVX] Add missing i686 broadcastm test coverage

3 years ago[DAG] BuildVectorSDNode::getSplatValue - pull out repeated getNumOperands() calls...
Simon Pilgrim [Fri, 18 Sep 2020 14:11:13 +0000 (15:11 +0100)]
[DAG] BuildVectorSDNode::getSplatValue - pull out repeated getNumOperands() calls. NFCI.

3 years ago[AIX] Enable large code model when building with clang
David Tenty [Thu, 30 Jul 2020 12:31:54 +0000 (08:31 -0400)]
[AIX] Enable large code model when building with clang

3 years ago[clangd] Add option for disabling AddUsing tweak on some namespaces.
Adam Czachorowski [Tue, 15 Sep 2020 17:47:50 +0000 (19:47 +0200)]
[clangd] Add option for disabling AddUsing tweak on some namespaces.

For style guides forbid "using" declarations for namespaces like "std".
With this new config option, AddUsing can be selectively disabled on
those.

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

3 years ago[mlir][StandardToSPIRV] Handle vector of i1 case for lowering zexti to SPIR-V.
Hanhan Wang [Fri, 18 Sep 2020 14:07:10 +0000 (07:07 -0700)]
[mlir][StandardToSPIRV] Handle vector of i1 case for lowering zexti to SPIR-V.

Reviewed By: mravishankar

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

3 years ago[InstSimplify] fix fmin/fmax miscompile for partial undef vectors (PR47567)
Sanjay Patel [Fri, 18 Sep 2020 13:53:06 +0000 (09:53 -0400)]
[InstSimplify] fix fmin/fmax miscompile for partial undef vectors (PR47567)

It would also be correct to return the variable operand in these cases,
but eliminating a variable use is probably better for optimization.

3 years agoIR: Move denormal mode parsing from MachineFunction to Function
Matt Arsenault [Thu, 17 Sep 2020 21:50:42 +0000 (17:50 -0400)]
IR: Move denormal mode parsing from MachineFunction to Function

This was just inspecting the IR to begin with, and is useful to check
in some places in the IR.

3 years agoemacs: Add nofree and willreturn to list of attributes
Matt Arsenault [Fri, 18 Sep 2020 13:28:57 +0000 (09:28 -0400)]
emacs: Add nofree and willreturn to list of attributes

3 years agoRevert "[amdgpu] Lower SGPR-to-VGPR copy in the final phase of ISel."
Matt Arsenault [Thu, 17 Sep 2020 16:07:59 +0000 (12:07 -0400)]
Revert "[amdgpu] Lower SGPR-to-VGPR copy in the final phase of ISel."

This reverts commit c3492a1aa1b98c8d81b0969d52cea7681f0624c2.

I think this is the wrong strategy and wrong place to do this
transform anyway. Also reverts follow up commit
7d593d0d6905b55ca1124fca5e4d1ebb17203138.

3 years ago[SLP] Allow reordering of vectorization trees with reused instructions.
Alexey Bataev [Thu, 17 Sep 2020 15:24:00 +0000 (11:24 -0400)]
[SLP] Allow reordering of vectorization trees with reused instructions.

If some leaves have the same instructions to be vectorized, we may
incorrectly evaluate the best order for the root node (it is built for the
vector of instructions without repeated instructions and, thus, has less
elements than the root node). In this case we just can not try to reorder
the tree + we may calculate the wrong number of nodes that requre the
same reordering.
For example, if the root node is \<a+b, a+c, a+d, f+e\>, then the leaves
are \<a, a, a, f\> and \<b, c, d, e\>. When we try to vectorize the first
leaf, it will be shrink to \<a, b\>. If instructions in this leaf should
be reordered, the best order will be \<1, 0\>. We need to extend this
order for the root node. For the root node this order should look like
\<3, 0, 1, 2\>. This patch allows extension of the orders of the nodes
with the reused instructions.

Reviewed By: RKSimon

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

3 years ago[AMDGPU] Set DS alignment requirements to be more strict
Mirko Brkusanin [Fri, 18 Sep 2020 13:19:54 +0000 (15:19 +0200)]
[AMDGPU] Set DS alignment requirements to be more strict

Alignment requirements for ds_read/write_b96/b128 for gfx9 and onward are
now the same as for other GCN subtargets. This way we can avoid any
unintentional use of these instructions on systems that do not support dword
alignment and instead require natural alignment.
This also makes 'SH_MEM_CONFIG.alignment_mode == STRICT' the default.

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

3 years ago[InstSimplify] add another test for NaN propagation; NFC
Sanjay Patel [Thu, 17 Sep 2020 21:20:17 +0000 (17:20 -0400)]
[InstSimplify] add another test for NaN propagation; NFC

3 years ago[libunwind] Support for leaf function unwinding.
Daniel Kiss [Wed, 16 Sep 2020 21:03:19 +0000 (23:03 +0200)]
[libunwind] Support for leaf function unwinding.

Unwinding leaf function is useful in cases when the backtrace finds a
leaf function for example when it caused a signal.
This patch also add the support for the DW_CFA_undefined because it marks
the end of the frames.

Ryan Prichard provided code for the tests.

Reviewed By: #libunwind, mstorsjo

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

Reland with limit the test to the x86_64-linux target.

3 years ago[DWARFYAML] Make the include_directories, file_names and opcodes fields of the line...
Xing GUO [Fri, 18 Sep 2020 12:20:58 +0000 (20:20 +0800)]
[DWARFYAML] Make the include_directories, file_names and opcodes fields of the line table optional.

This patch makes the include_directories, file_names and opcodes fields
of the line table optional. This helps us simplify some tests.

Reviewed By: jhenderson

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

3 years ago[DWARFYAML][test] Use 'CHECK-NEXT:' to make checkers stricter. NFC.
Xing GUO [Fri, 18 Sep 2020 12:18:48 +0000 (20:18 +0800)]
[DWARFYAML][test] Use 'CHECK-NEXT:' to make checkers stricter. NFC.

This patch makes checkers stricter so that we are able to avoid
some potential problems earlier.

Reviewed By: jhenderson, MaskRay

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

3 years ago[UpdateCCTestChecks] Include generated functions if asked
David Greene [Mon, 13 Jan 2020 18:16:35 +0000 (12:16 -0600)]
[UpdateCCTestChecks] Include generated functions if asked

Add the --include-generated-funcs option to update_cc_test_checks.py so that any
functions created by the compiler that don't exist in the source will also be
checked.

We need to maintain the output order of generated function checks so that
CHECK-LABEL works properly.  To do so, maintain a list of functions output for
each prefix in the order they are output.  Use this list to output checks for
generated functions in the proper order.

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

3 years ago[Test] Missing range check removal opportunity
Max Kazantsev [Fri, 18 Sep 2020 10:38:08 +0000 (17:38 +0700)]
[Test] Missing range check removal opportunity

3 years ago[Polly] Update map passed to SCEVParameterReweriter.
Florian Hahn [Fri, 18 Sep 2020 10:40:45 +0000 (11:40 +0100)]
[Polly] Update map passed to SCEVParameterReweriter.

The type of the map the SCEVParameterRewriter takes has been changed in
4635f6050b10.

Update the single use in polly to use SCEV* as type of the values.

3 years ago[mlir][Linalg] Evolve named ops to use assembly form and support linalg on tensors.
Nicolas Vasilache [Fri, 18 Sep 2020 10:13:25 +0000 (06:13 -0400)]
[mlir][Linalg] Evolve named ops to use assembly form and support linalg on tensors.

This revision allows representing a reduction at the level of linalg on tensors for named ops. When a structured op has a reduction and returns tensor(s), new conventions are added and documented.

As an illustration, the syntax for a `linalg.matmul` writing into a buffer is:

```
  linalg.matmul ins(%a, %b : memref<?x?xf32>, tensor<?x?xf32>)
               outs(%c : memref<?x?xf32>)
```

, whereas the syntax for a `linalg.matmul` returning a new tensor is:

```
  %d = linalg.matmul ins(%a, %b : tensor<?x?xf32>, memref<?x?xf32>)
                    init(%c : memref<?x?xf32>)
                      -> tensor<?x?xf32>
```

Other parts of linalg will be extended accordingly to allow mixed buffer/tensor semantics in the presence of reductions.

3 years agoRecommit "[DSE] Switch to MemorySSA-backed DSE by default."
Florian Hahn [Fri, 18 Sep 2020 07:54:09 +0000 (08:54 +0100)]
Recommit "[DSE] Switch to MemorySSA-backed DSE by default."

This switches to using DSE + MemorySSA by default again, after
fixing the issues reported after the first commit.

Notable fixes fc8200633122a0017c2bc258.

This reverts commit 3a59628f3cc26eb085acfc9cbdc97243ef71a6c5.

3 years agoRevert "[libunwind] Support for leaf function unwinding."
Daniel Kiss [Fri, 18 Sep 2020 09:37:54 +0000 (11:37 +0200)]
Revert "[libunwind] Support for leaf function unwinding."

This reverts commit 23bef7ee9923b1262326981960397e8cd95d6923.

3 years ago[SCEV] Generalize SCEVParameterRewriter to accept SCEV expression as target.
Florian Hahn [Fri, 18 Sep 2020 08:50:01 +0000 (09:50 +0100)]
[SCEV] Generalize SCEVParameterRewriter to accept SCEV expression as target.

This patch extends SCEVParameterRewriter to support rewriting unknown
epxressions to arbitrary SCEV expressions. It will be used by further
patches.

Reviewed By: reames

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

3 years ago[TableGen][GlobalISel] Fix handling of zero_reg
Gabriel Hjort Ã…kerlund [Fri, 18 Sep 2020 08:08:32 +0000 (10:08 +0200)]
[TableGen][GlobalISel] Fix handling of zero_reg

When generating matching tables for GlobalISel, TableGen would output
"::zero_reg" whenever encountering the zero_reg, which in turn would
result in compilation error. This patch fixes that by instead outputting
NoRegister (== 0), which is the same result that TableGen produces when
generating matching tables for ISelDAG.

Reviewed By: arsenm

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

3 years agoAArch64: make sure jump table entries can reach entire image
Tim Northover [Tue, 8 Sep 2020 10:08:25 +0000 (11:08 +0100)]
AArch64: make sure jump table entries can reach entire image

This turns all jump table entries into deltas within the target
function because in the small memory model all code & static data must
be in a 4GB block somewhere in memory.

When the entries were a delta between the table location and a basic
block, the 32-bit signed entries are not enough to guarantee
reachability.

https://reviews.llvm.org/D87286

3 years ago[NFC][gotsan] Fix 'format' error
Vitaly Buka [Fri, 18 Sep 2020 08:17:54 +0000 (01:17 -0700)]
[NFC][gotsan] Fix 'format' error

3 years ago[NFC][sanitizer] Disable a test on Windows
Vitaly Buka [Fri, 18 Sep 2020 08:09:16 +0000 (01:09 -0700)]
[NFC][sanitizer] Disable a test on Windows

3 years ago[sanitizer] Add facility to print the full StackDepot
Teresa Johnson [Wed, 16 Sep 2020 20:47:16 +0000 (13:47 -0700)]
[sanitizer] Add facility to print the full StackDepot

Split out of D87120 (memory profiler). Added unit testing of the new
printing facility.

Reviewed By: vitalybuka

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

3 years agoRevert "[InstCombine] Canonicalize SPF_ABS to abs intrinc"
Nikita Popov [Fri, 18 Sep 2020 07:27:56 +0000 (09:27 +0200)]
Revert "[InstCombine] Canonicalize SPF_ABS to abs intrinc"

This reverts commit 05d4c4ebc2fb006b8a2bd05b24c6aba10dd2eef8.

mstorsjo reports a miscompile after this change in
https://reviews.llvm.org/D87188#2281093. Reverting until I can
investigate this.

3 years ago[NFC][fuzzer] Simplify StrcmpTest.cpp
Vitaly Buka [Fri, 18 Sep 2020 07:17:18 +0000 (00:17 -0700)]
[NFC][fuzzer] Simplify StrcmpTest.cpp

The test started to consistently fail after unrelated
2ffaa9a1732c6f2af514603d25f0e8c238b3dd06.

Even before the patch it was possible to fail the test,
e.g. -seed=1660180256 on my workstation.

Also this checks do not look related to strcmp.

3 years ago[AArch64] Add tests for zext pattern match with AssertZext/AssertSext operand, NFC
Andrew Wei [Fri, 18 Sep 2020 06:59:51 +0000 (14:59 +0800)]
[AArch64] Add tests for zext pattern match with AssertZext/AssertSext operand, NFC

3 years ago[FPEnv] Use typed accessors in FPOptions
Serge Pavlov [Wed, 16 Sep 2020 16:27:46 +0000 (23:27 +0700)]
[FPEnv] Use typed accessors in FPOptions

Previously methods `FPOptions::get*` returned unsigned value even if the
corresponding property was represented by specific enumeration type. With
this change such methods return actual type of the property. It also
allows printing value of a property as text rather than integer code.

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

3 years agoRevert "This is a test commit"
Artur Bialas [Fri, 18 Sep 2020 06:43:53 +0000 (08:43 +0200)]
Revert "This is a test commit"

This reverts commit 9d54b166c2e59f29e476a6566951b6809fc8808e.

3 years agoThis is a test commit
Artur Bialas [Fri, 18 Sep 2020 06:43:18 +0000 (08:43 +0200)]
This is a test commit

3 years ago[X86] Add some demanded bits test cases for PDEP with constant mask
Craig Topper [Fri, 18 Sep 2020 05:37:29 +0000 (22:37 -0700)]
[X86] Add some demanded bits test cases for PDEP with constant mask

The number of ones in the mask for the PDEP determines how many
bits of the other operand are used. If the mask is constant we
can use this to build a mask for SimplifyDemandedBits. This can
be used to replace the extends in the test with anyextend.

3 years ago[AArch64] Emit zext move when the source of the zext is AssertZext or AssertSext
Andrew Wei [Fri, 18 Sep 2020 04:36:22 +0000 (12:36 +0800)]
[AArch64] Emit zext move when the source of the zext is AssertZext or AssertSext

When the source of the zext is AssertZext or AssertSext, it is hard to know any information about the upper 32 bits,
so we should insert a zext move before emitting SUBREG_TO_REG to define the lower 32 bits.

Reviewed By: efriedma

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

3 years agoRevert "[sanitizer] Add facility to print the full StackDepot"
Teresa Johnson [Fri, 18 Sep 2020 04:18:16 +0000 (21:18 -0700)]
Revert "[sanitizer] Add facility to print the full StackDepot"

This reverts commit 2ffaa9a1732c6f2af514603d25f0e8c238b3dd06.

There were 2 reported bot failures that need more investigation:

http://lab.llvm.org:8011/builders/sanitizer-windows/builds/69871/steps/stage%201%20check/logs/stdio

   This one is in my new test.

http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fuzzer/builds/39187/steps/check-fuzzer/logs/stdio

   This one seems completely unrelated.

3 years ago[libc] Add implementation for hypotf
Tue Ly [Thu, 13 Aug 2020 01:18:28 +0000 (21:18 -0400)]
[libc] Add implementation for hypotf

Truncating the sum of squares, and then use shift-and-add algorithm to compute its square root.
Required MPFR testing infra is updated in https://reviews.llvm.org/D87514

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

3 years ago[sanitizer] Add facility to print the full StackDepot
Teresa Johnson [Wed, 16 Sep 2020 20:47:16 +0000 (13:47 -0700)]
[sanitizer] Add facility to print the full StackDepot

Split out of D87120 (memory profiler). Added unit testing of the new
printing facility.

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

3 years ago[NFC] clang-format one line
Vitaly Buka [Fri, 18 Sep 2020 01:03:55 +0000 (18:03 -0700)]
[NFC] clang-format one line

3 years ago[NFC][Lsan] Fix zero-sized array compilation error
Vitaly Buka [Fri, 18 Sep 2020 00:42:33 +0000 (17:42 -0700)]
[NFC][Lsan] Fix zero-sized array compilation error

3 years ago[scudo/standalone] Don't define test main function for Fuchsia
Roland McGrath [Thu, 17 Sep 2020 19:35:31 +0000 (12:35 -0700)]
[scudo/standalone] Don't define test main function for Fuchsia

Fuchsia's unit test library provides the main function by default.

Reviewed By: cryptoad

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

3 years ago[MLIR] Fix build failure due to https://reviews.llvm.org/D87059.
Rahul Joshi [Thu, 17 Sep 2020 23:51:20 +0000 (16:51 -0700)]
[MLIR] Fix build failure due to https://reviews.llvm.org/D87059.

- Remove spurious ;
- Make comparison object invokable as const.

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

3 years ago[mlir][shape] Add `shape.cstr_require %bool`
Sean Silva [Thu, 17 Sep 2020 23:20:47 +0000 (16:20 -0700)]
[mlir][shape] Add `shape.cstr_require %bool`

This op is a catch-all for creating witnesses from various random kinds
of constraints. In particular, I when dealing with extents directly,
which are of `index` type, one can directly use std ops for calculating
the predicates, and then use cstr_require for the final conversion to a
witness.

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

3 years ago[lldb] Clarify docstring for SBBlock::IsInlined, NFC
Vedant Kumar [Thu, 17 Sep 2020 23:53:17 +0000 (16:53 -0700)]
[lldb] Clarify docstring for SBBlock::IsInlined, NFC

Previously, there was a little ambiguity about whether IsInlined should
return true for an inlined lexical block, since technically the lexical
block would not represent an inlined function (it'd just be contained
within one).

Edit suggested by Jim Ingham.

3 years ago[AArch64][GlobalISel] Make G_STORE <8 x s8> legal.
Amara Emerson [Thu, 17 Sep 2020 23:42:18 +0000 (16:42 -0700)]
[AArch64][GlobalISel] Make G_STORE <8 x s8> legal.

3 years ago[AArch64][GlobalISel] clang-format AArch64LegalizerInfo.cpp. NFC.
Amara Emerson [Thu, 17 Sep 2020 23:40:36 +0000 (16:40 -0700)]
[AArch64][GlobalISel] clang-format AArch64LegalizerInfo.cpp. NFC.

3 years ago[PowerPC] Add Set Boolean Condition Instruction Definitions and MC Tests
Amy Kwan [Thu, 17 Sep 2020 23:20:37 +0000 (18:20 -0500)]
[PowerPC] Add Set Boolean Condition Instruction Definitions and MC Tests

This patch adds the instruction definitions and assembly/disassembly tests for
the set boolean condition instructions. This also includes the negative, and
reverse variants of the instruction.

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

3 years ago[PowerPC] Implement Vector Count Mask Bits builtins in LLVM/Clang
Amy Kwan [Wed, 16 Sep 2020 15:03:17 +0000 (10:03 -0500)]
[PowerPC] Implement Vector Count Mask Bits builtins in LLVM/Clang

This patch implements the vec_cntm function prototypes in altivec.h in order to
utilize the vector count mask bits instructions introduced in Power10.

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

3 years ago[MemorySSA] Fix an unused variable warning [NFC]
Philip Reames [Thu, 17 Sep 2020 23:07:22 +0000 (16:07 -0700)]
[MemorySSA] Fix an unused variable warning [NFC]

3 years ago[MLIR][TableGen] Automatic detection and elimination of redundant methods
Rahul Joshi [Thu, 17 Sep 2020 20:18:09 +0000 (13:18 -0700)]
[MLIR][TableGen] Automatic detection and elimination of redundant methods

- Change OpClass new method addition to find and eliminate any existing methods that
  are made redundant by the newly added method, as well as detect if the newly added
  method will be redundant and return nullptr in that case.
- To facilitate that, add the notion of resolved and unresolved parameters, where resolved
  parameters have each parameter type known, so that redundancy checks on methods
  with same name but different parameter types can be done.
- Eliminate existing code to avoid adding conflicting/redundant build methods and rely
  on this new mechanism to eliminate conflicting build methods.

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

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

3 years ago[RISCV] Support Shadow Call Stack
Zhaoshi Zheng [Fri, 27 Mar 2020 05:09:31 +0000 (22:09 -0700)]
[RISCV] Support Shadow Call Stack

Currenlty assume x18 is used as pointer to shadow call stack. User shall pass
flags:

"-fsanitize=shadow-call-stack -ffixed-x18"

Runtime supported is needed to setup x18.

If SCS is desired, all parts of the program should be built with -ffixed-x18 to
maintain inter-operatability.

There's no particuluar reason that we must use x18 as SCS pointer. Any register
may be used, as long as it does not have designated purpose already, like RA or
passing call arguments.

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

3 years ago[AArch64] Enable implicit null check transformation
Philip Reames [Thu, 17 Sep 2020 22:39:50 +0000 (15:39 -0700)]
[AArch64] Enable implicit null check transformation

This change enables the generic implicit null transformation for the AArch64 target. As background for those unfamiliar with our implicit null check support:

    An implicit null check is the use of a signal handler to catch and redirect to a handler a null pointer. Specifically, it's replacing an explicit conditional branch with such a redirect. This is only done for very cold branches under frontend control w/appropriate metadata.
    FAULTING_OP is used to wrap the faulting instruction. It is modelled as being a conditional branch to reflect the fact it can transfer control in the CFG.
    FAULTING_OP does not need to be an analyzable branch to achieve it's purpose. (Or at least, that's the x86 model. I find this slightly questionable.)
    When lowering to MC, we convert the FAULTING_OP back into the actual instruction, record the labels, and lower the original instruction.

As can be seen in the test changes, currently the AArch64 backend does not eliminate the unconditional branch to the fallthrough block. I've tried two approaches, neither of which worked. I plan to return to this in a separate change set once I've wrapped my head around the interactions a bit better. (X86 handles this via AllowModify on analyzeBranch, but adding the obvious code causing BranchFolding to crash. I haven't yet figured out if it's a latent bug in BranchFolding, or something I'm doing wrong.)

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

3 years ago[test] Fix FullUnroll.ll
Arthur Eubanks [Mon, 24 Aug 2020 20:43:02 +0000 (13:43 -0700)]
[test] Fix FullUnroll.ll

I believe the intention of this test added in
https://reviews.llvm.org/D71687 was to test LoopFullUnrollPass with
clang's -fno-unroll-loops, not its interaction with optnone. Loop
unrolling passes don't run under optnone/-O0.

Also added back unintentionally removed -disable-loop-unrolling from
https://reviews.llvm.org/D85578.

Reviewed By: echristo

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

3 years ago[TargetRegisterInfo] Add a couple of target hooks for the greedy register allocator
Quentin Colombet [Thu, 17 Sep 2020 21:47:12 +0000 (14:47 -0700)]
[TargetRegisterInfo] Add a couple of target hooks for the greedy register allocator

Before this patch, the last chance recoloring and deferred spilling
techniques were solely controled by command line options.
This patch adds target hooks for these two techniques so that it
is easier for backend writers to override the default behavior.

The default behavior of the hooks preserves the default values of
the related command line options.

NFC

3 years ago[NFC] Test Commit
Zhaoshi Zheng [Thu, 17 Sep 2020 22:14:14 +0000 (15:14 -0700)]
[NFC] Test Commit

3 years agoSupport dwarf fission for wasm object files
Derek Schuff [Sat, 8 Aug 2020 04:23:11 +0000 (21:23 -0700)]
Support dwarf fission for wasm object files

Initial support for dwarf fission sections (-gsplit-dwarf) on wasm.
The most interesting change is support for writing 2 files (.o and .dwo) in the
wasm object writer. My approach moves object-writing logic into its own function
and calls it twice, swapping out the endian::Writer (W) in between calls.
It also splits the import-preparation step into its own function (and skips it when writing a dwo).

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

3 years ago[MemorySSA] Be more conservative when traversing MemoryPhis.
Florian Hahn [Thu, 17 Sep 2020 21:09:53 +0000 (22:09 +0100)]
[MemorySSA] Be more conservative when traversing MemoryPhis.

I think we need to be even more conservative when traversing memory
phis, to make sure we catch any loop carried dependences.

This approach updates fillInCurrentPair to use unknown sizes for
locations when we walk over a phi, unless the location is guaranteed to
be loop-invariant for any possible loop. Using an unknown size for
locations should ensure we catch all memory accesses to locations after
the given memory location, which includes loop-carried dependences.

Reviewed By: asbirlea

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

3 years ago[NewPM] Fix pr45927.ll under NPM
Arthur Eubanks [Thu, 17 Sep 2020 20:57:28 +0000 (13:57 -0700)]
[NewPM] Fix pr45927.ll under NPM

3 years ago[llvm-install-name-tool] Update the command-line guide
Alexander Shaposhnikov [Fri, 11 Sep 2020 05:05:20 +0000 (22:05 -0700)]
[llvm-install-name-tool] Update the command-line guide

3 years ago[InstCombine] Canonicalize SPF_ABS to abs intrinc
Nikita Popov [Sat, 5 Sep 2020 09:38:39 +0000 (11:38 +0200)]
[InstCombine] Canonicalize SPF_ABS to abs intrinc

Enable canonicalization of SPF_ABS and SPF_NABS to the abs intrinsic.

To be conservative, the one-use check on the comparison is retained,
this may be relaxed if all goes well.

It's pretty likely that this will uncover places that missing
handling for the abs() intrinsic. Please report any seen performance
regressions.

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

3 years ago[LoopUnrollAndJam] Allow unroll and jam loops forced by user.
Whitney Tsang [Thu, 17 Sep 2020 17:53:26 +0000 (17:53 +0000)]
[LoopUnrollAndJam] Allow unroll and jam loops forced by user.

Summary: Allow unroll and jam loops forced by user.
LoopUnrollAndJamPass is still disabled by default in the NPM pipeline,
and can be controlled by -enable-npm-unroll-and-jam.

Reviewed By: Meinersbur, dmgreen

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

3 years ago[GVN] Use that assume(!X) implies X==false (PR47496)
Nikita Popov [Thu, 17 Sep 2020 19:22:37 +0000 (21:22 +0200)]
[GVN] Use that assume(!X) implies X==false (PR47496)

We already use that assume(X) implies X==true, do the same for
assume(!X) implying X==false. This fixes PR47496.

3 years ago[GVN] Add additional assume tests (NFC)
Nikita Popov [Thu, 17 Sep 2020 18:39:29 +0000 (20:39 +0200)]
[GVN] Add additional assume tests (NFC)

The other assume tests seem to be dealing with equalities in
particular. Test implication for the condition itself, especially
the negated case from PR47496.

3 years ago[SCEV] Add test cases for max BTC with loop guard info.
Florian Hahn [Thu, 17 Sep 2020 15:45:02 +0000 (16:45 +0100)]
[SCEV] Add test cases for max BTC with loop guard info.

This adds test cases for PR40961 and PR47247. They illustrate cases in
which the max backedge-taken count can be improved by information from
the loop guards.

3 years agoDisable hoisting MI to hotter basic blocks when using pgo
Victor Huang [Thu, 17 Sep 2020 19:13:29 +0000 (14:13 -0500)]
Disable hoisting MI to hotter basic blocks when using pgo

This is a follow up patch for https://reviews.llvm.org/D63676 to
enable the feature when using pgo.

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

3 years ago[Lsan] Use fp registers to search for pointers
Vitaly Buka [Thu, 17 Sep 2020 19:15:00 +0000 (12:15 -0700)]
[Lsan] Use fp registers to search for pointers

X86 can use xmm registers for pointers operations. e.g. for std::swap.
I don't know yet if it's possible on other platforms.

NT_X86_XSTATE includes all registers from NT_FPREGSET so
the latter used only if the former is not available. I am not sure how
reasonable to expect that but LLD has such fallback in
NativeRegisterContextLinux_x86_64::ReadFPR.

Reviewed By: morehouse

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

3 years agoAArch64::ArchKind's underlying type is uint64_t
Jon Roelofs [Thu, 17 Sep 2020 19:13:22 +0000 (12:13 -0700)]
AArch64::ArchKind's underlying type is uint64_t

3 years ago[gn build] Port 7e4c6fb8546
LLVM GN Syncbot [Thu, 17 Sep 2020 19:09:34 +0000 (19:09 +0000)]
[gn build] Port 7e4c6fb8546

3 years ago[IRSim] Adding IR Instruction Mapper
Andrew Litteken [Thu, 17 Sep 2020 17:28:09 +0000 (12:28 -0500)]
[IRSim] Adding IR Instruction Mapper

This introduces the IRInstructionMapper, and the associated wrapper for
instructions, IRInstructionData, that maps IR level Instructions to
unsigned integers.

Mapping is done mainly by using the "isSameOperationAs" comparison
between two instructions.  If they return true, the opcode, result type,
and operand types of the instruction are used to hash the instruction
with an unsigned integer.  The mapper accepts instruction ranges, and
adds each resulting integer to a list, and each wrapped instruction to
a separate list.

At present, branches, phi nodes are not mapping and exception handling
is illegal.  Debug instructions are not considered.

The different mapping schemes are tested in
unittests/Analysis/IRSimilarityIdentifierTest.cpp

Recommit of: b04c1a9d3127730c05e8a22a0e931a12a39528df

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

3 years ago[SVE][WIP] Implement lowering for fixed length VSELECT to Scalable
Cameron McInally [Thu, 17 Sep 2020 18:54:46 +0000 (13:54 -0500)]
[SVE][WIP] Implement lowering for fixed length VSELECT to Scalable

Map fixed length VSELECT to its Scalable equivalent.

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

3 years ago[PDB] Split TypeServerSource and extend type index map lifetime
Reid Kleckner [Thu, 4 Jun 2020 01:08:55 +0000 (18:08 -0700)]
[PDB] Split TypeServerSource and extend type index map lifetime

Extending the lifetime of these type index mappings does increase memory
usage (+2% in my case), but it decouples type merging from symbol
merging. This is a pre-requisite for two changes that I have in mind:
- parallel type merging: speeds up slow type merging
- defered symbol merging: avoid heap allocating (relocating) all symbols

This eliminates CVIndexMap and moves its data into TpiSource. The maps
are also split into a SmallVector and ArrayRef component, so that the
ipiMap can alias the tpiMap for /Z7 object files, and so that both maps
can simply alias the PDB type server maps for /Zi files.

Splitting TypeServerSource establishes that all input types to be merged
can be identified with two 32-bit indices:
- The index of the TpiSource object
- The type index of the record
This is useful, because this information can be stored in a single
64-bit atomic word to enable concurrent hashtable insertion.

One last change is that now all object files with debugChunks get a
TpiSource, even if they have no type info. This avoids some null checks
and special cases.

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

3 years ago[AArch64][GlobalISel] Widen G_EXTRACT_VECTOR_ELT element types if < 8b.
Amara Emerson [Thu, 17 Sep 2020 18:17:18 +0000 (11:17 -0700)]
[AArch64][GlobalISel] Widen G_EXTRACT_VECTOR_ELT element types if < 8b.

In order to not unnecessarily promote the source vector to greater than our
native vector size of 128b, I've added some cascading rules to widen based on
the number of elements.

3 years ago[AArch64][GlobalISel] Make <8 x s16> and <16 x s8> legal for shifts.
Amara Emerson [Thu, 17 Sep 2020 18:16:02 +0000 (11:16 -0700)]
[AArch64][GlobalISel] Make <8 x s16> and <16 x s8> legal for shifts.

3 years ago[VectorCombine] limit load+insert transform to one-use
Sanjay Patel [Thu, 17 Sep 2020 18:22:05 +0000 (14:22 -0400)]
[VectorCombine] limit load+insert transform to one-use

As discussed in:
https://llvm.org/PR47558
...there are several potential fixes/follow-ups visible
in the test case, but this is the quickest and safest
fix of the perf regression.

3 years ago[X86] Don't match x87 register inline asm constraints unless the VT is floating point...
Craig Topper [Thu, 17 Sep 2020 17:33:34 +0000 (10:33 -0700)]
[X86] Don't match x87 register inline asm constraints unless the VT is floating point or its a clobber

The register class picked will be the RFP80 register class which has a f80 VT. The code in SelectionDAGBuilder that generates copies around inline assembly doesn't know how to handle an integer and floating point type of different bit widths.

The test case is derived from this https://godbolt.org/z/sEa659 which gcc accepts but clang crashes on. This patch just gives a more graceful error. I'm not sure if the single element struct case is special in gcc. Adding another field to the struct makes gcc reject it. If we want to support this correctly I think we need a change in the frontend to give us the true element type. Right now the frontend just realizes the constraint can take a memory argument so creates an integer type of the same size and bitcasts.

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

3 years ago[MLIR][Affine] Add parametric tile size support for affine.for tiling
Navdeep Kumar [Thu, 17 Sep 2020 18:07:21 +0000 (23:37 +0530)]
[MLIR][Affine] Add parametric tile size support for affine.for tiling

Add support to tile affine.for ops with parametric sizes (i.e., SSA
values). Currently supports hyper-rectangular loop nests with constant
lower bounds only. Move methods

  - moveLoopBody(*)
  - getTileableBands(*)
  - checkTilingLegality(*)
  - tilePerfectlyNested(*)
  - constructTiledIndexSetHyperRect(*)

to allow reuse with constant tile size API. Add a test pass -test-affine
-parametric-tile to test parametric tiling.

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

3 years ago[MLIR] Support for return values in Affine.For yield
Abhishek Varma [Thu, 17 Sep 2020 18:00:47 +0000 (23:30 +0530)]
[MLIR] Support for return values in Affine.For yield

Add support for return values in affine.for yield along the same lines
as scf.for and affine.parallel.

Signed-off-by: Abhishek Varma <abhishek.varma@polymagelabs.com>
Differential Revision: https://reviews.llvm.org/D87437

3 years agoRevert "[NFC] Refactor DiagnosticBuilder and PartialDiagnostic"
Yaxun (Sam) Liu [Thu, 17 Sep 2020 17:53:38 +0000 (13:53 -0400)]
Revert "[NFC] Refactor DiagnosticBuilder and PartialDiagnostic"

This reverts commit ee5519d323571c4a9a7d92cb817023c9b95334cd.

3 years agoRevert "[CUDA][HIP] Defer overloading resolution diagnostics for host device functions"
Yaxun (Sam) Liu [Thu, 17 Sep 2020 17:53:25 +0000 (13:53 -0400)]
Revert "[CUDA][HIP] Defer overloading resolution diagnostics for host device functions"

This reverts commit 7f1f89ec8d9944559042bb6d3b1132eabe3409de.

This reverts commit 40df06cdafc010002fc9cfe1dda73d689b7d27a6.

3 years ago[VectorCombine] rearrange bailouts for load insert for efficiency; NFC
Sanjay Patel [Thu, 17 Sep 2020 17:49:48 +0000 (13:49 -0400)]
[VectorCombine] rearrange bailouts for load insert for efficiency; NFC

3 years ago[VectorCombine] add test for multi-use load (PR47558); NFC
Sanjay Patel [Thu, 17 Sep 2020 17:21:58 +0000 (13:21 -0400)]
[VectorCombine] add test for multi-use load (PR47558); NFC

3 years ago[PowerPC][AIX] Don't hardcode python invoke command line
Jinsong Ji [Thu, 17 Sep 2020 17:43:41 +0000 (17:43 +0000)]
[PowerPC][AIX] Don't hardcode python invoke command line

We shouldn't assume python exists, we should let lit
to decide whether it is python or python3 and expand the path.

3 years agoAdd missing include
Adrian Prantl [Thu, 17 Sep 2020 17:46:03 +0000 (10:46 -0700)]
Add missing include

3 years ago[AMDGPU] Fix ROCm unit test memref initialization
jerryyin [Thu, 17 Sep 2020 15:47:33 +0000 (08:47 -0700)]
[AMDGPU] Fix ROCm unit test memref initialization

3 years ago[Sema] Introduce BuiltinAttr, per-declaration builtin-ness
Raul Tambre [Fri, 4 Sep 2020 16:10:09 +0000 (19:10 +0300)]
[Sema] Introduce BuiltinAttr, per-declaration builtin-ness

Instead of relying on whether a certain identifier is a builtin, introduce BuiltinAttr to specify a declaration as having builtin semantics.

This fixes incompatible redeclarations of builtins, as reverting the identifier as being builtin due to one incompatible redeclaration would have broken rest of the builtin calls.
Mostly-compatible redeclarations of builtins also no longer have builtin semantics. They don't call the builtin nor inherit their attributes.
A long-standing FIXME regarding builtins inside a namespace enclosed in extern "C" not being recognized is also addressed.

Due to the more correct handling attributes for builtin functions are added in more places, resulting in more useful warnings.
Tests are updated to reflect that.

Intrinsics without an inline definition in intrin.h had `inline` and `static` removed as they had no effect and caused them to no longer be recognized as builtins otherwise.

A pthread_create() related test is XFAIL-ed, as it relied on it being recognized as a builtin based on its name.
The builtin declaration syntax is too restrictive and doesn't allow custom structs, function pointers, etc.
It seems to be the only case and fixing this would require reworking the current builtin syntax, so this seems acceptable.

Fixes PR45410.

Reviewed By: rsmith, yutsumi

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

3 years ago[DFSan] Add bcmp wrapper.
Matt Morehouse [Thu, 17 Sep 2020 16:23:35 +0000 (09:23 -0700)]
[DFSan] Add bcmp wrapper.

Reviewed By: vitalybuka

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