platform/upstream/llvm.git
3 years agoX86: balance the frame prologue and epilogue on Win64
Saleem Abdulrasool [Mon, 14 Jun 2021 00:39:19 +0000 (17:39 -0700)]
X86: balance the frame prologue and epilogue on Win64

This was broken in ba1509da7b89c850c89f0f98afbab375794cd3c8.  The Win64
frame would not perform the setup of the Swift async context parameter
but would tear down the setup in the epilogue resulting in crashes.
This ensures that we do the full setup when we do the tear down.
Although this is non-conforming to the Win64 calling convention, it
corrects the setup and exposes the actual issue that the change
introduced: incorrect frame setup.

Reviewed By: rnk

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

3 years ago[FuncSpec] Use std::pow instead of operator^
Chuanqi Xu [Tue, 15 Jun 2021 02:55:38 +0000 (10:55 +0800)]
[FuncSpec] Use std::pow instead of operator^

The original implementation calculating UserBonus uses operator ^, which means XOR in C++
language.
At the first glance of reviewing, I thought it should be power, my bad.
It doesn't make sense to use XOR here. So I believe it should be a
carelessness as I made.

Test Plan: check-all

Reviewed By: SjoerdMeijer

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

3 years ago[NFC][sanitizer] Remove calls to __asan_get_current_fake_stack
Kevin Athey [Wed, 16 Jun 2021 01:26:31 +0000 (18:26 -0700)]
[NFC][sanitizer] Remove calls to __asan_get_current_fake_stack

Unnecessary with -fsanitize-address-use-after-return=never.

for issue: https://github.com/google/sanitizers/issues/1394

Reviewed By: vitalybuka

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

3 years ago[DFSan] Handle landingpad inst explicitly as zero shadow.
Andrew Browne [Mon, 14 Jun 2021 20:41:24 +0000 (13:41 -0700)]
[DFSan] Handle landingpad inst explicitly as zero shadow.

Before this change, DFSan was relying fallback cases when getting origin
address.

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

3 years ago[libc++] Promote GCC 11 to mandatory CI
Louis Dionne [Tue, 15 Jun 2021 19:07:03 +0000 (15:07 -0400)]
[libc++] Promote GCC 11 to mandatory CI

Also, fix the last issue that prevented GCC 11 from passing the test
suite. Thanks to everyone else who fixed issues.

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

3 years agoDon't depend on the "run" alias doing shell expanding.
Jim Ingham [Tue, 15 Jun 2021 23:35:44 +0000 (16:35 -0700)]
Don't depend on the "run" alias doing shell expanding.
Instead dial it up explicitly.

This test started failing recently and I'm not sure why.  It also
doesn't make sense to me the replacing "run" with "process launch -X 1 --"
should make any difference - run is an alias for the latter.  But
it does pass with the change, and unless we are testing for the exact
run alias, it's better to ask for what we want explicitly.

3 years agoCMake: allow overriding CMAKE_CXX_VISIBILITY_PRESET
Wenlei He [Tue, 15 Jun 2021 22:50:52 +0000 (15:50 -0700)]
CMake: allow overriding CMAKE_CXX_VISIBILITY_PRESET

This allows overriding the `CMAKE_CXX_VISIBILITY_PRESET` on the command line. For example, setting the value to `default` lets PIC LLVM static libraries be converted to DSOs, without the need to rebuild LLVM with BUILD_SHARED_LIBS=ON.

Reviewed By: wenlei

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

3 years ago[mlir][sparse] integration test for all-dense annotated "sparse" output
Aart Bik [Tue, 15 Jun 2021 02:07:03 +0000 (19:07 -0700)]
[mlir][sparse] integration test for all-dense annotated "sparse" output

Reviewed By: gussmith23

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

3 years agoMissed a Windows use of ValidForThisThread in the changes for
Jim Ingham [Tue, 15 Jun 2021 22:42:50 +0000 (15:42 -0700)]
Missed a Windows use of ValidForThisThread in the changes for
cfb96d845a684a5c567823dbe2aa4392937ee979.

3 years ago[docs] Exclude FlangOption and re-generate ClangCommandLineReference.rst
Fangrui Song [Tue, 15 Jun 2021 22:22:07 +0000 (15:22 -0700)]
[docs] Exclude FlangOption and re-generate ClangCommandLineReference.rst

3 years ago[mlir][SCF] Remove empty else blocks of `scf.if` operations.
MaheshRavishankar [Tue, 15 Jun 2021 21:15:40 +0000 (14:15 -0700)]
[mlir][SCF] Remove empty else blocks of `scf.if` operations.

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

3 years ago[OpaquePtr] Verify Opaque pointer in function parameter
Zequan Wu [Tue, 15 Jun 2021 21:43:39 +0000 (14:43 -0700)]
[OpaquePtr] Verify Opaque pointer in function parameter

Verifying opaque pointer as function parameter when using with `byval`, `byref`,
`inalloca`, `preallocated`.

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

3 years ago[mlir][sparse] allow all-dense annotated "sparse" tensor output
Aart Bik [Fri, 11 Jun 2021 17:33:43 +0000 (10:33 -0700)]
[mlir][sparse] allow all-dense annotated "sparse" tensor output

This is a very careful start with alllowing sparse tensors at the
left-hand-side of tensor index expressions (viz. sparse output).
Note that there is a subtle difference between non-annotated tensors
(dense, remain n-dim, handled by classic bufferization) and all-dense
annotated "sparse" tensors (linearized to 1-dim without overhead
storage, bufferized by sparse compiler, backed by runtime support library).
This revision gently introduces some new IR to facilitate annotated outputs,
to be generalized to truly sparse tensors in the future.

Reviewed By: gussmith23, bixia

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

3 years ago[SampleFDO] Using common linkage for the discriminator flag variable
Rong Xu [Tue, 15 Jun 2021 19:32:03 +0000 (12:32 -0700)]
[SampleFDO] Using common linkage for the discriminator flag variable

We create flag variable "__llvm_fs_discriminator__" in the binary
to indicate that FSAFDO hierarchical discriminators are used.

This variable might be GC'ed by the linker since it is not explicitly
reference. I initially added the var to the use list in pass
MIRFSDiscriminator but it did not work. It turned out the used global
list is collected in lowering (before MIR pass) and then emitted in
the end of pass pipeline.

In this patch, we use a "common" linkage for this variable so that
it will be GC'ed by the linker.

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

3 years agoConvert functions that were returning BreakpointOption * to BreakpointOption &.
Jim Ingham [Sat, 12 Jun 2021 00:00:46 +0000 (17:00 -0700)]
Convert functions that were returning BreakpointOption * to BreakpointOption &.

