platform/upstream/llvm.git
3 years ago[InstCombine] convert lshr to ashr to eliminate cast op
Sanjay Patel [Thu, 3 Jun 2021 20:13:16 +0000 (16:13 -0400)]
[InstCombine] convert lshr to ashr to eliminate cast op

This is similar to b865eead7657 ( D103617 ) and fixes:
https://llvm.org/PR50575

41b71f718b94c6f12b did this and more (noted with TODO
comments in the tests), but it didn't handle the case
where the destination is narrower than the source, so
it got reverted.

This is a simple match-and-replace. If there's evidence
that the TODO cases are useful, we can revisit/extend.

3 years ago[InstCombine] add tests for sext-of-trunc-of-lshr; NFC
Sanjay Patel [Thu, 3 Jun 2021 19:53:11 +0000 (15:53 -0400)]
[InstCombine] add tests for sext-of-trunc-of-lshr; NFC

3 years agoRevert "[gn build] port d1d36f7ad (llvm-tapi-diff)"
Nico Weber [Fri, 4 Jun 2021 10:46:19 +0000 (06:46 -0400)]
Revert "[gn build] port d1d36f7ad (llvm-tapi-diff)"

This reverts commit 13155138c1ce1e91032d467e20e557f9cdbf08f5.
d1d36f7ad was reverted in 5337c7550d.

3 years agoRe-land ae4303b42c, "Track PHI values through register coalescing"
Jeremy Morse [Fri, 4 Jun 2021 10:18:40 +0000 (11:18 +0100)]
Re-land ae4303b42c, "Track PHI values through register coalescing"

Was reverted in 0507fc2ffc9, in phi-coalesce-subreg.mir I'd explicitly named
some passes to run instead of specifying a range. As a result some
two-address-instrs weren't correctly rewritten and the verifier got upset.
Original commit message:

[DebugInstrRef][2/3] Track PHI values through register coalescing

In the instruction referencing variable location model, we store variable
locations that point at PHIs in MachineFunction during register allocation.
Unfortunately, register coalescing can substantially change the locations
of registers, and so that PHI-variable-location side table needs
maintenence during the pass.

This patch builds an index from the side table, and whenever a vreg gets
coalesced into another vreg, update the index to record the new vreg that
the PHI happens in. It also accepts a limited range of subregister
coalescing, for example merging a subregister into a larger class.

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

3 years ago[test] Fix accidental match in parent_recurse_depth.s
Thomas Preud'homme [Fri, 4 Jun 2021 08:55:33 +0000 (09:55 +0100)]
[test] Fix accidental match in parent_recurse_depth.s

The CHECK-NOT directives in
tools/llvm-dwarfdump/X86/parent_recurse_depth.s can accidentally match
something in the path of the object file created by yaml2obj, for
example:

llvm-project/llvm/test/tools/llvm-dwarfdump/X86/parent_recurse_depth.s:13:12:
error: ONE-NOT: excluded string found in input
           ^
<stdin>:1:22: note: found here
builds/llvm-projects/mainline/release/test/tools/llvm-dwarfdump/X86/Output/parent_recurse_depth.s.tmp.o: file format elf64-x86-64
                     ^~~~

This commit alleviate this issue by consuming the file name from the
output, forcing all the CHECK-NOT to match what comes after.

Reviewed By: Higuoxing

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

3 years ago[lldb][NFC] Remove a redundant call to weak_ptr::expired
Raphael Isemann [Fri, 4 Jun 2021 08:59:31 +0000 (10:59 +0200)]
[lldb][NFC] Remove a redundant call to weak_ptr::expired

The `lock` call directly will check for us if the `weak_ptr` is expired and
returns an invalid `shared_ptr` (which we correctly handle), so this check is
redundant.

Reviewed By: JDevlieghere

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

3 years ago[libcxx] Don't use an undefined '+' in unsigned/octal/hexal print formats
Martin Storsjö [Tue, 1 Jun 2021 09:04:58 +0000 (09:04 +0000)]
[libcxx] Don't use an undefined '+' in unsigned/octal/hexal print formats

If building code like this:

    unsigned long val = 1000;
    snprintf(buf, sizeof(buf), "%+lu", val);

with clang, clang warns

    warning: flag '+' results in undefined behavior with 'u' conversion specifier [-Wformat]

Therefore, don't construct such undefined format strings. (There's
no compiler warnings here, as the compiler can't inspect dynamically
assembled format strings.)

This fixes number formatting in mingw-w64 if built with
`__USE_MINGW_ANSI_STDIO` defined (there, the '+' flag causes a
leading plus to be printed when formatting unsigned numbers too,
while the '+' flag doesn't cause any extra leading plus in other
stdio implementations).

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

3 years ago[SelectionDAG] Extend FoldConstantVectorArithmetic to SPLAT_VECTOR
Fraser Cormack [Thu, 27 May 2021 12:45:23 +0000 (13:45 +0100)]
[SelectionDAG] Extend FoldConstantVectorArithmetic to SPLAT_VECTOR

This patch extends the SelectionDAG's ability to constant-fold vector
arithmetic to include support for SPLAT_VECTOR. This is not only for
scalable-vector types but also for fixed-length vector types, which
helps Hexagon in a couple of cases.

The original RISC-V test case was in fact an infinite DAGCombine loop.
The pattern `and (truncate v1), (truncate v2)` can be combined to
`truncate (and v1, v2)` but the truncate can similarly be combined back
to `truncate (and v1, v2)` (but, crucially, only when one of `v1` or
`v2` is a constant vector).

It wasn't exposed in on fixed-length types because a TRUNCATE of a
constant BUILD_VECTOR was folded into the BUILD_VECTOR itself, whereas
this did not happen for the equivalent (scalable-vector) SPLAT_VECTOR.

Reviewed By: RKSimon, craig.topper

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

3 years ago[mlir][linalg] Cleanup left over uses of deprecated LinalgOp methods.
Tobias Gysi [Fri, 4 Jun 2021 08:18:19 +0000 (08:18 +0000)]
[mlir][linalg] Cleanup left over uses of deprecated LinalgOp methods.

Replace all remaining uses of deprecated Structured Op Interface methods. This patch is based on https://reviews.llvm.org/D103394.

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

3 years agoAArch64: support atomic zext/sextloads
Tim Northover [Wed, 5 May 2021 12:12:55 +0000 (13:12 +0100)]
AArch64: support atomic zext/sextloads

