platform/upstream/llvm.git
4 years ago[ms] [llvm-ml] Add support for MASM STRUCT casting field accessors: (<TYPE> PTR ...
Eric Astor [Mon, 13 Jul 2020 14:38:39 +0000 (10:38 -0400)]
[ms] [llvm-ml] Add support for MASM STRUCT casting field accessors: (<TYPE> PTR <value>).<field>

Summary:
Add support for MASM STRUCT casting field accessors: (<TYPE> PTR <value>).<field>

Since these are operands, we add them to X86AsmParser. If/when we extend MASM support to other architectures (e.g., ARM), we will need similar changes there as well.

Reviewed By: thakis

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

4 years ago[compiler-rt][CMake] Pass down LLVM_LIT_ARGS in runtime build
Jinsong Ji [Mon, 13 Jul 2020 02:54:20 +0000 (02:54 +0000)]
[compiler-rt][CMake] Pass down LLVM_LIT_ARGS in runtime build

We should also pass down the LLVM_LIT_ARGS in runtime build mode,
so that the runtime tests can be well controlled as well.

We actually passed this down in clang/runtime/CMakeLists.txt
But not for calls from llvm/runtime/CMakeLists.txt.

Reviewed By: phosek

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

4 years ago[ms] [llvm-ml] Fix MASM support for nested unnamed STRUCTs and UNIONs
Eric Astor [Mon, 13 Jul 2020 14:36:30 +0000 (10:36 -0400)]
[ms] [llvm-ml] Fix MASM support for nested unnamed STRUCTs and UNIONs

Summary: Fix MASM support for nested unnamed STRUCTs and UNIONs

Reviewed By: thakis

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

4 years ago[ms] [llvm-ml] Improve MASM STRUCT field accessor support
Eric Astor [Mon, 13 Jul 2020 14:33:15 +0000 (10:33 -0400)]
[ms] [llvm-ml] Improve MASM STRUCT field accessor support

Summary:
Adds support for several accessors:
- `[<identifier>.<struct name>].<field>`
- `[<identifier>.<struct name>.<field>].<subfield>` (where `field` has already-defined STRUCT type)
- `[<variable>.<field>].<subfield>` (where `field` has already-defined STRUCT type)

Reviewed By: thakis

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

4 years ago[lldb/dotest] Remove the "xunit" result formatter
Pavel Labath [Fri, 10 Jul 2020 11:18:00 +0000 (13:18 +0200)]
[lldb/dotest] Remove the "xunit" result formatter

Summary:
My understanding is that this was added to make dotest interact well
with the GreenDragon bots, back when dotest was the main test driver.
Now that everything goes through lit (which has its own xunit
formatter), it seems largely irrelevant.

There are more cleanups that can be done after removing this be done
here, but this should be enough to test the waters.

Reviewers: JDevlieghere

Subscribers: lldb-commits

Tags: #lldb

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

4 years ago[NFC] rename to reflect F is not necessarily an Intrinsic
Sanne Wouda [Fri, 3 Jul 2020 11:37:21 +0000 (12:37 +0100)]
[NFC] rename to reflect F is not necessarily an Intrinsic

4 years ago[SLPVectorizer] handle vectorizeable library functions
Sanne Wouda [Fri, 10 Jul 2020 11:37:26 +0000 (12:37 +0100)]
[SLPVectorizer] handle vectorizeable library functions

Teaches the SLPVectorizer to use vectorized library functions for
non-intrinsic calls.

This already worked for intrinsics that have vectorized library
functions, thanks to D75878, but schedules with library functions with a
vector variant were being rejected early.

-   assume that there are no load/store dependencies between lib
    functions with a vector variant; this would otherwise prevent the
    bundle from becoming "ready"

-   check during legalization that the vector variant can be used

-   fix-up where we previously assumed that a call would be an intrinsic

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

4 years agoPre-commit tests
Sanne Wouda [Thu, 25 Jun 2020 15:02:52 +0000 (16:02 +0100)]
Pre-commit tests

Prepare to land D82550

4 years agoFix crash when getVFABIMappings is called with an indirect call instruction
Sanne Wouda [Thu, 25 Jun 2020 15:08:13 +0000 (16:08 +0100)]
Fix crash when getVFABIMappings is called with an indirect call instruction

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

4 years ago[yaml2obj] - Refactor header-sh-fields.yaml test.
Georgii Rymar [Thu, 9 Jul 2020 13:03:40 +0000 (16:03 +0300)]
[yaml2obj] - Refactor header-sh-fields.yaml test.

This refines the test to use macros. It is needed for
a follow-up change that adds a functionality to
override more fields.

Also, it is just cleaner to test each key separately.

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

4 years ago[lldb][NFC] Refactor instruction dumping out of DumpDataExtractor
Raphael Isemann [Mon, 13 Jul 2020 11:36:25 +0000 (13:36 +0200)]
[lldb][NFC] Refactor instruction dumping out of DumpDataExtractor

4 years ago[clangd] Fix DocumentSymbol ranges
Kirill Bobyrev [Mon, 13 Jul 2020 13:02:47 +0000 (15:02 +0200)]
[clangd] Fix DocumentSymbol ranges

Summary:
DocumentSymbol ranges were not previously tested and, as a result, had invalid
end location. This patch addresses the issue.

Reviewers: sammccall

Reviewed By: sammccall

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

Tags: #clang

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

4 years ago[DAGCombiner] allow load/store merging if pairs can be rotated into place
Sanjay Patel [Mon, 13 Jul 2020 12:57:00 +0000 (08:57 -0400)]
[DAGCombiner] allow load/store merging if pairs can be rotated into place

This carves out an exception for a pair of consecutive loads that are
reversed from the consecutive order of a pair of stores. All of the
existing profitability/legality checks for the memops remain between
the 2 altered hunks of code.

This should give us the same x86 base-case asm that gcc gets in
PR41098 and PR44895:
http://bugs.llvm.org/PR41098
http://bugs.llvm.org/PR44895

I think we are missing a potential subsequent conversion to use "movbe"
if the target supports that. That might be similar to what AArch64
would use to get "rev16".

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

4 years agoRevert "[DAGCombiner] allow load/store merging if pairs can be rotated into place"
Sanjay Patel [Mon, 13 Jul 2020 12:55:29 +0000 (08:55 -0400)]
Revert "[DAGCombiner] allow load/store merging if pairs can be rotated into place"

This reverts commit 591a3af5c7acc05617c0eacf6ae4f76bd8a9a6ce.
The commit message was cut off and failed to include the review citation.

4 years ago[DAGCombiner] allow load/store merging if pairs can be rotated into place
Sanjay Patel [Mon, 13 Jul 2020 12:51:09 +0000 (08:51 -0400)]
[DAGCombiner] allow load/store merging if pairs can be rotated into place

This carves out an exception for a pair of consecutive loads that are
reversed from the consecutive order of a pair of stores. All of the
existing profitability/legality checks for the memops remain between
the 2 altered hunks of code.

This should give us the same x86 base-case asm that gcc gets in
PR41098 and PR44895:i
http://bugs.llvm.org/PR41098
http://bugs.llvm.org/PR44895

I think we are missing a potential subsequent conversion to use "movbe"
if the target supports that. That might be similar to what AArch64
would use to get "rev16".

Differential Revision:

4 years ago[ARM][MVE] Refactor option -disable-mve-tail-predication
Sjoerd Meijer [Mon, 13 Jul 2020 10:53:09 +0000 (11:53 +0100)]
[ARM][MVE] Refactor option -disable-mve-tail-predication

This refactors option -disable-mve-tail-predication to take different arguments
so that we have 1 option to control tail-predication rather than several
different ones.

This is also a prep step for D82953, in which we want to reject reductions
unless that is requested with this option.

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

4 years ago[analyzer] ctu-on-demand-parsing tests: replace linux -> system-linux
Balazs Benics [Mon, 13 Jul 2020 12:29:47 +0000 (14:29 +0200)]
[analyzer] ctu-on-demand-parsing tests: replace linux -> system-linux

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

4 years ago[LLD][ELF] - Fix the test after llvm-readelf output change.
Georgii Rymar [Mon, 13 Jul 2020 12:14:06 +0000 (15:14 +0300)]
[LLD][ELF] - Fix the test after llvm-readelf output change.

An issue for llvm-readelf was fixed in
https://reviews.llvm.org/rG84a170178c4431b7536c83ff0e5ce80774d08df6

Now it produce no output for this test.

4 years ago[COFF] Error on unexpected .pdata size
Hans Wennborg [Thu, 9 Jul 2020 12:54:53 +0000 (14:54 +0200)]
[COFF] Error on unexpected .pdata size

Previously, lld would crash if the .pdata size was not an even multiple
of the expected .pdata entry size. This makes it error gracefully instead.

(We hit this in Chromium due to an assembler problem: https://crbug.com/1101577)

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

4 years ago[AMDGPU][GlobalISel] Fix subregister index for EXEC register in selectBallot.
Mirko Brkusanin [Mon, 13 Jul 2020 11:35:34 +0000 (13:35 +0200)]
[AMDGPU][GlobalISel] Fix subregister index for EXEC register in selectBallot.

Temporarily remove subregister for EXEC in selectBallot added in
https://reviews.llvm.org/D83214 to fix failures on expensive checks buildbot.

4 years ago[llvm-readobj] - Add a generic test for --dyn-relocations and fix an issue.
Georgii Rymar [Wed, 8 Jul 2020 11:54:45 +0000 (14:54 +0300)]
[llvm-readobj] - Add a generic test for --dyn-relocations and fix an issue.

We have an issue currently: --dyn-relocations always prints the following
relocation header when dumping `DynPLTRelRegion`:

"Offset  Info  Type Symbol's Value  Symbol's Name + Addend"

I.e. even for an empty object, --dyn-relocations still prints this.
It is a easy to fix bug, but we have no dedicated test case for this option.
(we have a dynamic-reloc-no-section-headers.test, which has a slightly different purpose).

This patch adds a test and fixes the behavior.

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

4 years ago[lldb][NFC] Early-exit in DWARFASTParserClang::ParseSingleMember
Raphael Isemann [Mon, 13 Jul 2020 11:14:55 +0000 (13:14 +0200)]
[lldb][NFC] Early-exit in DWARFASTParserClang::ParseSingleMember

This patch just early-exits after the 'if (num_attributes > 0)' check.

4 years ago[SVE] Ensure fixed length vector fptrunc operations bigger than NEON are not consider...
Paul Walker [Mon, 13 Jul 2020 11:16:30 +0000 (11:16 +0000)]
[SVE] Ensure fixed length vector fptrunc operations bigger than NEON are not considered legal.

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

4 years ago[lldb][NFC] Remove misleading class_language variable in DWARFASTParserClang
Raphael Isemann [Mon, 13 Jul 2020 10:22:09 +0000 (12:22 +0200)]
[lldb][NFC] Remove misleading class_language variable in DWARFASTParserClang

There is a local 'class_language' veriable in DWARFASTParserClang which is named
as if it is related to the 'class_language' member of ParsedDWARFTypeAttributes.
However, it actually only has two possible enum values: 'ObjC' (which means the
current record is a Objective-C class) or 'Unknown' (which covers all other
cases).

This is confusing for the reader and also lead to some strange code where we
have several comparisons against the value "ObjC_plus_plus" (which is always
false).

This replaces the variable with either a const bool variable (if there are
multiple checks for that condition in a function) or a direct call to the
TypeSystemClang utility method for checking if it's a Objective-C
Object/Interface type.

4 years ago[libc][benchmark] Add display option to render.py3
Andre Vieira [Mon, 13 Jul 2020 10:52:58 +0000 (11:52 +0100)]
[libc][benchmark] Add display option to render.py3

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

4 years ago[LLD][ELF][Windows] small improvement to D82567
Ben Dunbobbin [Mon, 13 Jul 2020 10:58:30 +0000 (11:58 +0100)]
[LLD][ELF][Windows] small improvement to D82567

Bail early if there is no existing output file to be overwritten.

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

4 years ago[LLD][ELF] - Allow relocation sections to appear before their target sections.
Georgii Rymar [Thu, 9 Jul 2020 10:08:13 +0000 (13:08 +0300)]
[LLD][ELF] -  Allow relocation sections to appear before their target sections.

It allows handling cases when we have SHT_REL[A] sections before target
sections in objects.

This fixes https://bugs.llvm.org/show_bug.cgi?id=46632

which says: "Normally it is not what compilers would emit. We have to support it,
because some custom tools might want to use this feature, which is not restricted by ELF gABI"

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

4 years ago[OpenCL] Defer addr space deduction for dependent type.
Anastasia Stulova [Mon, 13 Jul 2020 10:30:13 +0000 (11:30 +0100)]
[OpenCL] Defer addr space deduction for dependent type.

This patch removes deduction of address spaces in parsing
for types that depend on template parameter even if an
address space is already known. Deducing it early interferes
with template instantiation/specialization logic that uses
source address space where address space is not present.

Address space deduction for templates is therefore fully
moved to the template instantiation/specialization phase.

Patch by Ole Strohm (olestrohm)!

Tags: #clang

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

4 years ago[mlir][VectorOps] Lower vector.fma to llvm.fmuladd instead of llvm.fma
Benjamin Kramer [Mon, 13 Jul 2020 10:23:53 +0000 (12:23 +0200)]
[mlir][VectorOps] Lower vector.fma to llvm.fmuladd instead of llvm.fma

Summary:
These are semantically equivalent, but fmuladd allows decaying the op
into fmul+fadd if there is no fma instruction available. llvm.fma lowers
to scalar calls to libm fmaf, which is a lot slower.

Reviewers: nicolasvasilache, aartbik, ftynse

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

Tags: #mlir

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

4 years ago[AMDGPU][GlobalISel] Select llvm.amdgcn.ballot
Mirko Brkusanin [Mon, 13 Jul 2020 09:44:18 +0000 (11:44 +0200)]
[AMDGPU][GlobalISel] Select llvm.amdgcn.ballot

Select ballot intrinsic for GlobalISel.

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

4 years ago[clang] Include type specifiers in typo correction when checking isCXXDeclarationSpec...
Haojian Wu [Mon, 13 Jul 2020 10:05:09 +0000 (12:05 +0200)]
[clang] Include type specifiers in typo correction when checking isCXXDeclarationSpecifiers.

- add more tests (the test added in https://github.com/llvm/llvm-project/commit/2f448467e4254ddc3191136c968e6054bc009b88 is weak);
- improve the `MyTemplate<type_typo, int>();` case, with this patch, typo correction
  suggests the type decl, and no regressions found.

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

4 years ago[SVE][Codegen] Add a helper function for pointer increment logic
Kerry McLaughlin [Mon, 13 Jul 2020 09:08:40 +0000 (10:08 +0100)]
[SVE][Codegen] Add a helper function for pointer increment logic

Summary:
Helper used when splitting load & store operations to calculate
the pointer + offset for the high half of the split

Reviewers: efriedma, sdesmalen, david-arm

Reviewed By: efriedma

Subscribers: tschuett, hiraditya, psnobl, llvm-commits

Tags: #llvm

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

4 years ago[clang][RecoveryExpr] Clarify the dependence-bits documentation.
Haojian Wu [Thu, 9 Jul 2020 10:55:46 +0000 (12:55 +0200)]
[clang][RecoveryExpr] Clarify the dependence-bits documentation.

The expr dependent-bits described that the expression somehow
depends on a template paramter.

With RecoveryExpr, we have generalized it to "the expression depends on
a template parameter, or an error".  This patch updates/cleanups all related
comments of dependence-bits.

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

4 years ago[clangd] Add metrics for recovery-expr type propagation.
Haojian Wu [Mon, 13 Jul 2020 09:26:45 +0000 (11:26 +0200)]
[clangd] Add metrics for recovery-expr type propagation.

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

4 years agoFix bad doxygen result for class clang::ento::CallEvent and its derived classes
Ella Ma [Mon, 13 Jul 2020 09:22:16 +0000 (12:22 +0300)]
Fix bad doxygen result for class clang::ento::CallEvent and its derived classes

Summary: Fix bug https://bugs.llvm.org/show_bug.cgi?id=44753. This
patch is a workaround of a Doxygen bug, so that it can correctly
generate documents for class clang::ento::CallEvent and its derived
classes.

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

4 years ago[GlobalISel][InlineAsm] Fix buildCopy for inputs
Petar Avramovic [Mon, 13 Jul 2020 08:52:33 +0000 (10:52 +0200)]
[GlobalISel][InlineAsm] Fix buildCopy for inputs

Check that input size matches size of destination reg class.
Attempt to extend input size when needed.

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

4 years ago[MLIR][Shape] Lower `shape.any`
Frederik Gossen [Mon, 13 Jul 2020 08:28:13 +0000 (08:28 +0000)]
[MLIR][Shape] Lower `shape.any`

Lower `shape.any` to its first operand.

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

4 years ago[clangd] Fix tests build for GCC5
Aleksandr Platonov [Mon, 13 Jul 2020 07:04:29 +0000 (09:04 +0200)]
[clangd] Fix tests build for GCC5

Summary:
Build log:
```
llvm-project/clang-tools-extra/clangd/unittests/PreambleTests.cpp: In member function ‘virtual void clang::clangd::{anonymous}::PreamblePatchTest_Define_Test::TestBody()’:
llvm-project/clang-tools-extra/clangd/unittests/PreambleTests.cpp:267:3: error: could not convert ‘(const char*)"\012        #define BAR\012        [[BAR]]"’ from ‘const char*’ to ‘llvm::StringLitera ’
   };
   ^
llvm-project/clang-tools-extra/clangd/unittests/PreambleTests.cpp:267:3: error: could not convert ‘(const char*)"#line 0 \".*main.cpp\"\012#line 2\012#define         BAR\012"’ from ‘const char*’ to ‘llvm::StringLiteral’
llvm-project/clang-tools-extra/clangd/unittests/PreambleTests.cpp:267:3: error: could not convert ‘(const char*)"\012        #define BAR \\\012\012        [[BAR]]"’ from ‘const char*’ to ‘llvm::StringLiteral’
llvm-project/clang-tools-extra/clangd/unittests/PreambleTests.cpp:267:3: error: could not convert ‘(const char*)"#line 0 \".*main.cpp\"\012#line 2\012#define         BAR\012"’ from ‘const char*’ to ‘llvm::StringLiteral’
llvm-project/clang-tools-extra/clangd/unittests/PreambleTests.cpp:267:3: error: could not convert ‘(const char*)"\012        #define \\\012                BAR\012        [[BAR]]"’ from ‘const char*’ to ‘llvm::StringLiteral’
llvm-project/clang-tools-extra/clangd/unittests/PreambleTests.cpp:267:3: error: could not convert ‘(const char*)"#line 0 \".*main.cpp\"\012#line 3\012#define         BAR\012"’ from ‘const char*’ to ‘llvm::StringLiteral’
llvm-project/clang-tools-extra/clangd/unittests/PreambleTests.cpp: In member function ‘virtual void clang::clangd::{anonymous}::PreamblePatchTest_LocateMacroAtWorks_Test::TestBody()’:
llvm-project/clang-tools-extra/clangd/unittests/PreambleTests.cpp:357:3: error: could not convert ‘(const char*)""’ from ‘const char*’ to ‘llvm::StringLiteral’
   };
   ^
llvm-project/clang-tools-extra/clangd/unittests/PreambleTests.cpp:357:3: error: could not convert ‘(const char*)"\012            #define $def^FOO\012            $use^FOO"’ from ‘const char*’ to ‘llvm::StringLiteral’
llvm-project/clang-tools-extra/clangd/unittests/PreambleTests.cpp:357:3: error: could not convert ‘(const char*)""’ from ‘const char*’ to ‘llvm::StringLiteral’
llvm-project/clang-tools-extra/clangd/unittests/PreambleTests.cpp:357:3: error: could not convert ‘(const char*)"\012            #define $def^FOO\012            #undef $use^FOO"’ from ‘const char*’ to ‘llvm::StringLiteral’
llvm-project/clang-tools-extra/clangd/unittests/PreambleTests.cpp:357:3: error: could not convert ‘(const char*)""’ from ‘const char*’ to ‘llvm::StringLiteral’
llvm-project/clang-tools-extra/clangd/unittests/PreambleTests.cpp:357:3: error: could not convert ‘(const char*)"\012            #define $def^FOO\012            #undef FOO\012            $use^FOO"’ from ‘const char*’ to ‘llvm::StringLiteral’
llvm-project/clang-tools-extra/clangd/unittests/PreambleTests.cpp:357:3: error: could not convert ‘(const char*)""’ from ‘const char*’ to ‘llvm::StringLiteral’
llvm-project/clang-tools-extra/clangd/unittests/PreambleTests.cpp:357:3: error: could not convert ‘(const char*)"\012            #define \\\012              $def^FOO\012            $use^FOO"’ from ‘const char*’ to ‘llvm::StringLiteral’
llvm-project/clang-tools-extra/clangd/unittests/PreambleTests.cpp:357:3: error: could not convert ‘(const char*)""’ from ‘const char*’ to ‘llvm::StringLiteral’
llvm-project/clang-tools-extra/clangd/unittests/PreambleTests.cpp:357:3: error: could not convert ‘(const char*)"\012            #\\\012              define /* FOO */\\\012              /* FOO */ $def^FOO\012            $use^FOO"’ from ‘const char*’ to ‘llvm::StringLiteral’
llvm-project/clang-tools-extra/clangd/unittests/PreambleTests.cpp:357:3: error: could not convert ‘(const char*)"#define FOO"’ from ‘const char*’ to ‘llvm::StringLiteral’
llvm-project/clang-tools-extra/clangd/unittests/PreambleTests.cpp:357:3: error: could not convert ‘(const char*)"\012            #define BAR\012            #define $def^FOO\012            $use^FOO"’ from ‘const char*’ to ‘llvm::StringLiteral’
llvm-project/clang-tools-extra/clangd/unittests/PreambleTests.cpp: In member function ‘virtual void clang::clangd::{anonymous}::PreamblePatchTest_RefsToMacros_Test::TestBody()’:
llvm-project/clang-tools-extra/clangd/unittests/PreambleTests.cpp:445:3: error: could not convert ‘(const char*)""’ from ‘const char*’ to ‘llvm::StringLiteral’
   };
   ^
llvm-project/clang-tools-extra/clangd/unittests/PreambleTests.cpp:445:3: error: could not convert ‘(const char*)"\012            #define ^FOO\012            ^[[FOO]]"’ from ‘const char*’ to ‘llvm::StringLiteral’
llvm-project/clang-tools-extra/clangd/unittests/PreambleTests.cpp:445:3: error: could not convert ‘(const char*)"#define FOO"’ from ‘const char*’ to ‘llvm::StringLiteral’
llvm-project/clang-tools-extra/clangd/unittests/PreambleTests.cpp:445:3: error: could not convert ‘(const char*)"\012            #define BAR\012            #define ^FOO\012            ^[[FOO]]"’ from ‘const char*’ to ‘llvm::StringLiteral’
llvm-project/clang-tools-extra/clangd/unittests/PreambleTests.cpp:445:3: error: could not convert ‘(const char*)""’ from ‘const char*’ to ‘llvm::StringLiteral’
llvm-project/clang-tools-extra/clangd/unittests/PreambleTests.cpp:445:3: error: could not convert ‘(const char*)"\012            #define ^FOO\012            #undef ^FOO"’ from ‘const char*’ to ‘llvm::StringLiteral’
llvm-project/clang-tools-extra/clangd/unittests/PreambleTests.cpp: In member function ‘virtual void clang::clangd::{anonymous}::PreamblePatch_ModifiedBounds_Test::TestBody()’:
llvm-project/clang-tools-extra/clangd/unittests/PreambleTests.cpp:512:3: error: could not convert ‘(const char*)""’ from ‘const char*’ to ‘llvm::StringLiteral’
   };
   ^
llvm-project/clang-tools-extra/clangd/unittests/PreambleTests.cpp:512:3: error: could not convert ‘(const char*)"\012            #define FOO\012            FOO"’ from ‘const char*’ to ‘llvm::StringLiteral’
llvm-project/clang-tools-extra/clangd/unittests/PreambleTests.cpp:512:3: error: could not convert ‘(const char*)"#define FOO"’ from ‘const char*’ to ‘llvm::StringLiteral’
llvm-project/clang-tools-extra/clangd/unittests/PreambleTests.cpp:512:3: error: could not convert ‘(const char*)"#define BAR"’ from ‘const char*’ to ‘llvm::StringLiteral’
llvm-project/clang-tools-extra/clangd/unittests/PreambleTests.cpp:512:3: error: could not convert ‘(const char*)"\012            #define FOO\012            #undef FOO"’ from ‘const char*’ to ‘llvm::StringLiteral’
llvm-project/clang-tools-extra/clangd/unittests/PreambleTests.cpp:512:3: error: could not convert ‘(const char*)"#define FOO"’ from ‘const char*’ to ‘llvm::StringLiteral’
```

Patch by @ArcsinX !

Reviewers: kadircet, sammccall

Reviewed By: kadircet

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

Tags: #clang

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

4 years ago[InstCombine] Improve select -> phi canonicalization: consider more blocks
Max Kazantsev [Mon, 13 Jul 2020 04:14:59 +0000 (11:14 +0700)]
[InstCombine] Improve select -> phi canonicalization: consider more blocks

We can try to replace select with a Phi not in its parent block alone,
but also in blocks of its arguments. We benefit from it when select's
argument is a Phi.

Differential Revision: https://reviews.llvm.org/D83284
Reviewed By: nikic

4 years ago[PowerPC] Enhance tests for D83276. NFC.
Kai Luo [Mon, 13 Jul 2020 04:31:04 +0000 (04:31 +0000)]
[PowerPC] Enhance tests for D83276. NFC.

4 years ago[PowerPC] Support constrained conversion in SPE target
Qiu Chaofan [Mon, 13 Jul 2020 04:15:44 +0000 (12:15 +0800)]
[PowerPC] Support constrained conversion in SPE target

This patch adds support for constrained int/fp conversion between
signed/unsigned i32 and f32/f64.

Reviewed By: jhibbits

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

4 years ago[MC][RISCV] Set UseIntegratedAssembler to true
Fangrui Song [Mon, 13 Jul 2020 04:04:31 +0000 (21:04 -0700)]
[MC][RISCV] Set UseIntegratedAssembler to true

to align with most other targets. Also, -fintegrated-as is the default
for clang -target riscv*.

4 years ago[OpenMP] Add firstprivate as a default data-sharing attribute to clang
Atmn Patel [Mon, 13 Jul 2020 03:19:40 +0000 (22:19 -0500)]
[OpenMP] Add firstprivate as a default data-sharing attribute to clang

This implements the default(firstprivate) clause as defined in OpenMP
Technical Report 8 (2.22.4).

Reviewed By: jdoerfert, ABataev

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

4 years agoRevert "Rename/refactor isIntegerConstantExpression to getIntegerConstantExpression"
David Blaikie [Mon, 13 Jul 2020 03:29:19 +0000 (20:29 -0700)]
Revert "Rename/refactor isIntegerConstantExpression to getIntegerConstantExpression"

Broke buildbots since I hadn't updated this patch in a while. Sorry for
the noise.

This reverts commit 49e5f603d40083dce9c05796e3cde3a185c3beba.

4 years agoRename/refactor isIntegerConstantExpression to getIntegerConstantExpression
David Blaikie [Mon, 23 Mar 2020 22:07:51 +0000 (15:07 -0700)]
Rename/refactor isIntegerConstantExpression to getIntegerConstantExpression

There is a version that just tests (also called
isIntegerConstantExpression) & whereas this version is specifically used
when the value is of interest (a few call sites were actually refactored
to calling the test-only version) so let's make the API look more like
it.

Reviewers: aaron.ballman

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

4 years ago[X86] Rename X86_CPU_TYPE_COMPAT_ALIAS/X86_CPU_TYPE_COMPAT/X86_CPU_SUBTYPE_COMPAT...
Craig Topper [Sun, 12 Jul 2020 23:58:27 +0000 (16:58 -0700)]
[X86] Rename X86_CPU_TYPE_COMPAT_ALIAS/X86_CPU_TYPE_COMPAT/X86_CPU_SUBTYPE_COMPAT macros. NFC

Remove _COMPAT. Drop the ARCHNAME. Remove the non-COMPAT versions
that are no longer needed.

We now only use these macros in places where we need compatibility
with libgcc/compiler-rt. So we don't need to call out _COMPAT
specifically.

4 years ago[clang] Add -Wsuggest-override
Logan Smith [Sun, 12 Jul 2020 22:38:37 +0000 (15:38 -0700)]
[clang] Add -Wsuggest-override

This patch adds `-Wsuggest-override`, which allows for more aggressive enforcement of modern C++ best practices, as well as better compatibility with gcc, which has had its own `-Wsuggest-override` since version 5.1.

Clang already has `-Winconsistent-missing-override`, which only warns in the case where there is at least one function already marked `override` in a class. This warning strengthens that warning by suggesting the `override` keyword regardless of whether it is already present anywhere.

The text between suggest-override and inconsistent-missing-override is now shared, using `TextSubstitution` for the entire diagnostic text.

Reviewed By: dblaikie

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

4 years ago[Attributor] Add AAValueSimplifyCallSiteArgument::manifest
Shinji Okumura [Sun, 12 Jul 2020 10:11:49 +0000 (19:11 +0900)]
[Attributor] Add AAValueSimplifyCallSiteArgument::manifest

Reviewed By: jdoerfert

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

4 years agoBump the default target CPU for i386-freebsd to i686
Dimitry Andric [Sun, 12 Jul 2020 18:32:26 +0000 (20:32 +0200)]
Bump the default target CPU for i386-freebsd to i686

Summary:
Similar to what we have done downstream, some time ago:
https://svnweb.freebsd.org/changeset/base/353936

This followed some discussions on the freebsd-arch mailing lists, and
most people agreed that it was a better default, and also it worked
around several issues where clang generated libcalls to 64 bit atomic
primitives, instead of using cmpxchg8b.

Reviewers: emaste, brooks, rsmith

Reviewed By: emaste

Subscribers: arichardson, krytarowski, jfb, cfe-commits

Tags: #clang

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

4 years agoRevert "[TRE] allow TRE for non-capturing calls."
Alexey Lapshin [Sun, 12 Jul 2020 19:46:37 +0000 (22:46 +0300)]
Revert "[TRE] allow TRE for non-capturing calls."

This reverts commit f7907e9d223d8484f9afd457ba614c2db2ae4743.

That commit caused error on multi-stage build.

4 years ago[mlir][ODS] Add support for specifying the namespace of an interface.
River Riddle [Sun, 12 Jul 2020 21:11:39 +0000 (14:11 -0700)]
[mlir][ODS] Add support for specifying the namespace of an interface.

The namespace can be specified using the `cppNamespace` field. This matches the functionality already present on dialects, enums, etc. This fixes problems with using interfaces on operations in a different namespace than the interface was defined in.

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

4 years ago[X86] Remove model number based detection for 'pentiumpro', 'pentium2', 'pentium3...
Craig Topper [Sun, 12 Jul 2020 19:58:23 +0000 (12:58 -0700)]
[X86] Remove model number based detection for 'pentiumpro', 'pentium2', 'pentium3', 'pentium-m', and 'yonah' from getHostCPUName.

For model 6 CPUs, we have a fallback detection method based on
available features. That mechanism should be enough to detect
these early family 6 CPUs as they only differ in the features
used by the detection anyway.

4 years ago[X86] Add CPU string output to getIntelProcessorTypeAndSubtype/getAMDProcessorTypeAnd...
Craig Topper [Sun, 12 Jul 2020 19:58:17 +0000 (12:58 -0700)]
[X86] Add CPU string output to getIntelProcessorTypeAndSubtype/getAMDProcessorTypeAndSubtype in Host.cpp

Rather than converting type/subtype into strings, just directly
select the string as part of family/model decoding. This avoids
the need for creating fake Type/SubTypes for CPUs not supported
by compiler-rtl. I've left the Type/SubType in place where it matches
compiler-rt so that the code can be diffed, but the Type/SubType
is no longer used by Host.cpp.

compiler-rt was already updated to select strings that aren't used
so the code will look similar.

4 years ago[X86] Add CPU name strings to getIntelProcessorTypeAndSubtype and getAMDProcessorType...
Craig Topper [Sun, 12 Jul 2020 19:58:10 +0000 (12:58 -0700)]
[X86] Add CPU name strings to getIntelProcessorTypeAndSubtype and getAMDProcessorTypeAndSubtype in compiler-rt.

These aren't used in compiler-rt, but I plan to make a similar
change to the equivalent code in Host.cpp where the mapping from
type/subtype is an unnecessary complication. Having the CPU strings
here will help keep the code somewhat synchronized.

4 years ago[InstCombine] fold mul of zext/sext bools to 'and'
Sanjay Patel [Sun, 12 Jul 2020 19:56:26 +0000 (15:56 -0400)]
[InstCombine] fold mul of zext/sext bools to 'and'

Similar to rG40fcc42:
The base case only worked because we were relying on a
poison-unsafe select transform; if that is fixed, we
would regress on patterns like this.

The extra use tests show that the select transform can't
be applied consistently. So it may be a regression to have
an extra instruction on 1 test, but that result was not
created safely and does not happen reliably.

4 years agoRevert "[Matrix] Tighten LangRef definitions and Verifier checks."
Sjoerd Meijer [Sun, 12 Jul 2020 18:19:25 +0000 (19:19 +0100)]
Revert "[Matrix] Tighten LangRef definitions and Verifier checks."

This reverts commit f4d29d6e8c43cfd924d9d7cc1ac0c269b2788e75.

Hm, some build bot failures, reverting it while I investigate that.

4 years ago[Matrix] Tighten LangRef definitions and Verifier checks.
Sjoerd Meijer [Thu, 9 Jul 2020 12:30:50 +0000 (13:30 +0100)]
[Matrix] Tighten LangRef definitions and Verifier checks.

This tightens the matrix intrinsic definitions in LLVM LangRef and adds
correspondings checks to the IR Verifier.

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

4 years ago[polly] NFC clang-format change following D83564
mydeveloperday [Sun, 12 Jul 2020 17:57:14 +0000 (18:57 +0100)]
[polly] NFC clang-format change following D83564

4 years ago[X86] Consistently use 128 as the PSHUFB/VPPERM index for zero
Craig Topper [Sun, 12 Jul 2020 17:30:27 +0000 (10:30 -0700)]
[X86] Consistently use 128 as the PSHUFB/VPPERM index for zero

Bit 7 of the index controls zeroing, the other bits are ignored when bit 7 is set. Shuffle lowering was using 128 and shuffle combining was using 255. Seems like we should be consistent.

This patch changes shuffle combining to use 128 to match lowering.

Reviewed By: RKSimon

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

4 years ago[X86] Fix two places that appear to misuse peekThroughOneUseBitcasts
Craig Topper [Sun, 12 Jul 2020 17:29:45 +0000 (10:29 -0700)]
[X86] Fix two places that appear to misuse peekThroughOneUseBitcasts

peekThroughOneUseBitcasts checks the use count of the operand of the bitcast. Not the bitcast itself. So I think that means we need to do any outside haseOneUse checks before calling the function not after.

I was working on another patch where I misused the function and did a very quick audit to see if I there were other similar mistakes.

Reviewed By: RKSimon

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

4 years ago[clang-format] PR46609 clang-format does not obey `PointerAlignment: Right` for ellip...
mydeveloperday [Sun, 12 Jul 2020 17:43:14 +0000 (18:43 +0100)]
[clang-format] PR46609 clang-format does not obey `PointerAlignment: Right` for ellipsis in declarator for pack

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

Ensure `*...` obey they left/middle/right rules of Pointer alignment

Reviewed By: curdeius

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

4 years ago[LV] Fixing versioning-for-unit-stide of loops with small trip count
Ayal Zaks [Thu, 9 Jul 2020 09:57:45 +0000 (12:57 +0300)]
[LV] Fixing versioning-for-unit-stide of loops with small trip count

This patch fixes D81345 and PR46652.

If a loop with a small trip count is compiled w/o -Os/-Oz, Loop Access Analysis
still generates runtime checks for unit strides that will version the loop.

In such cases, the loop vectorizer should either re-run the analysis or bail-out
from vectorizing the loop, as done prior to D81345. The latter is applied for
now as the former requires refactoring.

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

4 years agoBPF: permit .maps section variables with typedef type
Yonghong Song [Sun, 12 Jul 2020 02:08:21 +0000 (19:08 -0700)]
BPF: permit .maps section variables with typedef type

Currently, llvm when see a global variable in .maps section,
it ensures its type must be a struct type. Then pointee
will be further evaluated for the structure members.
In normal cases, the pointee type will be skipped.

Although this is what current all bpf programs are doing,
but it is a little bit restrictive. For example, it is legitimate
for users to have:
typedef struct { int key_size; int value_size; } __map_t;
__map_t map __attribute__((section(".maps")));

This patch lifts this restriction and typedef of
a struct type is also allowed for .maps section variables.
To avoid create unnecessary fixup entries when traversal
started with typedef/struct type, the new implementation
first traverse all map struct members and then traverse
the typedef/struct type. This way, in internal BTFDebug
implementation, no fixup entries are generated.

Two new unit tests are added for typedef and const
struct in .maps section. Also tested with kernel bpf selftests.

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

4 years ago[LLD][ELF][AVR] Implement the missing relocation types
Ayke van Laethem [Thu, 25 Jun 2020 11:57:58 +0000 (13:57 +0200)]
[LLD][ELF][AVR] Implement the missing relocation types

Implements the missing relocation types for AVR target.
The results have been cross-checked with binutils.

Original patch by LemonBoy. Some changes by me.

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

4 years ago[SCCP] Extend nonnull metadata test (NFC)
Nikita Popov [Sun, 12 Jul 2020 15:48:05 +0000 (17:48 +0200)]
[SCCP] Extend nonnull metadata test (NFC)

4 years ago[AVRInstPrinter] printOperand: support llvm-objdump --print-imm-hex
Fangrui Song [Sun, 12 Jul 2020 15:14:52 +0000 (08:14 -0700)]
[AVRInstPrinter] printOperand: support llvm-objdump --print-imm-hex

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

4 years ago[NFC] Fix comment style in MLIR unittests to conform to LLVM coding standards.
Rahul Joshi [Sat, 11 Jul 2020 22:15:22 +0000 (15:15 -0700)]
[NFC] Fix comment style in MLIR unittests to conform to LLVM coding standards.

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

4 years ago[DAGCombiner] tighten fast-math constraints for fma fold
Sanjay Patel [Sun, 12 Jul 2020 12:51:49 +0000 (08:51 -0400)]
[DAGCombiner] tighten fast-math constraints for fma fold

fadd (fma A, B, (fmul C, D)), E --> fma A, B, (fma C, D, E)

This is only allowed when "reassoc" is present on the fadd.

As discussed in D80801, this transform goes beyond
what is allowed by "contract" FMF (-ffp-contract=fast).
That is because we are fusing the trailing add of 'E' with a
multiply, but without "reassoc", the code mandates that the
products A*B and C*D are added together before adding in 'E'.

I've added this example to the LangRef to try to clarify the
meaning of "contract". If that seems reasonable, we should
probably do something similar for the clang docs because
there does not appear to be any formal spec for the behavior
of -ffp-contract=fast.

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

4 years ago[Windows SEH] Fix the frame-ptr of a nested-filter within a _finally
Ten Tzen [Sun, 12 Jul 2020 08:37:56 +0000 (01:37 -0700)]
[Windows SEH] Fix the frame-ptr of a nested-filter within a _finally

This change fixed a SEH bug (exposed by test58 & test61 in MSVC test xcpt4u.c);
when an Except-filter is located inside a finally, the frame-pointer generated today
via intrinsic @llvm.eh.recoverfp is the frame-pointer of the immediate
parent _finally, not the frame-ptr of outermost host function.

The fix is to retrieve the Establisher's frame-pointer that was previously saved in
parent's frame.
The prolog of a filter inside a _finally should be like code below:

%0 = call i8* @llvm.eh.recoverfp(i8* bitcast (@"?fin$0@0@main@@"), i8*%frame_pointer)
%1 = call i8* @llvm.localrecover(i8* bitcast (@"?fin$0@0@main@@"), i8*%0, i32 0)
%2 = bitcast i8* %1 to i8**
%3 = load i8*, i8** %2, align 8

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

4 years ago[SCCP] Add test for predicate info condition handling (NFC)
Nikita Popov [Sun, 12 Jul 2020 08:12:48 +0000 (10:12 +0200)]
[SCCP] Add test for predicate info condition handling (NFC)

4 years ago[COFF] Fix endianness of .llvm.call-graph-profile section data
Zequan Wu [Sun, 12 Jul 2020 03:49:26 +0000 (20:49 -0700)]
[COFF] Fix endianness of .llvm.call-graph-profile section data

4 years ago[llvm-objdump][test] Move tests after dc4a6f5db4f0178bae43ef615cc8902c759d6195
Fangrui Song [Sat, 11 Jul 2020 23:44:34 +0000 (16:44 -0700)]
[llvm-objdump][test] Move tests after dc4a6f5db4f0178bae43ef615cc8902c759d6195

Move RISCV/ to ELF/RISCV/ as well.

4 years ago[Attributor] Introudce attribute seed allow list.
kuter [Sat, 11 Jul 2020 23:23:21 +0000 (02:23 +0300)]
[Attributor] Introudce attribute seed allow list.

4 years ago[NewGVN] Regenerate test checks (NFC)
Nikita Popov [Sat, 11 Jul 2020 20:51:25 +0000 (22:51 +0200)]
[NewGVN] Regenerate test checks (NFC)

4 years agoFix `-Wreturn-type` warning. NFC.
Michael Liao [Sat, 11 Jul 2020 20:19:09 +0000 (16:19 -0400)]
Fix `-Wreturn-type` warning. NFC.

4 years agoFix one memory leak in the MLIRParser by using std::unique_ptr to hold the new block...
Mehdi Amini [Sat, 11 Jul 2020 20:05:37 +0000 (20:05 +0000)]
Fix one memory leak in the MLIRParser by using std::unique_ptr to hold the new block pointer

 This is NFC when there is no parsing error.

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

4 years agoFix some memory leak in MLIRContext with respect to registered types/attributes inter...
Mehdi Amini [Sat, 11 Jul 2020 20:05:28 +0000 (20:05 +0000)]
Fix some memory leak in MLIRContext with respect to registered types/attributes interfaces

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

4 years ago[X86] Add test cases for missed opportunities to use vpternlog due to a bitcast betwe...
Craig Topper [Sat, 11 Jul 2020 19:21:41 +0000 (12:21 -0700)]
[X86] Add test cases for missed opportunities to use vpternlog due to a bitcast between the logic ops.

These test cases fail to use vpternlog because the AND was converted
to a blend shuffle and then converted back to AND during shuffle lowering.
This results in the AND having a different type than it started with.
This prevents our custom matching logic from seeing the two logic ops.

4 years ago[examples] fix ExceptionDemo
Stephen Neuendorffer [Sat, 11 Jul 2020 18:47:07 +0000 (11:47 -0700)]
[examples] fix ExceptionDemo

Code didn't compile in a release build.  Guard debug output with
ifndef NDEBUG.

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

4 years ago[openmp] Remove unused variable in DirectiveEmitter
clementval [Sat, 11 Jul 2020 16:59:14 +0000 (12:59 -0400)]
[openmp] Remove unused variable in DirectiveEmitter

4 years ago[OpenMP] Silence unused symbol warning with proper ifdefs
Johannes Doerfert [Sat, 11 Jul 2020 16:57:17 +0000 (11:57 -0500)]
[OpenMP] Silence unused symbol warning with proper ifdefs

4 years agoFix regression due to test hip-version.hip
Yaxun (Sam) Liu [Sat, 11 Jul 2020 14:04:27 +0000 (10:04 -0400)]
Fix regression due to test hip-version.hip

Added RocmInstallationDetector to Darwin and MinGW.

Fixed duplicate ROCm detector in ROCm toolchain.

4 years ago[flang][openmp] Check clauses allowed semantic with tablegen generated map
Valentin Clement [Sat, 11 Jul 2020 16:42:05 +0000 (12:42 -0400)]
[flang][openmp] Check clauses allowed semantic with tablegen generated map

Summary:
This patch is enabling the generation of clauses enum sets for semantics check in Flang through
tablegen. Enum sets and directive - sets map is generated by the new tablegen infrsatructure for OpenMP
and other directive languages.
The semantic checks for OpenMP are modified to use this newly generated map.

Reviewers: DavidTruby, sscalpone, kiranchandramohan, ichoyjx, jdoerfert

Reviewed By: DavidTruby, ichoyjx

Subscribers: mgorny, yaxunl, hiraditya, guansong, sstefan1, aaron.ballman, llvm-commits

Tags: #llvm

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

4 years ago[MLIR] Parallelize affine.for op to 1-D affine.parallel op
Yash Jain [Sat, 11 Jul 2020 15:24:18 +0000 (20:54 +0530)]
[MLIR] Parallelize affine.for op to 1-D affine.parallel op

Introduce pass to convert parallel affine.for op into 1-D affine.parallel op.
Run using --affine-parallelize. Removes test-detect-parallel: pass for checking
parallel affine.for ops.

Signed-off-by: Yash Jain <yash.jain@polymagelabs.com>
Differential Revision: https://reviews.llvm.org/D83193

4 years agoFix `-Wunused-variable` warnings. NFC.
Michael Liao [Sat, 11 Jul 2020 14:09:09 +0000 (10:09 -0400)]
Fix `-Wunused-variable` warnings. NFC.

4 years ago[fix-irreducible] Skip unreachable predecessors.
Michael Liao [Fri, 10 Jul 2020 14:56:28 +0000 (10:56 -0400)]
[fix-irreducible] Skip unreachable predecessors.

Summary:
- Skip unreachable predecessors during header detection in SCC. Those
  unreachable blocks would be generated in the switch lowering pass in
  the corner cases or other frontends. Even though they could be removed
  through the CFG simplification, we should skip them during header
  detection.

Reviewers: sameerds

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[Attributor][NFC] Add more debug output for deleted functions
sstefan1 [Sat, 11 Jul 2020 12:24:56 +0000 (14:24 +0200)]
[Attributor][NFC] Add more debug output for deleted functions

4 years ago[AMDGPU] Move LowerSwitch pass to CodeGenPrepare.
Christudasan Devadasan [Fri, 10 Jul 2020 18:49:51 +0000 (00:19 +0530)]
[AMDGPU] Move LowerSwitch pass to CodeGenPrepare.

It is possible that LowerSwitch pass leaves certain blocks
unreachable from the entry. If not removed, these dead blocks
can cause undefined behavior in the subsequent passes.
It caused a crash in the AMDGPU backend after the instruction
selection when a PHI node has its incoming values coming from
these unreachable blocks.

In the AMDGPU pass flow, the last invocation of UnreachableBlockElim
precedes where LowerSwitch is currently placed and eventually
missed out on the opportunity to get these blocks eliminated.
This patch ensures that LowerSwitch pass get inserted earlier
to make use of the existing unreachable block elimination pass.

Reviewed By: sameerds, arsenm

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

4 years ago[TRE] allow TRE for non-capturing calls.
Alexey Lapshin [Fri, 19 Jun 2020 20:55:05 +0000 (23:55 +0300)]
[TRE] allow TRE for non-capturing calls.

The current implementation of Tail Recursion Elimination has a very restricted
pre-requisite: AllCallsAreTailCalls. i.e. it requires that no function
call receives a pointer to local stack. Generally, function calls that
receive a pointer to local stack but do not capture it - should not
break TRE. This fix allows us to do TRE if it is proved that no pointer
to the local stack is escaped.

Reviewed by: efriedma

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

4 years agoRevert "Reland "[InstCombine] Lower infinite combine loop detection thresholds"""
Roman Lebedev [Sat, 11 Jul 2020 10:52:33 +0000 (13:52 +0300)]
Revert "Reland "[InstCombine] Lower infinite combine loop detection thresholds"""

And there's a new hit: https://bugs.llvm.org/show_bug.cgi?id=46680
This reverts commit 7103c87596efccd532e9fe04a6ba6a200fed8481.

4 years ago[gn build] (manually) merge 943660fd15f193
Nico Weber [Sat, 11 Jul 2020 10:43:28 +0000 (06:43 -0400)]
[gn build] (manually) merge 943660fd15f193

4 years agoReland Fix gn build after 943660f
Nathan James [Sat, 11 Jul 2020 10:42:05 +0000 (11:42 +0100)]
Reland Fix gn build after 943660f

4 years agoRevert "Fix gn builds after 943660fd1"
Nathan James [Sat, 11 Jul 2020 09:45:17 +0000 (10:45 +0100)]
Revert "Fix gn builds after 943660fd1"

This reverts commit 4abdcdb45ee22d77dd64a71cb41e967d35361280.

4 years agoFix gn builds after 943660fd1
Nathan James [Sat, 11 Jul 2020 09:42:57 +0000 (10:42 +0100)]
Fix gn builds after 943660fd1

4 years ago[clang-tidy] Reworked enum options handling(again)
Nathan James [Sat, 11 Jul 2020 09:10:59 +0000 (10:10 +0100)]
[clang-tidy] Reworked enum options handling(again)

Reland b9306fd after fixing the issue causing mac builds to fail unittests.

Following on from D77085, I was never happy with the passing a mapping to the option get/store functions. This patch addresses this by using explicit specializations to handle the serializing and deserializing of enum options.

Reviewed By: aaron.ballman

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

4 years ago[OpenMP][FIX] remove unused variable and long if-else chain
Johannes Doerfert [Sat, 11 Jul 2020 07:36:07 +0000 (02:36 -0500)]
[OpenMP][FIX] remove unused variable and long if-else chain

MSVC throws an error if you use "too many" if-else in a row:
  `Frontend/OpenMP/OMPKinds.def(570): fatal error C1061: compiler limit:
    blocks nested too deeply`
We work around it now...

4 years agoRemove unused variable `KMPC_KERNEL_PARALLEL_WORK_FN_PTR_ARG_NO` (NFC)
Mehdi Amini [Sat, 11 Jul 2020 07:17:28 +0000 (07:17 +0000)]
Remove unused variable `KMPC_KERNEL_PARALLEL_WORK_FN_PTR_ARG_NO` (NFC)

This fixes a compiler warning.

4 years ago[OpenMP] Replace function pointer uses in GPU state machine
Johannes Doerfert [Tue, 7 Jul 2020 00:57:37 +0000 (19:57 -0500)]
[OpenMP] Replace function pointer uses in GPU state machine

In non-SPMD mode we create a state machine like code to identify the
parallel region the GPU worker threads should execute next. The
identification uses the parallel region function pointer as that allows
it to work even if the kernel (=target region) and the parallel region
are in separate TUs. However, taking the address of a function comes
with various downsides. With this patch we will identify the most common
situation and replace the function pointer use with a dummy global
symbol (for identification purposes only). That means, if the parallel
region is only called from a single target region (or kernel), we do not
use the function pointer of the parallel region to identify it but a new
global symbol.

Fixes PR46450.

Reviewed By: JonChesterfield

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

4 years ago[OpenMP] Compute a proper module slice for the CGSCCC pass
Johannes Doerfert [Tue, 7 Jul 2020 00:26:01 +0000 (19:26 -0500)]
[OpenMP] Compute a proper module slice for the CGSCCC pass

The module slice describes which functions we can analyze and transform
while working on an SCC as part of the CGSCC OpenMPOpt pass. So far, we
simply restricted it to the SCC. In a follow up we will need to have a
bigger scope which is why this patch introduces a proper identification
of the module slice. In short, everything that has a transitive
reference to a function in the SCC or is transitively referenced by one
is fair game.

Reviewed By: sstefan1

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

4 years ago[OpenMP] Identify GPU kernels (aka. OpenMP target regions)
Johannes Doerfert [Tue, 7 Jul 2020 00:19:12 +0000 (19:19 -0500)]
[OpenMP] Identify GPU kernels (aka. OpenMP target regions)

We now identify GPU kernels, that is entry points into the GPU code.
These kernels (can) correspond to OpenMP target regions. With this patch
we identify and on request print them via remarks.

Reviewed By: JonChesterfield

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