This is an NFC cleanup.

Many of the API's that returned BreakpointOptions always returned valid ones.
Internally the BreakpointLocations usually have null BreakpointOptions, since they
use their owner's options until an option is set specifically on the location.
So the original code used pointers & unique_ptr everywhere for consistency.
But that made the code hard to reason about from the outside.

This patch changes the code so that everywhere an API is guaranteed to
return a non-null BreakpointOption, it returns it as a reference to make
that clear.

It also changes the Breakpoint to hold a BreakpointOption
member where it previously had a UP.  Since we were always filling the UP
in the Breakpoint constructor, having the UP wasn't helping anything.

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

3 years ago[OpenMP] Add GOMP 5.0 version symbols to API
Peyton, Jonathan L [Thu, 3 Jun 2021 19:09:09 +0000 (14:09 -0500)]
[OpenMP] Add GOMP 5.0 version symbols to API

* Add GOMP versioned pause functions
* Add GOMP versioned affinity format functions

To do the affinity format functions, only attach versioned symbols
to the APPEND Fortran entries (e.g., omp_set_affinity_format_) since
GOMP only exports two symbols (one for Fortran, one for C). Our
affinity format functions have three symbols.
e.g., with omp_set_affinity_format:
1) omp_set_affinity_format (Fortran interface)
2) omp_set_affinity_format_ (Fortran interface)
3) ompc_set_affinity_format (C interface)

Have the GOMP version of the C symbol alias the ompc_* 3) version
instead of the Fortran unappended version 1).

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

3 years ago[OpenMP] Fix affinity determine capable algorithm on Linux
Peyton, Jonathan L [Thu, 3 Jun 2021 17:49:04 +0000 (12:49 -0500)]
[OpenMP] Fix affinity determine capable algorithm on Linux

Remove strange checks for syscall() arguments where mask is NULL.
Valgrind reports these as error usages for the syscall.
Instead, just check if CACHE_LINE bytes is long enough. If not, then
search for the size. Also, by limiting the first size detection
attempt to CACHE_LINE bytes, instead of 1MB, we don't use more than one
cache line for the mask size. Before this patch, sometimes the returned
mask size was 640 bytes (10 cache lines) because the initial call to
getaffinity() was limited only by the internal kernel mask size
which can be very large.

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

3 years ago[OpenMP] Lazily assign root affinity
Peyton, Jonathan L [Wed, 2 Jun 2021 15:39:40 +0000 (10:39 -0500)]
[OpenMP] Lazily assign root affinity

Lazily set affinity for root threads. Previously, the root thread
executing middle initialization would attempt to assign affinity
to other existing root threads. This was not working properly as the
set_system_affinity() function wasn't setting the affinity for the
target thread. Instead, the middle init thread was resetting the
its own affinity using the target thread's affinity mask.

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

3 years agoAArch64 Linux and elf-core PAC stack unwinder support
Muhammad Omair Javaid [Tue, 15 Jun 2021 10:41:38 +0000 (15:41 +0500)]
AArch64 Linux and elf-core PAC stack unwinder support

This patch builds on D100521 and other related patches to add support
for unwinding stack on AArch64 systems with pointer authentication
feature enabled.

We override FixCodeAddress and FixDataAddress function in ABISysV_arm64
class. We now try to calculate and set code and data masks after reading
data_mask and code_mask registers exposed by AArch64 targets running Linux.

This patch utilizes core file linux-aarch64-pac.core for testing that
LLDB can successfully unwind stack frames in the presence of signed
return address after masking off ignored bits.

This patch also includes a AArch64 Linux native test case to demonstrate
successful back trace calculation in presence of pointer authentication
feature.

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

3 years ago[libc][NFC] Disable thrd_test as it is exhibiting flaky behavior on the bots.
Siva Chandra Reddy [Tue, 15 Jun 2021 20:57:51 +0000 (20:57 +0000)]
[libc][NFC] Disable thrd_test as it is exhibiting flaky behavior on the bots.

3 years agoRevert "[MCA] Adding the CustomBehaviour class to llvm-mca"
Andrea Di Biagio [Tue, 15 Jun 2021 20:34:41 +0000 (21:34 +0100)]
Revert "[MCA] Adding the CustomBehaviour class to llvm-mca"

This reverts commit f7a23ecece524564a0c3e09787142cc6061027bb.

It appears to breaks buildbots that don't build the AMDGPU backend.

3 years ago[MCA] Adding the CustomBehaviour class to llvm-mca
Patrick Holland [Tue, 15 Jun 2021 20:20:35 +0000 (21:20 +0100)]
[MCA] Adding the CustomBehaviour class to llvm-mca

Some instructions are not defined well enough within the target’s scheduling
model for llvm-mca to be able to properly simulate its behaviour. The ideal
solution to this situation is to modify the scheduling model, but that’s not
always a viable strategy. Maybe other parts of the backend depend on that
instruction being modelled the way that it is. Or maybe the instruction is quite
complex and it’s difficult to fully capture its behaviour with tablegen. The
CustomBehaviour class (which I will refer to as CB frequently) is designed to
provide intuitive scaffolding for developers to implement the correct modelling
for these instructions.

Implementation details:

llvm-mca does its best to extract relevant register, resource, and memory
information from every MCInst when lowering them to an mca::Instruction. It then
uses this information to detect dependencies and simulate stalls within the
pipeline. For some instructions, the information that gets captured within the
mca::Instruction is not enough for mca to simulate them properly. In these
cases, there are two main possibilities:

1. The instruction has a dependency that isn’t detected by mca.
2. mca is incorrectly enforcing a dependency that shouldn’t exist.

For the rest of this discussion, I will be focusing on (1), but I have put some
thought into (2) and I may revisit it in the future.

So we have an instruction that has dependencies that aren’t picked up by mca.
The basic idea for both pipelines in mca is that when an instruction wants to be
dispatched, we first check for register hazards and then we check for resource
hazards. This is where CB is injected. If no register or resource hazards have
been detected, we make a call to CustomBehaviour::checkCustomHazard() to give
the target specific CB the chance to detect and enforce any custom dependencies.

The return value for checkCustomHazaard() is an unsigned int representing the
(minimum) number of cycles that the instruction needs to stall for. It’s fine to
underestimate this value because when StallCycles gets down to 0, we’ll end up
checking for all the hazards again before the instruction is actually
dispatched. However, it’s important not to overestimate the value and the more
accurate your estimate is, the more efficient mca’s execution can be.