3 years ago[flang] Change capitalization for Adjustl/r
Diana Picus [Mon, 31 May 2021 08:51:11 +0000 (08:51 +0000)]
[flang] Change capitalization for Adjustl/r

Rename the definitions of the character runtime functions Adjustl and
Adjustr (used to be AdjustL and AdjustR respectively).

Also add unit tests (and move some of the helpers to the top of the
file, since they're now used in more than one place).

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

3 years ago[Debug-Info] handle DW_CC_pass_by_value/DW_CC_pass_by_reference under strict DWARF.
Esme-Yi [Fri, 4 Jun 2021 08:14:47 +0000 (08:14 +0000)]
[Debug-Info] handle DW_CC_pass_by_value/DW_CC_pass_by_reference under strict DWARF.

Summary: When -strict-dwarf=true is specified, the calling convention info
    DW_CC_pass_by_value or DW_CC_pass_by_reference can only be generated at DWARF5.

Reviewed By: shchenz, dblaikie

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

3 years ago[Format] Fix incorrect pointer detection
Yilong Guo [Fri, 4 Jun 2021 07:37:21 +0000 (09:37 +0200)]
[Format] Fix incorrect pointer detection

https://llvm.org/PR50429

Before:
    void f() { f(float(1), a *a); }

After:
    void f() { f(float(1), a * a); }

Signed-off-by: Yilong Guo <yilong.guo@intel.com>
Reviewed By: HazardyKnusperkeks, curdeius

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

3 years ago[Sema][RISCV][SVE] Allow ?: to select Typedef BuiltinType in C
ShihPo Hung [Thu, 3 Jun 2021 08:10:21 +0000 (16:10 +0800)]
[Sema][RISCV][SVE] Allow ?: to select Typedef BuiltinType in C

This patch solves an error such as:
  incompatible operand types ('vbool4_t' (aka '__rvv_bool4_t') and '__rvv_bool4_t')
when one of the value is a TypedefType of the other value in ?:.

Reviewed By: rjmccall

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

3 years agoAdd LLDB in release binaries by default
Muhammad Omair Javaid [Fri, 4 Jun 2021 06:56:28 +0000 (11:56 +0500)]
Add LLDB in release binaries by default

LLDB is currently not selected in LLVM release testing and thus it
doesnt make its way into prebuilt binaries which build with default
configuration. This patch enables LLDB by default in test-release
script.

Assuming LLDB build by default was disabled back in 2016 LLDB support
for various architectures has a long way since then. It has buildbots
for most architectures and supports a case to be included by default.

Also lldb build can easily be disabled in case some release managers
choose to do so.

Reviewed By: tstellar

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

3 years ago[AMDGPU] [IndirectCalls] Don't propagate attributes to address taken functions and...
madhur13490 [Wed, 26 May 2021 05:47:03 +0000 (11:17 +0530)]
[AMDGPU] [IndirectCalls] Don't propagate attributes to address taken functions and their callees

Don't propagate launch bound related attributes to
address taken functions and their callees. The idea
is to do a traversal over the call graph starting at
address taken functions and erase the attributes
set by previous logic i.e. process().

This two phase approach makes sure that we don't
miss out on deep nested callees from address taken
functions as a function might be called directly as
well as indirectly.

This patch is also reattempt to D94585 as latent issues
are fixed in hasAddressTaken function in the recent
past.

Reviewed By: arsenm

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

3 years agoRevert "[AMDGPU] Increase alignment of LDS globals if necessary before LDS lowering."
hsmahesha [Fri, 4 Jun 2021 05:46:46 +0000 (11:16 +0530)]
Revert "[AMDGPU] Increase alignment of LDS globals if necessary before LDS lowering."

This reverts commit d71ff907ef23eaef86ad66ba2d711e4986cd6cb2.

3 years agoRevert "[llvm] llvm-tapi-diff"
Cyndy Ishida [Fri, 4 Jun 2021 03:53:06 +0000 (20:53 -0700)]
Revert "[llvm] llvm-tapi-diff"

This reverts commit d1d36f7ad2ae82bea8a6fcc40d6c42a72e21f096.
Reverting this patch to investigate linux bot failures
 + fix with author offline

3 years ago[AMDGPU] Increase alignment of LDS globals if necessary before LDS lowering.
hsmahesha [Fri, 4 Jun 2021 04:04:37 +0000 (09:34 +0530)]
[AMDGPU] Increase alignment of LDS globals if necessary before LDS lowering.

Before packing LDS globals into a sorted structure, make sure that
their alignment is properly updated based on their size. This will make
sure that the members of sorted structure are properly aligned, and
hence it will further reduce the probability of unaligned LDS access.

Reviewed By: rampitec

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

3 years ago[NFC] Remove checking pointee type for byval/preallocated type
Arthur Eubanks [Fri, 4 Jun 2021 01:57:36 +0000 (18:57 -0700)]
[NFC] Remove checking pointee type for byval/preallocated type

These currently always require a type parameter. The bitcode reader
already upgrades old bitcode without the type parameter to use the
pointee type.

3 years ago[scudo] Rework Vector/String
Kostya Kortchinsky [Thu, 3 Jun 2021 19:11:05 +0000 (12:11 -0700)]
[scudo] Rework Vector/String

Some platforms (eg: Trusty) are extremelly memory constrained, which
doesn't necessarily work well with some of Scudo's current assumptions.

`Vector` by default (and as such `String` and `ScopedString`) maps a
page, which is a bit of a waste. This CL changes `Vector` to use a
buffer local to the class first, then potentially map more memory if
needed (`ScopedString` currently are all stack based so it would be
stack data). We also want to allow a platform to prevent any dynamic
resizing, so I added a `CanGrow` templated parameter that for now is
always `true` but would be set to `false` on Trusty.

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

3 years agoRevert "Update and improve compiler-rt tests for -mllvm -asan_use_after_return=(never...
Nico Weber [Fri, 4 Jun 2021 01:01:11 +0000 (21:01 -0400)]
Revert "Update and improve compiler-rt tests for -mllvm -asan_use_after_return=(never|[runtime]|always)."

This reverts commit 41b3088c3f33d712e3d2f64b66ae4eb701fa4bfb.
Doesn't build on macOS, see comments on https://reviews.llvm.org/D103304

3 years ago[lld/mac] Add test coverage for --reproduce + -flat_namespace
Nico Weber [Thu, 3 Jun 2021 19:29:22 +0000 (15:29 -0400)]
[lld/mac] Add test coverage for --reproduce + -flat_namespace

Works fine already, now it has a test too.

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

3 years ago[CSSPGO][llvm-profgen] Make extended binary the default output format
Wenlei He [Thu, 3 Jun 2021 20:42:24 +0000 (13:42 -0700)]
[CSSPGO][llvm-profgen] Make extended binary the default output format

Make extended binary the default output format for CSSPGO. This avoids having to pass flag every time when generating profile. It also matches llvm-profdata where binary profile is the default (should we switch to extbinary as default for llvm-profdata?).

We plan to compress name table for context profile, which depends on the built-in compression of extbinary.

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

3 years ago[RISCV] Simplify some code in RISCVInsertVSETVLI by calling an existing function...
Craig Topper [Fri, 4 Jun 2021 00:31:54 +0000 (17:31 -0700)]
[RISCV] Simplify some code in RISCVInsertVSETVLI by calling an existing function that does the same thing. NFCI

3 years ago[NFC] Add ArrayRef includes to two files.
Stella Laurenzo [Thu, 3 Jun 2021 23:38:12 +0000 (16:38 -0700)]
[NFC] Add ArrayRef includes to two files.

These started failing on one of our buildbots. I didn't completely root cause the situation and just added the explicit includes that correct the issue.

Reviewed By: rriddle, jpienaar

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

3 years ago[mlir][SPIRV] Add lowering for math.log1p operation to SPIR-V dialect.
MaheshRavishankar [Thu, 3 Jun 2021 23:25:56 +0000 (16:25 -0700)]
[mlir][SPIRV] Add lowering for math.log1p operation to SPIR-V dialect.

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

3 years ago[gn build] port d1d36f7ad (llvm-tapi-diff)
Nico Weber [Thu, 3 Jun 2021 23:22:21 +0000 (19:22 -0400)]
[gn build] port d1d36f7ad (llvm-tapi-diff)

3 years ago[mlir-lsp-server] Add support for tracking the use/def chains of symbols
River Riddle [Thu, 3 Jun 2021 23:03:57 +0000 (16:03 -0700)]
[mlir-lsp-server] Add support for tracking the use/def chains of symbols

This revision adds assembly state tracking for uses of symbols, allowing for go-to-definition and references support for SymbolRefAttrs.

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

3 years ago[HIP] Fix amdgcn builtin for long type
Yaxun (Sam) Liu [Wed, 2 Jun 2021 22:24:12 +0000 (18:24 -0400)]
[HIP] Fix amdgcn builtin for long type

Currently some amdgcn builtins are defined with long int type,
which causes invalid IR on Windows since long int is 32 bit
on Windows whereas these builtins have 64 bit arguments.

long long int type cannot be used since it is 128 bit in OpenCL.

This patch uses 64 bit int type instead of long int to define 64 bit int
arguments or return for amdgcn builtins.

Reviewed by: Artem Belevich

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

3 years ago[mlir] Remove redundant loads
Amy Zhuang [Thu, 3 Jun 2021 22:27:25 +0000 (15:27 -0700)]
[mlir] Remove redundant loads

Reviewed By: vinayaka-polymage, bondhugula

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

3 years ago[TargetLowering] Only inspect attributes in the arguments for ArgListEntry
Arthur Eubanks [Mon, 31 May 2021 16:37:11 +0000 (09:37 -0700)]
[TargetLowering] Only inspect attributes in the arguments for ArgListEntry

Parameter attributes are considered part of the function [1], and like
mismatched calling conventions [2], we can't have the verifier check for
mismatched parameter attributes.

Issues can be diagnosed with D103412.

[1] https://llvm.org/docs/LangRef.html#parameter-attributes
[2] https://llvm.org/docs/FAQ.html#why-does-instcombine-simplifycfg-turn-a-call-to-a-function-with-a-mismatched-calling-convention-into-unreachable-why-not-make-the-verifier-reject-it

Reviewed By: rnk

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

3 years ago[BuildLibCalls] Properly set ABI attributes on arguments
Arthur Eubanks [Mon, 31 May 2021 16:15:25 +0000 (09:15 -0700)]
[BuildLibCalls] Properly set ABI attributes on arguments

Some floating point lib calls have ABI attributes that need to be set on
the caller. Found via D103412.

Reviewed By: rnk

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

3 years ago[flang] Fix spurious "already declared" errors for interfaces
peter klausler [Thu, 3 Jun 2021 00:33:34 +0000 (17:33 -0700)]
[flang] Fix spurious "already declared" errors for interfaces

When a subroutine or function symbol is defined in an INTERFACE
block, it's okay if a symbol of the same name appears in a
scope between the global scope and the scope of the INTERFACE.

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

3 years ago[libc++] Simplify apple-install-libcxx since we always use the same CMake cache
Louis Dionne [Thu, 3 Jun 2021 22:26:31 +0000 (18:26 -0400)]
[libc++] Simplify apple-install-libcxx since we always use the same CMake cache

3 years ago[CMake][ELF] Add -fno-semantic-interposition for GCC and Clang>=13
Fangrui Song [Thu, 3 Jun 2021 22:26:34 +0000 (15:26 -0700)]
[CMake][ELF] Add -fno-semantic-interposition for GCC and Clang>=13

In a `-DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_LINK_LLVM_DYLIB=on -DCLANG_LINK_CLANG_DYLIB=on`
build, libLLVM-13git.so is 2% smaller and libclang-cpp.so is 1% smaller (on top of -Wl,-Bsymbolic-functions).
There may be some small performance improvement as well because GCC
-fPIC suppresses interprocedural optimizations for non-inline
definitions by default.

Note: we cannot add -fno-semantic-interposition for Clang<13.  Clang<13's
implementation additionally optimizes global variables, which is incompatible
with unfortunate ELF -fno-pic default: direct access relocations for external
data. If the executable has a -fno-pic object file referencing a global variable
declared in a public header, the direct access relocation will cause a copy
relocation. The executable and libLLVM.so/libclang-cpp.so will disagree on the
address.

Reviewed By: phosek

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

3 years ago[flang] Catch errors in function calls instead of crashing
peter klausler [Thu, 3 Jun 2021 00:28:50 +0000 (17:28 -0700)]
[flang] Catch errors in function calls instead of crashing

Add some missing error messages, and permit the appearance
of EntityDetails symbols in dummy argument type characterization.

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

3 years ago[flang] Emit error about missing interface when needed
peter klausler [Thu, 3 Jun 2021 00:25:29 +0000 (17:25 -0700)]
[flang] Emit error about missing interface when needed

When a procedure pointer with no interface is called by a
function reference, complain about the lack.

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

3 years ago[libc++] Define _LIBCPP_NO_NATIVE_SEMAPHORES even outside of pthread
Louis Dionne [Thu, 3 Jun 2021 22:18:41 +0000 (18:18 -0400)]
[libc++] Define _LIBCPP_NO_NATIVE_SEMAPHORES even outside of pthread

<semaphore> needs to know about whether native semaphores are supported
or not, even if we're not using the pthread API.

3 years ago[libc++] Also build the static library in the Apple cache
Louis Dionne [Thu, 3 Jun 2021 22:15:13 +0000 (18:15 -0400)]
[libc++] Also build the static library in the Apple cache

3 years ago[flang] Fix crash on structure constructor as selector
peter klausler [Thu, 3 Jun 2021 00:21:41 +0000 (17:21 -0700)]
[flang] Fix crash on structure constructor as selector

In something like "ASSOCIATE(X=>T(1))", the "T(1)" is parsed
as a Variable because it looks like a function reference or
array reference; if it turns out to be a structure constructor,
which is something we can't know until we're able to attempt
generic interface resolution in semantics, the parse tree needs
to be fixed up by replacing the Variable with an Expr.

The compiler could already do this for putative function references
encapsulated as Exprs, so this patch moves some code around and
adds parser::Selector to the overloads of expression analysis.

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

3 years agoKill a variable which is unused after cddcc4cf [nfc]
Philip Reames [Thu, 3 Jun 2021 21:35:43 +0000 (14:35 -0700)]
Kill a variable which is unused after cddcc4cf [nfc]

3 years ago[NFC] Add missing includes for LLVM_ENABLE_MODULES builds
zero9178 [Thu, 3 Jun 2021 21:28:47 +0000 (23:28 +0200)]
[NFC] Add missing includes for LLVM_ENABLE_MODULES builds

Building LLVM with the LLVM_ENABLE_MODULES cmake option fails when the modules are being compiled due to missing includes. This is a side effect of some transitive includes that changed recently.

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

3 years ago[NFC][compiler-rt][hwasan] Refactor hwasan functions
Leonard Chan [Thu, 3 Jun 2021 21:22:37 +0000 (14:22 -0700)]
[NFC][compiler-rt][hwasan] Refactor hwasan functions

This moves the implementations for HandleTagMismatch, __hwasan_tag_mismatch4,
and HwasanAtExit from hwasan_linux.cpp to hwasan.cpp and declares them in hwasan.h.
This way, calls to those functions can be shared with the fuchsia implementation
without duplicating code.

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

3 years ago[flang] Support known constant lengths in DynamicType
peter klausler [Thu, 3 Jun 2021 00:13:55 +0000 (17:13 -0700)]
[flang] Support known constant lengths in DynamicType

The constexpr-capable class evaluate::DynamicType represented
CHARACTER length only with a nullable pointer into the declared
parameters of types in the symbol table, which works fine for
anything with a declaration but turns out to not suffice to
describe the results of the ACHAR() and CHAR() intrinsic
functions.  So extend DynamicType to also accommodate known
constant CHARACTER lengths, too; use them for ACHAR & CHAR;
clean up several use sites and fix regressions found in test.

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

3 years ago[LTO] Fix -fwhole-program-vtables handling after HIP ThinLTO patch
Teresa Johnson [Wed, 2 Jun 2021 23:37:23 +0000 (16:37 -0700)]
[LTO] Fix -fwhole-program-vtables handling after HIP ThinLTO patch

A recent change (D99683) to support ThinLTO for HIP caused a regression
when compiling cuda code with -flto=thin -fwhole-program-vtables.
Specifically, we now get an error:
error: invalid argument '-fwhole-program-vtables' only allowed with '-flto'

This error is coming from the device offload cc1 action being set up for
the cuda compile, for which -flto=thin doesn't apply and gets dropped.
This is a regression, but points to a potential issue that was silently
occurring before the patch, details below.

Before D99683, the check for fwhole-program-vtables in the driver looked
like:

  if (WholeProgramVTables) {
    if (!D.isUsingLTO())
      D.Diag(diag::err_drv_argument_only_allowed_with)
          << "-fwhole-program-vtables"
          << "-flto";
    CmdArgs.push_back("-fwhole-program-vtables");
  }

And D.isUsingLTO() returned true since we have -flto=thin. However,
because the cuda cc1 compile is doing device offloading, which didn't
support any LTO, there was other code that suppressed -flto* options
from being passed to the cc1 invocation. So the cc1 invocation silently
had -fwhole-program-vtables without any -flto*. This seems potentially
problematic, since if we had any virtual calls we would get type test
assume sequences without the corresponding LTO pass that handles them.

However, with the patch, which adds support for device offloading LTO
option -foffload-lto=thin, the code has changed so that we set a bool
IsUsingLTO based on either -flto* or -foffload-lto*, depending on
whether this is the device offloading action. For the device offload
action in our compile, since we don't have -foffload-lto, IsUsingLTO is
false, and the check for LTO with -fwhole-program-vtables now fails.

What we should do is only pass through -fwhole-program-vtables to the
cc1 invocation that has LTO enabled (either the device offload action
with -foffload-lto, or the non-device offload action with -flto), and
otherwise drop the -fwhole-program-vtables for the non-LTO action.
Then we should error only if we have -fwhole-program-vtables without any
-f*lto* options.

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

3 years agoA couple style tweaks on top of 5c0d1b2f9 [nfc]
Philip Reames [Thu, 3 Jun 2021 21:14:59 +0000 (14:14 -0700)]
A couple style tweaks on top of 5c0d1b2f9 [nfc]

3 years ago[LoopUnroll] Eliminate PreserveCondBr parameter and fix a bug in the process
Philip Reames [Thu, 3 Jun 2021 21:03:21 +0000 (14:03 -0700)]
[LoopUnroll] Eliminate PreserveCondBr parameter and fix a bug in the process

This builds on D103584. The change eliminates the coupling between unroll heuristic and implementation w.r.t. knowing when the passed in trip count is an exact trip count or a max trip count. In theory the new code is slightly less powerful (since it relies on exact computable trip counts), but in practice, it appears to cover all the same cases. It can also be extended if needed.

The test change shows what appears to be a bug in the existing code around the interaction of peeling and unrolling. The original loop only ran 8 iterations. The previous output had the loop peeled by 2, and then an exact unroll of 8. This meant the loop ran a total of 10 iterations which appears to have been a miscompile.

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

3 years ago[flang] Catch procedure pointer interface error
peter klausler [Thu, 3 Jun 2021 00:09:42 +0000 (17:09 -0700)]
[flang] Catch procedure pointer interface error

A procedure pointer is allowed to name a specific intrinsic function
from F'2018 table 16.2 as its interface, but not other intrinsic
procedures.  Catch this error, and thereby also fix a crash resulting
from a failure later in compilation from failed characteristics;
while here, also catch the similar error with initializers.

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

3 years ago[test] Update more clang/test/Profile tests
Fangrui Song [Thu, 3 Jun 2021 20:43:19 +0000 (13:43 -0700)]
[test] Update more clang/test/Profile tests

3 years ago[AMDGPU] Fix a crash when selecting a particular case of buffer_load_format_d16
Julien Pagès [Thu, 3 Jun 2021 20:32:15 +0000 (16:32 -0400)]
[AMDGPU] Fix a crash when selecting a particular case of buffer_load_format_d16

In this particular example, we had a crash when compiling it
for several architectures. This patch extends the legalization
of extract_subvector to avoid this problem.

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

3 years ago[test] Update c-linkage-available_externally.c
Fangrui Song [Thu, 3 Jun 2021 20:40:01 +0000 (13:40 -0700)]
[test] Update c-linkage-available_externally.c

3 years ago[flang] Accept BOZ in array constructors w/o types
peter klausler [Thu, 3 Jun 2021 00:02:43 +0000 (17:02 -0700)]
[flang] Accept BOZ in array constructors w/o types

As a benign extension common to other Fortran compilers,
accept BOZ literals in array constructors w/o explicit
types, treating them as integers.

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

3 years ago[Constants][PowerPC] Check exactlyValue for ppc_fp128 in isNullValue
Jinsong Ji [Thu, 3 Jun 2021 20:08:35 +0000 (20:08 +0000)]
[Constants][PowerPC] Check exactlyValue for ppc_fp128 in isNullValue

 PPC_FP128 determines isZero/isNan/isInf using high-order double value
 only. Checking isZero/isNegative might return the isNullValue unexpectedly.
 eg:
   0xM0000000000000000FFFFFFFFFFFFFFFFF

isZero, but it is not NullValue.

Reviewed By: efriedma

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

3 years ago[InstrProfiling] If no value profiling, make data variable private and (for Windows...
Fangrui Song [Thu, 3 Jun 2021 20:16:13 +0000 (13:16 -0700)]
[InstrProfiling] If no value profiling, make data variable private and (for Windows) use one comdat

`__profd_*` variables are referenced by code only when value profiling is
enabled. If disabled (e.g. default -fprofile-instr-generate), the symbols just
waste space on ELF/Mach-O. We change the comdat symbol from `__profd_*` to
`__profc_*` because an internal symbol does not provide deduplication features
on COFF. The choice doesn't matter on ELF.

(In -DLLVM_BUILD_INSTRUMENTED_COVERAGE=on build, there is now no `__profd_*` symbols.)

On Windows this enables further optimization. We are no longer affected by the
link.exe limitation: an external symbol in IMAGE_COMDAT_SELECT_ASSOCIATIVE can
cause duplicate definition error.
https://lists.llvm.org/pipermail/llvm-dev/2021-May/150758.html
We can thus use llvm.compiler.used instead of llvm.used like ELF (D97585).
This avoids many `/INCLUDE:` directives in `.drectve`.

Here is rnk's measurement for Chrome:
```
This reduced object file size of base_unittests.exe, compiled with coverage, optimizations, and gmlt debug info by 10%:

#BEFORE

$ find . -iname '*.obj' | xargs du -b | awk '{ sum += $1 } END { print sum}'
1047758867

$ du -cksh base_unittests.exe
82M     base_unittests.exe
82M     total

# AFTER

$ find . -iname '*.obj' | xargs du -b | awk '{ sum += $1 } END { print sum}'
937886499

$ du -cksh base_unittests.exe
78M     base_unittests.exe
78M     total
```

Reviewed By: davidxl, rnk

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

3 years agoUpdate and improve compiler-rt tests for -mllvm -asan_use_after_return=(never|[runtim...
Kevin Athey [Thu, 3 Jun 2021 19:40:14 +0000 (12:40 -0700)]
Update and improve compiler-rt tests for -mllvm -asan_use_after_return=(never|[runtime]|always).

In addition:
  - optionally add global flag to capture compile intent for UAR:
    __asan_detect_use_after_return_always.
    The global is a SANITIZER_WEAK_ATTRIBUTE.

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

Reviewed By: vitalybuka

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

3 years ago[flang] Fix folding of CMPLX
peter klausler [Wed, 2 Jun 2021 23:59:31 +0000 (16:59 -0700)]
[flang] Fix folding of CMPLX

The code for folding calls to the intrinsic function CMPLX was
incorrectly dependent on the number of arguments to distinguish its
two cases (conversion from one kind of complex to another, and
composition of a complex value from real & imaginary parts).
This was wrong since the optional KIND= argument has already been
taken into account by intrinsic processing; instead, the type of
the first argument should decide the issue.

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

3 years ago[GlobalISel] Add G_SBFX/G_UBFX to computeKnownBits
Brendon Cahoon [Sat, 22 May 2021 17:14:58 +0000 (13:14 -0400)]
[GlobalISel] Add G_SBFX/G_UBFX to computeKnownBits

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

3 years ago[LoopUnroll] Add additional test with one unpredictable exit (NFC)
Nikita Popov [Thu, 3 Jun 2021 19:41:21 +0000 (21:41 +0200)]
[LoopUnroll] Add additional test with one unpredictable exit (NFC)

One exit is unpredictable, the other has a known trip count. For
one function the predictable exit is the latch exit, for the other
the non-latch exit. Currently they are treated differently.

3 years ago[libc++] Implement LWG3435 (constraints on reverse_iterator and move_iterator)
Louis Dionne [Thu, 3 Jun 2021 18:14:57 +0000 (14:14 -0400)]
[libc++] Implement LWG3435 (constraints on reverse_iterator and move_iterator)

3 years ago[flang] Fix crashes due to failure to find a subprogram
peter klausler [Wed, 2 Jun 2021 23:54:42 +0000 (16:54 -0700)]
[flang] Fix crashes due to failure to find a subprogram

In error recovery situations, the mappings from source locations
to scopes were failing in a way that tripped some asserts.
Specifically, FindPureProcedureContaining() wasn't coping well
when starting at the global scope.  (And since the global scope
no longer has a source range, clean up the Semantics constructor
to avoid confusion.)

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

3 years ago[docs] Update llvm-cov gcov
Fangrui Song [Thu, 3 Jun 2021 19:36:27 +0000 (12:36 -0700)]
[docs] Update llvm-cov gcov

Mention some new options.

Remove outdated information about -g and -O0. -g0 works. -O1/-O2/-O3 work.

3 years ago[libc++] NFC: Tidy up the reverse_iterator tests
Louis Dionne [Thu, 3 Jun 2021 18:56:51 +0000 (14:56 -0400)]
[libc++] NFC: Tidy up the reverse_iterator tests

Incidentally, that fixes an error with the modules build.

3 years ago[lld-macho] Fix BUILD_SHARED_LIBS build
Alex Richardson [Thu, 3 Jun 2021 18:58:43 +0000 (19:58 +0100)]
[lld-macho] Fix BUILD_SHARED_LIBS build

ca6751043d8899b12baeb48621e61fb352cfee09 added a dependency on XAR (at
least for the shared libs build), so without this change we get the
following linker error:

Undefined symbols for architecture x86_64:
  "_xar_close", referenced from:
      lld::macho::BitcodeBundleSection::finalize() in SyntheticSections.cpp.o

Reviewed By: #lld-macho, int3, thakis

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

3 years ago[llvm] llvm-tapi-diff
Sam Powell [Thu, 3 Jun 2021 18:11:23 +0000 (11:11 -0700)]
[llvm] llvm-tapi-diff

This patch introduces a new tool, llvm-tapi-diff, that compares and returns the diff of two TBD files.

Reviewed By: ributzka, JDevlieghere

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

3 years ago[AtomicExpand] Merge cmpxchg success and failure ordering when appropriate.
Eli Friedman [Fri, 28 May 2021 21:05:07 +0000 (14:05 -0700)]
[AtomicExpand] Merge cmpxchg success and failure ordering when appropriate.

If we're not emitting separate fences for the success/failure cases, we
need to pass the merged ordering to the target so it can emit the
correct instructions.

For the PowerPC testcase, we end up with extra fences, but that seems
like an improvement over missing fences.  If someone wants to improve
that, the PowerPC backed could be taught to emit the fences after isel,
instead of depending on fences emitted by AtomicExpand.

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

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

3 years agoNFC. Mark DOTFuncInfo getters as const
Artur Pilipenko [Thu, 3 Jun 2021 17:53:00 +0000 (10:53 -0700)]
NFC. Mark DOTFuncInfo getters as const

This is a preparatory refactoring for introducing new
types of hidden blocks.

3 years agoNFC. Refactor DOTGraphTraits::isNodeHidden
Artur Pilipenko [Thu, 3 Jun 2021 17:50:26 +0000 (10:50 -0700)]
NFC. Refactor DOTGraphTraits::isNodeHidden

Restructure handling of cfg-hide-unreachable-paths and
cfg-hide-deoptimize-paths options so as to make it easier
to introduce new types of hidden blocks.

3 years agoRemove redundant Begin/End form signpost format strings.
Adrian Prantl [Thu, 3 Jun 2021 18:22:24 +0000 (11:22 -0700)]
Remove redundant Begin/End form signpost format strings.

The os_signpost API already captures the begin/end part and in
Instruments, this just adds visual noise that gets in the way of the
interesting data. By removing the redundant end text, the display in
Instruments gets even less cluttered.

rdar://78636200

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

3 years ago[libcxx][module-map] creates submodules for private headers
Christopher Di Bella [Wed, 2 Jun 2021 19:46:20 +0000 (19:46 +0000)]
[libcxx][module-map] creates submodules for private headers

Most of our private headers need to be treated as submodules so that
Clang modules can export things correctly. Previous commits that split
monolithic headers into smaller chunks were unaware of this requirement,
and so this is being addressed in one fell swoop. Moving forward, most
new headers will need to have their own submodule (anything that's
conditionally included is exempt from this rule, which means `__support`
headers aren't made into submodules).

This hasn't been marked NFC, since I'm not 100% sure that's the case.

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

3 years agoDon't delete the module you're inspecting
Chris Bieneman [Wed, 2 Jun 2021 18:48:58 +0000 (13:48 -0500)]
Don't delete the module you're inspecting

Prior to this patch when you used `clang -module-file-info` clang would
delete the module on completion because the module was treated as an
output file.

This fixes the issue so you don't need to invoke cc1 directly to get
module file information.

Reviewed By: steven_wu, phosek

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

3 years ago[InstCombine] eliminate sext and/or trunc if value has enough signbits
Sanjay Patel [Thu, 3 Jun 2021 17:15:23 +0000 (13:15 -0400)]
[InstCombine] eliminate sext and/or trunc if value has enough signbits

If we have enough signbits in a source value, we can skip an
intermediate cast for a trunc+sext pair:
https://alive2.llvm.org/ce/z/A_mQt-

This is the original problem shown in:
https://llvm.org/PR49543

There's a test that shows we transformed what used to be
a pair of shifts, so that suggests we could add another
ComputeNumSignBits fold starting from a shift.

There does not appear to be any change in compile-time
from the extra analysis:
https://llvm-compile-time-tracker.com/compare.php?from=3d2c9069dcafd0cbb641841aa3dd6e851fb7d760&to=b9513cdf2419704c7bb0c3a02a9ca06aae13d902&stat=instructions

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

3 years agoFully-qualify template args of outer types in getFullyQualifiedType
Victor Kuznetsov [Thu, 3 Jun 2021 17:23:49 +0000 (10:23 -0700)]
Fully-qualify template args of outer types in getFullyQualifiedType

Template args of outer types were not fully-qualified when calling getFullyQualifiedType() for inner types.

For simplicity the patch is a copy-paste of the same call from getFullyQualifiedType().

Reviewed at: https://reviews.llvm.org/D103039

3 years ago[LoopUnroll] Eliminate PreserveOnlyFirst parameter [nfc]
Philip Reames [Thu, 3 Jun 2021 17:28:10 +0000 (10:28 -0700)]
[LoopUnroll] Eliminate PreserveOnlyFirst parameter [nfc]

This is a first step towards simplifying the transform interface to be less error prone. The basic idea is that querying SCEV is cheap (since it's cached) and we can just check for properties related to branch folding in the transform method instead of relying on the heuristic part to pass everything in correctly.

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

3 years ago[SLP]Improve cost estimation/emission of externally used extractelements.
Alexey Bataev [Fri, 21 May 2021 17:09:12 +0000 (10:09 -0700)]
[SLP]Improve cost estimation/emission of externally used extractelements.

No need to recalculate the cost of extractelements, just no need to
compensate the cost of all extractelements, need to check before if this
is actually going to be removed at the vectorization. Also, no need to
 generate new extractelement instruction, we may just regenerate the
 original one. It may improve the final vectorization.

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

3 years ago[LoopUnroll] Reorder code to max dom tree update more obvious [nfc]
Philip Reames [Thu, 3 Jun 2021 17:05:12 +0000 (10:05 -0700)]
[LoopUnroll] Reorder code to max dom tree update more obvious [nfc]

This cleans up the unroll action into two phases. Phase 1 does the mechanical act of unrolling, and leaves all conditional branches in place. Phase 2 optimizes away some of the conditional branches and then simplifies the loop. The primary benefit of the reordering is that we can delete some special cases dom tree update logic.

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

3 years agoadd ppc_fp128 bitcode writer testcase
Jinsong Ji [Thu, 3 Jun 2021 16:43:15 +0000 (16:43 +0000)]
add ppc_fp128 bitcode writer testcase

3 years ago[SLP]Allow to reorder nodes with >2 scalar values.
Alexey Bataev [Thu, 27 May 2021 13:19:32 +0000 (06:19 -0700)]
[SLP]Allow to reorder nodes with >2 scalar values.

tryToVectorizeList function allows to reorder only 2 scalars. Patch
allows to reorder >2 scalars. Also, to avoid possible regressions, it
allows extra vectorization of the remaining parts of the scalars
elements if possible.

Part of D57059.

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

3 years ago[Tests] Add missing include (NFC)
Nikita Popov [Thu, 3 Jun 2021 16:58:29 +0000 (18:58 +0200)]
[Tests] Add missing include (NFC)

Fix one more missing include in a unit test after
983565a6fe4a9f40c7caf82b65c650c20dbcc104.

3 years ago[lld] Add missing includes (NFC)
Nikita Popov [Thu, 3 Jun 2021 16:54:23 +0000 (18:54 +0200)]
[lld] Add missing includes (NFC)

Fix lld build after 983565a6fe4a9f40c7caf82b65c650c20dbcc104.

3 years ago[SLP] Avoid std::stable_sort(properlyDominates()).
Harald van Dijk [Thu, 3 Jun 2021 16:51:52 +0000 (17:51 +0100)]
[SLP] Avoid std::stable_sort(properlyDominates()).

As noticed by NAKAMURA Takumi back in 2017, we cannot use
properlyDominates for std::stable_sort as properlyDominates only
partially orders blocks. That is, for blocks A, B, C, D, where A
dominates B and C dominates D, we have A == C, B == C, but A < B. This
is not a valid comparison function for std::stable_sort and causes
different results between libstdc++ and libc++. This change uses DFS
numbering to give deterministic results for all reachable blocks.
Unreachable blocks are ignored already, so do not need special
consideration.

Reviewed By: RKSimon

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

3 years ago[MC] Add missing include (NFC)
Nikita Popov [Thu, 3 Jun 2021 16:47:51 +0000 (18:47 +0200)]
[MC] Add missing include (NFC)

Try to fix buildbots after 983565a6fe4a9f40c7caf82b65c650c20dbcc104.

3 years ago[mailmap] Add my entry
Fangrui Song [Thu, 3 Jun 2021 16:45:19 +0000 (09:45 -0700)]
[mailmap] Add my entry

3 years ago[ADT] Move DenseMapInfo for ArrayRef/StringRef into respective headers (NFC)
Nikita Popov [Tue, 1 Jun 2021 20:41:08 +0000 (22:41 +0200)]
[ADT] Move DenseMapInfo for ArrayRef/StringRef into respective headers (NFC)

This is a followup to D103422. The DenseMapInfo implementations for
ArrayRef and StringRef are moved into the ArrayRef.h and StringRef.h
headers, which means that these two headers no longer need to be
included by DenseMapInfo.h.

This required adding a few additional includes, as many files were
relying on various things pulled in by ArrayRef.h.

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

3 years ago[libc++][nfc] Add more nasty macros.
Mark de Wever [Wed, 2 Jun 2021 17:54:06 +0000 (19:54 +0200)]
[libc++][nfc] Add more nasty macros.

D101613 added some macros used by Microsofts SAL. D103425 uses `__pre`
and `__post`. They are also used by SAL and cause issues when used on
Windows. Add them to the blacklist making it easier to figure out what
the issue is.

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

3 years agoRevert "[DebugInstrRef][2/3] Track PHI values through register coalescing"
Jeremy Morse [Thu, 3 Jun 2021 16:16:58 +0000 (17:16 +0100)]
Revert "[DebugInstrRef][2/3] Track PHI values through register coalescing"

This reverts commit ae4303b42cfa5c8c14e3fff67d73af2f154aea9a.

Expensive checks buildbot has found a problem with this:

  https://lab.llvm.org/buildbot/#/builders/16/builds/11863

3 years ago[CostModel][AArch64] Add tests for ctlz, ctpop and cttz. NFC.
Rosie Sumpter [Wed, 2 Jun 2021 15:10:27 +0000 (16:10 +0100)]
[CostModel][AArch64] Add tests for ctlz, ctpop and cttz. NFC.

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

3 years ago[DebugInstrRef][2/3] Track PHI values through register coalescing
Jeremy Morse [Thu, 3 Jun 2021 15:43:49 +0000 (16:43 +0100)]
[DebugInstrRef][2/3] Track PHI values through register coalescing

In the instruction referencing variable location model, we store variable
locations that point at PHIs in MachineFunction during register
allocation. Unfortunately, register coalescing can substantially change
the locations of registers, and so that PHI-variable-location side table
needs maintenence during the pass.

This patch builds an index from the side table, and whenever a vreg gets
coalesced into another vreg, update the index to record the new vreg that
the PHI happens in. It also accepts a limited range of subregister
coalescing, for example merging a subregister into a larger class.

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

3 years ago[lld-macho] Parse re-exports of nested TAPI documents
Jez Ng [Thu, 3 Jun 2021 01:53:44 +0000 (21:53 -0400)]
[lld-macho] Parse re-exports of nested TAPI documents

D103423 neglected to call `parseReexports()` for nested TBD
documents, leading to symbol resolution failures when trying to look up
a symbol nested more than one level deep in a TBD file. This fixes the
regression and adds a test.

It also appears that `umbrella` wasn't being set properly when calling
`parseLoadCommands` -- it's supposed to resolve to `this` if `nullptr`
is passed. I didn't write a failing test case for this but I've made
`umbrella` a member so the previous behavior should be preserved.

Reviewed By: #lld-macho, thakis

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

3 years ago[clang-format] Add PPIndentWidth option
Gerhard Gappmeier [Thu, 3 Jun 2021 14:56:56 +0000 (16:56 +0200)]
[clang-format] Add PPIndentWidth option

This allows to set a different indent width for preprocessor statements.

Example:

 #ifdef __linux_
 # define FOO
 #endif

int main(void)
{
    return 0;
}

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

3 years ago[clang-format] Fix PointerAlignmentRight with AlignConsecutiveDeclarations
Gerhard Gappmeier [Thu, 3 Jun 2021 14:52:55 +0000 (16:52 +0200)]
[clang-format] Fix PointerAlignmentRight with AlignConsecutiveDeclarations

This re-applies the old patch D27651, which was never landed, into the
latest "main" branch, without understanding the code. I just applied
the changes "mechanically" and made it compiling again.

This makes the right pointer alignment working as expected.
Fixes https://llvm.org/PR27353

For instance

const char* const* v1;
float const* v2;
SomeVeryLongType const& v3;

was formatted as

const char *const *     v1;
float const *           v2;
SomeVeryLongType const &v3;

This patch keep the *s or &s aligned to the right, next to their variable.
The above example is now formatted as

const char *const      *v1;
float const            *v2;
SomeVeryLongType const &v3;

It is a pity that this still does not work with clang-format in 2021,
even though there was a fix available in 2016. IMHO right pointer alignment
is the default case in C, because syntactically the pointer belongs to the
variable.

See

int* a, b, c; // wrong, just the 1st variable is a pointer

vs.

int *a, *b, *c; // right

Prominent example is the Linux kernel coding style.

Some styles argue the left pointer alignment is better and declaration
lists as shown above should be avoided. That's ok, as different projects
can use different styles, but this important style should work too.

I hope that somebody that has a better understanding about the code,
can take over this patch and land it into main.

For now I must maintain this fork to make it working for our projects.

Cheers,
Gerhard.

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

3 years ago[mlir][sparse] add more type combinations to sparse storage scheme
Aart Bik [Wed, 2 Jun 2021 23:08:16 +0000 (16:08 -0700)]
[mlir][sparse] add more type combinations to sparse storage scheme

Useful for "exhaustively" testing and benchmarking annotation combinations
to verify correctness and perform state space search for best performing.

Reviewed By: penpornk

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

3 years ago[mlir][linalg] Cleanup LinalgOp usage in capi.
Tobias Gysi [Thu, 3 Jun 2021 15:23:14 +0000 (15:23 +0000)]
[mlir][linalg] Cleanup LinalgOp usage in capi.

Replace the uses of deprecated Structured Op Interface methods in Linalg.cpp. This patch is based on https://reviews.llvm.org/D103394.

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

3 years ago[RISCV] Precommit a test case to show overwriting vector frame objects.
Hsiangkai Wang [Thu, 3 Jun 2021 13:24:24 +0000 (21:24 +0800)]
[RISCV] Precommit a test case to show overwriting vector frame objects.

3 years ago[mlir] Fix warnings.
Alexander Belyaev [Thu, 3 Jun 2021 14:27:29 +0000 (16:27 +0200)]
[mlir] Fix warnings.

3 years ago[mlir][linalg] Cleanup LinalgOp usage in scalar inlining.
Tobias Gysi [Thu, 3 Jun 2021 14:19:19 +0000 (14:19 +0000)]
[mlir][linalg] Cleanup LinalgOp usage in scalar inlining.

Replace the uses of deprecated Structured Op Interface methods in InlineScalarOperands.cpp. This patch is based on https://reviews.llvm.org/D103394.

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

3 years ago[flang] Check for duplicate definitions of defined input/output procedures
Peter Steinfeld [Wed, 2 Jun 2021 21:55:41 +0000 (14:55 -0700)]
[flang] Check for duplicate definitions of defined input/output procedures

It's possible to specify defined input/output procedures either as a
type-bound procedure of a derived type or as a defined-io-generic-spec.  This
means that you can specify the same procedure in both mechanisms, which does
not cause problems.  Alternatively, you can specify two different procedures to
be the defined input/output procedure for the same derived type.  This is an
error.  This change catches this error.  The situation is slightly complicated
by parameterized derived types.  Types with the same value for a KIND parameter
are treated as the same type while types with different KIND parameters are
treated as different types.

I implemented this check by adding a vector to keep track of which defined
input/output procedures had been seen for which derived types along with the
kind of procedure (read vs write and formatted vs unformatted).  I also added
tests for non-parameterized types and types parameterized by KIND and LEN type
parameters.

I also removed an erroneous check from the code that creates runtime type
information.

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

3 years ago[Matrix] Preserve existing fast-math flags during lowering
Hamza Mahfooz [Thu, 3 Jun 2021 14:11:00 +0000 (15:11 +0100)]
[Matrix] Preserve existing fast-math flags during lowering

This patch makes it so, floating-point instructions created in
LowerMatrixIntrinsics retain fast-math flags from instructions that are
higher up the chain.

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

Reviewed By: fhahn

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

3 years ago[analyzer] Add forwarding `addVisitor` method
Valeriy Savchenko [Tue, 1 Jun 2021 13:26:53 +0000 (16:26 +0300)]
[analyzer] Add forwarding `addVisitor` method

The majority of all `addVisitor` callers follow the same pattern:
  addVisitor(std::make_unique<SomeVisitor>(arg1, arg2, ...));

This patches introduces additional overload for `addVisitor` to simplify
that pattern:
  addVisitor<SomeVisitor>(arg1, arg2, ...);

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

3 years ago[mlir][linalg] Cleanup LinalgOp usage in op declarations.
Tobias Gysi [Thu, 3 Jun 2021 13:33:39 +0000 (13:33 +0000)]
[mlir][linalg] Cleanup LinalgOp usage in op declarations.

Replace the uses of deprecated Structured Op Interface methods in LinalgOps.cpp. This patch is based on https://reviews.llvm.org/D103394.

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