In general, for checkCustomHazard() to be able to detect these custom
dependencies, it needs information about the current instruction and also all of
the instructions that are still executing within the pipeline. The mca pipeline
uses mca::Instruction rather than MCInst and the current information encoded
within each mca::Instruction isn’t sufficient for my use cases. I had to add a
few extra attributes to the mca::Instruction class and have them get set by the
MCInst during instruction building. For example, the current mca::Instruction
doesn’t know its opcode, and it also doesn’t know anything about its immediate
operands (both of which I had to add to the class).

With information about the current instruction, a list of all currently
executing instructions, and some target specific objects (MCSubtargetInfo and
MCInstrInfo which the base CB class has references to), developers should be
able to detect and enforce most custom dependencies within checkCustomHazard. If
you need more information than is present in the mca::Instruction, feel free to
add attributes to that class and have them set during the lowering sequence from
MCInst.

Fortunately, in the in-order pipeline, it’s very convenient for us to pass these
arguments to checkCustomHazard. The hazard checking is taken care of within
InOrderIssueStage::canExecute(). This function takes a const InstRef as a
parameter (representing the instruction that currently wants to be dispatched)
and the InOrderIssueStage class maintains a SmallVector<InstRef, 4> which holds
all of the currently executing instructions. For the out-of-order pipeline, it’s
a bit trickier to get the list of executing instructions and this is why I have
held off on implementing it myself. This is the main topic I will bring up when
I eventually make a post to discuss and ask for feedback.

CB is a base class where targets implement their own derived classes. If a
target specific CB does not exist (or we pass in the -disable-cb flag), the base
class is used. This base class trivially returns 0 from its checkCustomHazard()
implementation (meaning that the current instruction needs to stall for 0 cycles
aka no hazard is detected). For this reason, targets or users who choose not to
use CB shouldn’t see any negative impacts to accuracy or performance (in
comparison to pre-patch llvm-mca).

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

3 years agoAdding the rest of the C11 papers to the status page.
Aaron Ballman [Tue, 15 Jun 2021 20:08:54 +0000 (16:08 -0400)]
Adding the rest of the C11 papers to the status page.

3 years ago[gn build] Port 6478ef61b1a4
LLVM GN Syncbot [Tue, 15 Jun 2021 20:04:02 +0000 (20:04 +0000)]
[gn build] Port 6478ef61b1a4

3 years ago[InstSimplify] Treat invariant group insts as bitcasts for load operands
Arthur Eubanks [Thu, 22 Apr 2021 20:03:09 +0000 (13:03 -0700)]
[InstSimplify] Treat invariant group insts as bitcasts for load operands

We can look through invariant group intrinsics for the purposes of
simplifying the result of a load.

Since intrinsics can't be constants, but we also don't want to
completely rewrite load constant folding, we convert the load operand to
a constant. For GEPs and bitcasts we just treat them as constants. For
invariant group intrinsics, we treat them as a bitcast.

Relanding with a check for self-referential values.

Reviewed By: lebedev.ri

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

3 years ago[asan] Remove Asan, Ubsan support of RTEMS and Myriad
Vitaly Buka [Tue, 15 Jun 2021 00:52:14 +0000 (17:52 -0700)]
[asan] Remove Asan, Ubsan support of RTEMS and Myriad

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

3 years ago[NFC] Fix "unused variable" warning
Vitaly Buka [Tue, 15 Jun 2021 19:31:38 +0000 (12:31 -0700)]
[NFC] Fix "unused variable" warning

3 years agoSupport lowering of index-cast on vector types.
Arpith C. Jacob [Tue, 15 Jun 2021 19:51:30 +0000 (12:51 -0700)]
Support lowering of index-cast on vector types.

The index cast operation accepts vector types. Implement its lowering in this patch.

Reviewed By: ftynse

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

3 years agoRemove redundant test that was causing intermittent build bot failures.
Douglas Yung [Tue, 15 Jun 2021 19:46:03 +0000 (12:46 -0700)]
Remove redundant test that was causing intermittent build bot failures.

Patch by Fred Grim!

Reviewed By: MyDeveloperDay

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

3 years ago[NFC] Update renamed option in comments
Jinsong Ji [Tue, 15 Jun 2021 19:26:20 +0000 (19:26 +0000)]
[NFC] Update renamed option in comments

c98ebda325c996b3a12f4fded0368734dc0fe28a Rename fp-op fusion option (yet
again) for compatibility with GCC option.

The comment in the header should be updated too to avoid confusion.

3 years ago[libcxx][iwyu] ensures we IWYU as prep for modules
Christopher Di Bella [Sat, 12 Jun 2021 06:13:44 +0000 (06:13 +0000)]
[libcxx][iwyu] ensures we IWYU as prep for modules

This has been broken out of D104170 since it should be merged whether or
not we go ahead with the module map changes.

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

3 years ago[PowerPC] Moving defineXLCompatMacros() definition
Quinn Pham [Tue, 15 Jun 2021 19:24:28 +0000 (14:24 -0500)]
[PowerPC] Moving defineXLCompatMacros() definition

Moving the definition of the defineXLCompatMacros function from
the header file clang/lib/Basic/Targets/PPC.h to the source file
clang/lib/Basic/Targets/PPC.cpp.

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

3 years ago[PowerPC] Fix spilling of paired VSX registers
Nemanja Ivanovic [Tue, 15 Jun 2021 19:11:24 +0000 (14:11 -0500)]
[PowerPC] Fix spilling of paired VSX registers

We have added STXVP/LXVP for spilling and restoring the registers
but we neglected to add FI elimination code for these. The result
is that we end up producing impossible MachineInstr's that have
register operands in place of immediates.

3 years ago[libc++] [P0619] Add _LIBCPP_ABI_NO_BINDER_BASES and remove binder typedefs in C...
Arthur O'Dwyer [Tue, 25 May 2021 18:34:18 +0000 (14:34 -0400)]
[libc++] [P0619] Add _LIBCPP_ABI_NO_BINDER_BASES and remove binder typedefs in C++20.

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

3 years agoSupport: Remove F_{None,Text,Append} compatibility synonyms, NFC
Duncan P. N. Exon Smith [Tue, 15 Jun 2021 19:04:09 +0000 (12:04 -0700)]
Support: Remove F_{None,Text,Append} compatibility synonyms, NFC

Remove the compatibility spellings of `OF_{None,Text,Append}` that
were left behind by 1f67a3cba9b09636c56e2109d8a35ae96dc15782.

No functionality change here, just an API cleanup.

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

3 years ago[X86] avoid assert with varargs, soft float, and no-implicit-float
Bob Haarman [Wed, 9 Jun 2021 20:41:26 +0000 (13:41 -0700)]
[X86] avoid assert with varargs, soft float, and no-implicit-float

Fixes:
 - PR36507 Floating point varargs are not handled correctly with
   -mno-implicit-float
 - PR48528 __builtin_va_start assumes it can pass SSE registers
   when using -Xclang -msoft-float -Xclang -no-implicit-float

On x86_64, floating-point parameters are normally passed in XMM
registers. For va_start, we spill those to memory so va_arg can
find them. There is an interaction here with -msoft-float and
-no-implicit-float:

When -msoft-float is in effect, instead of passing floating-point
parameters in XMM registers, they are passed in general-purpose
registers.

When -no-implicit-float is in effect, it "disables implicit
floating-point instructions" (per the LangRef). The intended
effect is to not have the compiler generate floating-point code
unless explicit floating-point operations are present in the
source code, but what exactly counts as an explicit floating-point
operation is not specified. The existing behavior of LLVM here has
led to some surprises and PRs.

This change modifies the behavior as follows:

  | soft | no-implicit | old behavior    | new behavior    |
  |  no  |   no        | spill XMM regs  | spill XMM regs  |
  | yes  |   no        | don't spill XMM | don't spill XMM |
  |  no  |  yes        | don't spill XMM | spill XMM regs  |
  | yes  |  yes        | assert          | don't spill XMM |

In particular, this avoids the assert that happens when
-msoft-float and -no-implicit-float are both in effect. This
seems like a perfectly reasonable combination: If we don't want
to rely on hardware floating-point support, we want to both
avoid using float registers to pass parameters and avoid having
the compiler generate floating-point code that wasn't in the
original program. Instead of crashing the compiler, the new
behavior is to not synthesize floating-point code in this
case. This fixes PR48528.

The other interesting case is when -no-implicit-float is in
effect, but -msoft-float is not. In that case, any floating-point
parameters that are present will be in XMM registers, and so we
have to spill them to correctly handle those. This fixes
PR36507. The spill is conditional on %al indicating that
parameters are present in XMM registers, so no floating-point
code will be executed unless the function is called with
floating-point parameters.

Reviewed By: rnk

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

3 years ago[AMDGPU] Fix lds superalign test. NFC.
Stanislav Mekhanoshin [Tue, 15 Jun 2021 18:02:34 +0000 (11:02 -0700)]
[AMDGPU] Fix lds superalign test. NFC.

3 years ago[compiler-rt][hwasan] Add GetShadowOffset function
Leonard Chan [Tue, 15 Jun 2021 17:45:06 +0000 (10:45 -0700)]
[compiler-rt][hwasan] Add GetShadowOffset function

Similar to SHADOW_OFFSET on asan, we can use this for hwasan so platforms that
use a constant value for the start of shadow memory can just use the constant
rather than access a global.

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

3 years ago[NewPM] Remove SpeculateAroundPHIs pass
Roman Lebedev [Tue, 15 Jun 2021 17:32:43 +0000 (20:32 +0300)]
[NewPM] Remove SpeculateAroundPHIs pass

Addition of this pass has been botched.
There is no particular reason why it had to be sold as an inseparable part
of new-pm transition. It was added when old-pm was still the default,
and very *very* few users were actually tracking new-pm,
so it's effects weren't measured.

Which means, some of the turnoil of the new-pm transition
are actually likely regressions due to this pass.

Likewise, there has been a number of post-commit feedback
(post new-pm switch), namely
* https://reviews.llvm.org/D37467#2787157 (regresses HW-loops)
* https://reviews.llvm.org/D37467#2787259 (should not be in middle-end, should run after LSR, not before)
* https://reviews.llvm.org/D95789 (an attempt to fix bad loop backedge metadata)
and in the half year past, the pass authors (google) still haven't found time to respond to any of that.

Hereby it is proposed to backout the pass from the pipeline,
until someone who cares about it can address the issues reported,
and properly start the process of adding a new pass into the pipeline,
with proper performance evaluation.

Furthermore, neither google nor facebook reports any perf changes
from this change, so i'm dropping the pass completely.
It can always be re-reverted should/if anyone want to pick it up again.

Reviewed By: aeubanks

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

3 years ago[lldb] Make the ClassTemplateDecl merging logic in TypeSystemClang respect template...
Raphael Isemann [Tue, 15 Jun 2021 17:23:51 +0000 (19:23 +0200)]
[lldb] Make the ClassTemplateDecl merging logic in TypeSystemClang respect template parameters

DWARF doesn't describe templates itself but only actual template instantiations.
Because of that LLDB has to infer the parameters of the class template
declarations from the actual instantiations when creating the internal Clang AST
from debug info

Because there is no dedicated DIE for the class template, LLDB also creates the
`ClassTemplateDecl` implicitly when parsing a template instantiation. To avoid
creating one ClassTemplateDecls for every instantiation,
`TypeSystemClang::CreateClassTemplateDecl` will check if there is already a
`ClassTemplateDecl` in the requested `DeclContext` and will reuse a found
fitting declaration.

The logic that checks if a found class template fits to an instantiation is
currently just comparing the name of the template. So right now we map
`template<typename T> struct S;` to an instantiation with the values `S<1, 2,
3>` even though they clearly don't belong together.

This causes crashes later on when for example the Itanium mangler's
`TemplateArgManglingInfo::needExactType` method tries to find fitting the class
template parameter that fits to an instantiation value. In the example above it
will try to find the parameter for the value `2` but will just trigger a
boundary check when retrieving the parameter with index 1 from the class
template.

There are two ways we can end up with an instantiation that doesn't fit to a
class template with the same name:

1. We have two TUs with two templates that have the same name and internal
   linkage.
2. A forward declared template instantiation is emitted by GCC and Clang
   without an empty list of parameter values.

This patch makes the check for whether a class template declaration can be
reused more sophisticated by also comparing whether the parameter values can fit
to the found class template. If we can't find a fitting class template we
justcreate a second class template with the fitting parameters.

Fixes rdar://76592821

Reviewed By: kastiglione

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

3 years agoRevert "[ARM] Extend narrow values to allow using truncating scatters"
David Green [Tue, 15 Jun 2021 17:19:25 +0000 (18:19 +0100)]
Revert "[ARM] Extend narrow values to allow using truncating scatters"

This commit adds nodes that might not always be used, which the
expensive checks builder does not like. Reverting for now to think up a
better way of handling it.

3 years ago[NFC][OpaquePtr] Avoid calling getPointerElementType()
Arthur Eubanks [Fri, 4 Jun 2021 19:07:03 +0000 (12:07 -0700)]
[NFC][OpaquePtr] Avoid calling getPointerElementType()

Pointee types are going away soon.

For this, we mostly just care about store/load types, which are already
available without the pointee types. The other intrinsics always use
i8*.

Reviewed By: dblaikie

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

3 years ago[NFC] Remove redundant variable
Arthur Eubanks [Fri, 4 Jun 2021 17:56:57 +0000 (10:56 -0700)]
[NFC] Remove redundant variable

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

3 years agoRemove unnecessary triple from test
Yuki Okushi [Tue, 15 Jun 2021 16:11:50 +0000 (09:11 -0700)]
Remove unnecessary triple from test

PR27098(https://bugs.llvm.org/show_bug.cgi?id=27098) has been fixed so
the avoidance seems unnecessary.

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

3 years ago[ARM] Extend narrow values to allow using truncating scatters
David Green [Tue, 15 Jun 2021 16:45:14 +0000 (17:45 +0100)]
[ARM] Extend narrow values to allow using truncating scatters

As a minor adjustment to the existing lowering of offset scatters, this
extends any smaller-than-legal vectors into full vectors using a zext,
so that the truncating scatters can be used. Due to the way MVE
legalizes the vectors this should be cheap in most situations, and will
prevent the vector from being scalarized.

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

3 years agoDirectoryWatcher: close a possible window of race on Windows
Saleem Abdulrasool [Tue, 15 Jun 2021 02:41:30 +0000 (19:41 -0700)]
DirectoryWatcher: close a possible window of race on Windows

The initial scan occurring before the watcher is ready allows a race
condition where a change occurs before the initial scan completes.
Ensure that we wait for the watcher to begin executing the initial scan.

Addresses some feedback from Adrian McCarthy in post-commit review.

3 years ago[ARM] Use rq gather/scatters for smaller v4 vectors
David Green [Tue, 15 Jun 2021 16:06:15 +0000 (17:06 +0100)]
[ARM] Use rq gather/scatters for smaller v4 vectors

A pointer will always fit into an i32, so a rq offset gather/scatter can
be used with v4i8 and v4i16 gathers, using a base of 0 and the Ptr as
the offsets. The rq gather can then correctly extend the type, allowing
us to use the gathers without falling back to scalarizing.

This patch rejigs tryCreateMaskedGatherOffset in the
MVEGatherScatterLowering pass to decompose the Ptr into Base:0 +
Offset:Ptr (with a scale of 1), if the Ptr could not be decomposed from
a GEP. v4i32 gathers will already use qi gathers, this extends that to
v4i8 and v4i16 gathers using the extending rq variants.

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

3 years ago[IROutliner] Adding DebugInfo handling for IR Outlined Functions
Andrew Litteken [Mon, 7 Jun 2021 16:05:46 +0000 (11:05 -0500)]
[IROutliner] Adding DebugInfo handling for IR Outlined Functions

This adds support for functions outlined by the IR Outliner to be
recognized by the debugger.  The expected behavior is that it will
skip over the instructions included in that section.  This is due to the
fact that we can not say which of the original locations the
instructions originated from.

These functions will show up in the call stack, but you cannot step
through them.

Reviewers: paquette, vsk, djtodoro

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

3 years ago[mlir][linalg] Adapt yaml codegen to support scalar parameters.
Tobias Gysi [Tue, 15 Jun 2021 13:32:12 +0000 (13:32 +0000)]
[mlir][linalg] Adapt yaml codegen to support scalar parameters.

The patch updates the C++ yaml code generation to support scalar operands as added in https://reviews.llvm.org/D104220.

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

3 years agoWork around MSVC compiler intricacies.
Adrian Prantl [Tue, 15 Jun 2021 15:17:28 +0000 (08:17 -0700)]
Work around MSVC compiler intricacies.

3 years ago[flang] [openmp] Add Fortran specific semantic check 4 for OpenMP Allocate directive.
Isaac Perry [Thu, 13 May 2021 13:52:01 +0000 (14:52 +0100)]
[flang] [openmp] Add Fortran specific semantic check 4 for OpenMP Allocate directive.

This patch adds the 4th Fortran specific semantic check for the OpenMP
allocate directive: "If a list item has the SAVE attribute, is a common
block name, or is declared in the scope of a module, then only predefined
memory allocator parameters can be used in the allocator clause".

Code in this patch was based on code from https://reviews.llvm.org/D93549/new/.

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

3 years agoRevert "[libc] Add a set of elementary operations"
Guillaume Chatelet [Tue, 15 Jun 2021 14:59:46 +0000 (14:59 +0000)]
Revert "[libc] Add a set of elementary operations"

This reverts commit 8387187c2ffe0bef0696edfffab00cd7d0ee3e6e.

3 years ago[libcxx][atomic] Fix failure mapping in compare_exchange_{strong,weak}.
Jordan Rupprecht [Tue, 15 Jun 2021 14:55:23 +0000 (07:55 -0700)]
[libcxx][atomic] Fix failure mapping in compare_exchange_{strong,weak}.

https://eel.is/c++draft/atomics.types.operations#23 says: ... the value of failure is order except that a value of `memory_order::acq_rel` shall be replaced by the value `memory_order::acquire` and a value of `memory_order::release` shall be replaced by the value `memory_order::relaxed`.

This failure mapping is only handled for `_LIBCPP_HAS_GCC_ATOMIC_IMP`. We are seeing bad code generation for `compare_exchange_strong(cmp, 1, std::memory_order_acq_rel)` when using libc++ in place of libstdc++: https://godbolt.org/z/v3onrrq4G.

This was caught by tsan tests after D99434, `[TSAN] Honor failure memory orders in AtomicCAS`, but appears to be an issue in non-tsan code.

Reviewed By: ldionne, dvyukov

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

3 years ago[mlir] Avoid GCC naming conflict.
Tobias Gysi [Tue, 15 Jun 2021 14:36:54 +0000 (14:36 +0000)]
[mlir] Avoid GCC naming conflict.

Rename AbstractType to AbstractTy to avoid a GCC naming conflict after https://reviews.llvm.org/D104234.

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

3 years ago[libc] Add a set of elementary operations
Guillaume Chatelet [Tue, 15 Jun 2021 07:57:13 +0000 (07:57 +0000)]
[libc] Add a set of elementary operations

Resubmission of D100646 now making sure that we handle cases were `__builtin_memcpy_inline` is not available.

Original commit message:
Each of these elementary operations can be assembled to support higher order constructs (Overlapping access, Loop, Aligned Loop).
The patch does not compile yet as it depends on other ones (D100571, D100631) but it allows to get the conversation started.

A self-contained version of this code is available at https://godbolt.org/z/e1x6xdaxM

3 years ago[ARM] Rejig some of the MVE gather/scatter lowering pass. NFC
David Green [Tue, 15 Jun 2021 14:38:39 +0000 (15:38 +0100)]
[ARM] Rejig some of the MVE gather/scatter lowering pass. NFC

This adjusts some of how the gather/scatter lowering pass passes around
data and where certain gathers/scatters are created from. It should not
effect code generation on its own, but allows other patches to more
clearly reason about the code.

A number of extra test cases were also added for smaller gathers/
scatters that can be extended, and some of the test comments were
updated.

3 years ago[llvm-exegesis] Fix X86LbrCounter destructor to correctly unmap memory and not double...
Simon Pilgrim [Tue, 15 Jun 2021 13:16:28 +0000 (14:16 +0100)]
[llvm-exegesis] Fix X86LbrCounter destructor to correctly unmap memory and not double-close fd (PR50620)

As was reported on PR50620, the X86LbrCounter destructor was double-closing the filedescriptor and not unmapping the buffer.

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

3 years ago[mlir] Add SignOp to complex dialect.
Adrian Kuegel [Tue, 15 Jun 2021 12:06:11 +0000 (14:06 +0200)]
[mlir] Add SignOp to complex dialect.

Also add a conversion pattern from Complex Dialect to Standard/Math Dialect.

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

3 years ago[mlir] separable registration of attribute and type interfaces
Alex Zinenko [Mon, 14 Jun 2021 15:26:17 +0000 (17:26 +0200)]
[mlir] separable registration of attribute and type interfaces

It may be desirable to provide an interface implementation for an attribute or
a type without modifying the definition of said attribute or type. Notably,
this allows to implement interfaces for attributes and types outside of the
dialect that defines them and, in particular, provide interfaces for built-in
types. Provide the mechanism to do so.

Currently, separable registration requires the attribute or type to have been
registered with the context, i.e. for the dialect containing the attribute or
type to be loaded. This can be relaxed in the future using a mechanism similar
to delayed dialect interface registration.

See https://llvm.discourse.group/t/rfc-separable-attribute-type-interfaces/3637

Depends On D104233

Reviewed By: rriddle

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

3 years ago[mlir][linalg][python] Adapt the OpDSL to use scalars.
Tobias Gysi [Tue, 15 Jun 2021 08:35:10 +0000 (08:35 +0000)]
[mlir][linalg][python] Adapt the OpDSL to use scalars.

The patch replaces the existing capture functionality by scalar operands that have been introduced by https://reviews.llvm.org/D104109. Scalar operands behave as tensor operands except for the fact that they are not indexed. As a result ScalarDefs can be accessed directly as no indexing expression is needed.

The patch only updates the OpDSL. The C++ side is updated by a follow up patch.

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

3 years ago[libc++] [test] Fix some GCC 11 errors/warnings in these tests. NFCI.
Arthur O'Dwyer [Mon, 14 Jun 2021 14:25:13 +0000 (10:25 -0400)]
[libc++] [test] Fix some GCC 11 errors/warnings in these tests. NFCI.

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

3 years ago[Matrix] Add tests for fast-math flags & matrix codegen.
Florian Hahn [Tue, 15 Jun 2021 12:16:23 +0000 (13:16 +0100)]
[Matrix] Add tests for fast-math flags & matrix codegen.

This has already been implemented in be2277fbf233 which adds
pragma fp support. This patch just adds test coverage for
regular fast-math flags (PR46165).

3 years ago[Polly][Isl] Replacing isl method `to_str()` with `stringFromIslObj()`. NFC.
patacca [Tue, 15 Jun 2021 12:21:40 +0000 (14:21 +0200)]
[Polly][Isl] Replacing isl method `to_str()` with `stringFromIslObj()`. NFC.

This is part of an effort to reduce the differences between the custom C++ bindings used right now by polly in `lib/External/isl/include/isl/isl-noxceptions.h` and the official isl C++ interface.

Changes made:
 - Removing method `to_str()` from all the classes in the isl C++ bindings.
 - Overload method `stringFromIslObj()` so it accepts isl C++ objects.
 - To keep backward compatibility `stringFromIslObj()` now accepts a value that is returned if the isl C object is `null` or doesn't have a string representation (by default it's an empty string). In some cases it's better to have the string "null" instead of an empty string.
 - isl-noexceptions.h has been generated by this https://github.com/patacca/isl/commit/d33ec3a3bbaf971b254a853e6d8200ff9f5a1385

Reviewed By: Meinersbur

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

3 years ago[gn build] Port 4eb9fe2e1a07
LLVM GN Syncbot [Tue, 15 Jun 2021 12:01:01 +0000 (12:01 +0000)]
[gn build] Port 4eb9fe2e1a07

3 years ago[OPENMP]Fix PR50699: capture locals in combine directrives for aligned clause.
Alexey Bataev [Mon, 14 Jun 2021 19:28:39 +0000 (12:28 -0700)]
[OPENMP]Fix PR50699: capture locals in combine directrives for aligned clause.

Need to capture locals in aligned clauses for the combined directives to
be fix the crash in the codegen.

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

3 years ago[LoopDeletion] Check for irreducible cycles when deleting loops.
Florian Hahn [Tue, 15 Jun 2021 11:53:24 +0000 (12:53 +0100)]
[LoopDeletion] Check for irreducible cycles when deleting loops.

Loops with irreducible cycles may loop infinitely. Those cannot be
removed, unless the loop/function is marked as mustprogress.

Also discussed in D103382.

Reviewed By: nikic

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

3 years ago[ORC] Fix endianness in manual serialization to match WrapperFunctionUtils.
Lang Hames [Tue, 15 Jun 2021 11:51:52 +0000 (21:51 +1000)]
[ORC] Fix endianness in manual serialization to match WrapperFunctionUtils.

3 years ago[ORC] Fix missing std::move.
Lang Hames [Tue, 15 Jun 2021 11:42:58 +0000 (21:42 +1000)]
[ORC] Fix missing std::move.

3 years ago[ORC] Fix narrowing-in-initializer-list warnings.
Lang Hames [Tue, 15 Jun 2021 11:39:16 +0000 (21:39 +1000)]
[ORC] Fix narrowing-in-initializer-list warnings.

3 years ago[ORC] Fix missing function in unit test.
Lang Hames [Tue, 15 Jun 2021 11:28:06 +0000 (21:28 +1000)]
[ORC] Fix missing function in unit test.

3 years ago[mlir] ODS: do not emit trailing const for static methods
Alex Zinenko [Mon, 14 Jun 2021 15:26:03 +0000 (17:26 +0200)]
[mlir] ODS: do not emit trailing const for static methods

The generated C++ would be invalid.

Reviewed By: rriddle

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

3 years agoClearly specify that these are partially implemented features
Aaron Ballman [Tue, 15 Jun 2021 11:26:41 +0000 (07:26 -0400)]
Clearly specify that these are partially implemented features

3 years ago[ORC] Make WrapperFunctionResult's ValuePtr member non-const.
Lang Hames [Tue, 15 Jun 2021 11:24:12 +0000 (21:24 +1000)]
[ORC] Make WrapperFunctionResult's ValuePtr member non-const.

The const qualifier was a hangover from an earlier iteration that allowed
wrapper functions to return pointers to const memory. This feature has
been removed, so there's no reason for this to be const any more, and
removing it eliminates const-cast warnings.

3 years ago[ORC] Port WrapperFunctionUtils and SimplePackedSerialization from ORC runtime.
Lang Hames [Tue, 15 Jun 2021 10:26:51 +0000 (20:26 +1000)]
[ORC] Port WrapperFunctionUtils and SimplePackedSerialization from ORC runtime.

Replace the existing WrapperFunctionResult type in
llvm/include/ExecutionEngine/Orc/Shared/TargetProcessControlTypes.h with a
version adapted from the ORC runtime's implementation.

Also introduce the SimplePackedSerialization scheme (also adapted from the ORC
runtime's implementation) for wrapper functions to avoid manual serialization
and deserialization for calls to runtime functions involving common types.

3 years ago[mlir][MemRef] Make sure types match when folding dim(reshape)
Benjamin Kramer [Tue, 15 Jun 2021 10:32:16 +0000 (12:32 +0200)]
[mlir][MemRef] Make sure types match when folding dim(reshape)

Reshape can take integer types in addition to index, but dim always
returns index.

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

3 years ago[mlir] Add NegOp to complex dialect.
Adrian Kuegel [Tue, 15 Jun 2021 09:46:22 +0000 (11:46 +0200)]
[mlir] Add NegOp to complex dialect.

Also add a lowering pattern from complex dialect to standard dialect.

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

3 years agoABI breaking changes fixes.
Neil Henning [Mon, 14 Jun 2021 11:13:18 +0000 (12:13 +0100)]
ABI breaking changes fixes.

This commit mostly just replaces bad uses of `NDEBUG` with uses of
`LLVM_ENABLE_ABI_BREAKING_CHANGES` - the safe way to include ABI
breaking changes (normally extra struct elements in headers).

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

3 years ago[lldb] Fix libstdc++ 11's std::unique_ptr affecting LLDB testsuite TestDataFormatterS...
Jan Kratochvil [Tue, 15 Jun 2021 09:19:20 +0000 (11:19 +0200)]
[lldb] Fix libstdc++ 11's std::unique_ptr affecting LLDB testsuite TestDataFormatterStdUniquePtr.py

libstdc++ since version 11 has a conditional compilation based on
[[no_unique_address]] availability whether one element is either
inherited or put there as a field with [[no_unique_address]].

The code comment is by teemperor.

Reviewed By: teemperor

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

3 years ago[X86] Schedule-model second (mask) output of GATHER instruction
Roman Lebedev [Tue, 15 Jun 2021 08:55:46 +0000 (11:55 +0300)]
[X86] Schedule-model second (mask) output of GATHER instruction

Much like `mulx`'s `WriteIMulH`, there are two outputs of
AVX2 GATHER instructions. This was changed back in rL160110,
but the sched model change wasn't present.

So right now, for sched models that are marked as complete
(`znver3` only now), codegen'ning `GATHER` results in a crash:
```
DefIdx 1 exceeds machine model writes for early-clobber renamable $ymm3, dead early-clobber renamable $ymm2 = VPGATHERDDYrm killed renamable $ymm3(tied-def 0), undef renamable $rax, 4, renamable $ymm0, 0, $noreg, killed renamable $ymm2(tied-def 1) :: (load 32, align 1)
```
https://godbolt.org/z/Ks7zW7WGh

I'm guessing we need to deal with this like we deal with `WriteIMulH`.

Reviewed By: RKSimon

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

3 years ago[analyzer] Decouple NoteTag from its Factory
Valeriy Savchenko [Fri, 11 Jun 2021 13:14:29 +0000 (16:14 +0300)]
[analyzer] Decouple NoteTag from its Factory

This allows us to create other types of tags that carry useful
bits of information alongside.

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

3 years ago[MCA][InstrBuilder] Check for the presence of flag VariadicOpsAreDefs.
Andrea Di Biagio [Mon, 14 Jun 2021 23:52:16 +0000 (00:52 +0100)]
[MCA][InstrBuilder] Check for the presence of flag VariadicOpsAreDefs.

This patch fixes the logic that checks for variadic register definitions,

Before llvm-svn 348114 (commit 4cf35b4ab0b), it was not possible to explicitly
mark variadic operands as definitions. By default, variadic operands of an
MCInst were always assumed to be uses. A number of had-hoc checks were
introduced in the InstrBuilder to fix the processing of variadic register
operands of ARM ldm/stm variants.

This patch simply replaces those old (and buggy) checks with a much simpler (and
correct) check for MCID::Flag::VariadicOpsAreDefs.

3 years agoFix Windows builders after 244601f4720d9cda6e81ea1908f3ce905a4bcb0e
Alex Richardson [Tue, 15 Jun 2021 08:47:29 +0000 (09:47 +0100)]
Fix Windows builders after 244601f4720d9cda6e81ea1908f3ce905a4bcb0e

Apparently __builtin_abort() is not supported when targetting Windows.
This should fix the following builder errors:
clang_rt.builtins-x86_64.lib(int_util.c.obj) : error LNK2019: unresolved
external symbol __builtin_abort referenced in function __compilerrt_abort_impl

3 years ago[analyzer] Simplify the process of producing notes for stores
Valeriy Savchenko [Thu, 10 Jun 2021 17:18:40 +0000 (20:18 +0300)]
[analyzer] Simplify the process of producing notes for stores

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

3 years ago[analyzer] Extract InlinedFunctionCallHandler
Valeriy Savchenko [Wed, 9 Jun 2021 12:44:10 +0000 (15:44 +0300)]
[analyzer] Extract InlinedFunctionCallHandler

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

3 years ago[analyzer] Extract InterestingLValueHandler
Valeriy Savchenko [Tue, 8 Jun 2021 17:56:10 +0000 (20:56 +0300)]
[analyzer] Extract InterestingLValueHandler

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

3 years ago[analyzer] Extract ArrayIndexHandler
Valeriy Savchenko [Tue, 8 Jun 2021 17:29:57 +0000 (20:29 +0300)]
[analyzer] Extract ArrayIndexHandler

One interesting problem was discovered here.  When we do interrupt
Tracker's track flow, we want to interrupt only it and not all the
other flows recursively.

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

3 years ago[analyzer] Extract NilReceiverHandler
Valeriy Savchenko [Tue, 8 Jun 2021 15:43:16 +0000 (18:43 +0300)]
[analyzer] Extract NilReceiverHandler

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

3 years ago[analyzer] Extract ControlDependencyHandler
Valeriy Savchenko [Fri, 4 Jun 2021 08:59:27 +0000 (11:59 +0300)]
[analyzer] Extract ControlDependencyHandler

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

3 years ago[analyzer] Refactor StoreSiteFinder and extract DefaultStoreHandler
Valeriy Savchenko [Thu, 10 Jun 2021 12:44:49 +0000 (15:44 +0300)]
[analyzer] Refactor StoreSiteFinder and extract DefaultStoreHandler

After this patch, custom StoreHandlers will also work as expected.

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

3 years ago[clang-format] distinguish function type casts after 21c18d5a04316891110cecc2bf37ce51...
Krasimir Georgiev [Tue, 15 Jun 2021 08:28:25 +0000 (10:28 +0200)]
[clang-format] distinguish function type casts after 21c18d5a04316891110cecc2bf37ce51533decba

https://github.com/llvm/llvm-project/commit/21c18d5a04316891110cecc2bf37ce51533decba
improved the detection of multiplication in function call argument lists,
but unintentionally regressed the handling of function type casts (there
were no tests covering those).
This patch improves the detection of function type casts and adds a few tests.

Reviewed By: HazardyKnusperkeks

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

3 years ago[mlir][linalg] Fold linalg.pad_tensor if src type == result type
Matthias Springer [Tue, 15 Jun 2021 08:16:32 +0000 (17:16 +0900)]
[mlir][linalg] Fold linalg.pad_tensor if src type == result type

Fold PadTensorOp to source if source type and result type have static shape and are equal.

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

3 years ago[IR] Remove forward declaration of GraphTraits from Type.h
Jay Foad [Fri, 11 Jun 2021 14:22:14 +0000 (15:22 +0100)]
[IR] Remove forward declaration of GraphTraits from Type.h

This has been unnecessary since r352353 removed GraphTraits
specializations for Type, except that a couple of other headers were
accidentally relying on this declaration.

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

3 years ago[builtins] Allow compiling the builtins without libc headers
Alex Richardson [Tue, 15 Jun 2021 08:08:59 +0000 (09:08 +0100)]
[builtins] Allow compiling the builtins without libc headers

When compiled with -ffreestanding, we should not assume that headers
declaring functions such as abort() are available. While the compiler may
still emit calls to those functions [1], we should not require the headers
to build compiler-rt since that can result in a cyclic dependency graph:
The compiler-rt functions might be required to build libc.so, but the libc
headers such as stdlib.h might only be available once libc has been built.

[1] From https://gcc.gnu.org/onlinedocs/gcc/Standards.html:
GCC requires the freestanding environment provide memcpy, memmove,
memset and memcmp. Finally, if __builtin_trap is used, and the target
does not implement the trap pattern, then GCC emits a call to abort.

Reviewed By: phosek

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

3 years agoRevert "[libc] Add a set of elementary operations"
Guillaume Chatelet [Tue, 15 Jun 2021 08:01:59 +0000 (08:01 +0000)]
Revert "[libc] Add a set of elementary operations"

This reverts commit 454d92ac3b3b13f5c8b3f57e03b2d93f0cf60738.

3 years ago[libc] Add a set of elementary operations
Guillaume Chatelet [Tue, 15 Jun 2021 07:57:13 +0000 (07:57 +0000)]
[libc] Add a set of elementary operations

Resubmission of D100646 now making sure that we handle cases were `__builtin_memcpy_inline` is not available.

Original commit message:
Each of these elementary operations can be assembled to support higher order constructs (Overlapping access, Loop, Aligned Loop).
The patch does not compile yet as it depends on other ones (D100571, D100631) but it allows to get the conversation started.

A self-contained version of this code is available at https://godbolt.org/z/e1x6xdaxM

3 years agoSupport buffers in LinalgFoldUnitExtentDims
Tres Popp [Wed, 2 Jun 2021 11:29:43 +0000 (13:29 +0200)]
Support buffers in LinalgFoldUnitExtentDims

This doesn't add any canonicalizations, but executes the same
simplification on bufferSemantic linalg.generic ops by using
linalg::ReshapeOp instead of linalg::TensorReshapeOp.

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

3 years ago[gn build] Port d0a5d8611935
LLVM GN Syncbot [Tue, 15 Jun 2021 05:56:32 +0000 (05:56 +0000)]
[gn build] Port d0a5d8611935

3 years ago[Debug-Info][CodeView] Fix GUID string generation for MSVC generated objects.
CarlosAlbertoEnciso [Tue, 15 Jun 2021 05:52:50 +0000 (06:52 +0100)]
[Debug-Info][CodeView] Fix GUID string generation for MSVC generated objects.

This patch is to address https://bugs.llvm.org/show_bug.cgi?id=50459.
  YAML:455:28: error: GUID strings are 38 characters long

The valid format for a GUID is {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
where X is a hex digit (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F).
The length of the individual components must be: 8, 4, 4, 4, 12.

For some cases, the converted string generated by obj2yaml, does not
comply with those lengths. yaml2obj checks that the GUID string must
be 38 characters including the dashes and braces.

Reviewed By: amccarth

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

3 years ago[ORC-RT] Fix void function handling in the WrapperFunction utility.
Lang Hames [Tue, 15 Jun 2021 01:56:37 +0000 (11:56 +1000)]
[ORC-RT] Fix void function handling in the WrapperFunction utility.

Handlers returning void previously caused compile errors. Fix that by
substituting SPSEmpty placeholder values.

3 years agoRevert "[NFC] This is a test commit to check commit access."
CarlosAlbertoEnciso [Tue, 15 Jun 2021 05:23:27 +0000 (06:23 +0100)]
Revert "[NFC] This is a test commit to check commit access."

This reverts commit b4d40e19def8c2e1a77ae30b5ac16751d1c461f7.