platform/upstream/llvm.git
5 years agoUpdate stale comment in lang/c/struct_types/main.c
Jonas Devlieghere [Mon, 4 Feb 2019 20:33:35 +0000 (20:33 +0000)]
Update stale comment in lang/c/struct_types/main.c

rdar://47322760

llvm-svn: 353087

5 years agoSupport tests in freestanding
JF Bastien [Mon, 4 Feb 2019 20:31:13 +0000 (20:31 +0000)]
Support tests in freestanding

Summary:
Freestanding is *weird*. The standard allows it to differ in a bunch of odd
manners from regular C++, and the committee would like to improve that
situation. I'd like to make libc++ behave better with what freestanding should
be, so that it can be a tool we use in improving the standard. To do that we
need to try stuff out, both with "freestanding the language mode" and
"freestanding the library subset".

Let's start with the super basic: run the libc++ tests in freestanding, using
clang as the compiler, and see what works. The easiest hack to do this:

In utils/libcxx/test/config.py add:

  self.cxx.compile_flags += ['-ffreestanding']

Run the tests and they all fail.

Why? Because in freestanding `main` isn't special. This "not special" property
has two effects: main doesn't get mangled, and main isn't allowed to omit its
`return` statement. The first means main gets mangled and the linker can't
create a valid executable for us to test. The second means we spew out warnings
(ew) and the compiler doesn't insert the `return` we omitted, and main just
falls of the end and does whatever undefined behavior (if you're luck, ud2
leading to non-zero return code).

Let's start my work with the basics. This patch changes all libc++ tests to
declare `main` as `int main(int, char**` so it mangles consistently (enabling us
to declare another `extern "C"` main for freestanding which calls the mangled
one), and adds `return 0;` to all places where it was missing. This touches 6124
files, and I apologize.

The former was done with The Magic Of Sed.

The later was done with a (not quite correct but decent) clang tool:

  https://gist.github.com/jfbastien/793819ff360baa845483dde81170feed

This works for most tests, though I did have to adjust a few places when e.g.
the test runs with `-x c`, macros are used for main (such as for the filesystem
tests), etc.

Once this is in we can create a freestanding bot which will prevent further
regressions. After that, we can start the real work of supporting C++
freestanding fairly well in libc++.

<rdar://problem/47754795>

Reviewers: ldionne, mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, arphaman, miyuki, libcxx-commits

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

llvm-svn: 353086

5 years ago[CMake] Support CMake variables for setting target, sysroot and toolchain
Petr Hosek [Mon, 4 Feb 2019 20:02:26 +0000 (20:02 +0000)]
[CMake] Support CMake variables for setting target, sysroot and toolchain

CMake has a standard way of setting target triple, sysroot and external
toolchain through CMAKE_<LANG>_COMPILER_TARGET, CMAKE_SYSROOT and
CMAKE_<LANG>_COMPILER_EXTERNAL_TOOLCHAIN. These are turned into
corresponding --target=, --sysroot= and --gcc-toolchain= variables add
included appended to CMAKE_<LANG>_FLAGS.

libunwind, libc++abi, libc++ provides their own mechanism through
<PROJECT>_TARGET_TRIPLE, <PROJECT>_SYSROOT and <PROJECT>_GCC_TOOLCHAIN
variables. These are also passed to lit via lit.site.cfg, and lit config
uses these to set the corresponding compiler flags when building tessts.

This means that there are two different ways of setting target, sysroot
and toolchain, but only one is properly supported in lit. This change
extends CMake build for libunwind, libc++abi and libc++ to also support
the CMake variables in addition to project specific ones in lit.

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

llvm-svn: 353084

5 years ago[AMDGPU] Support emitting GOT relocations for function calls
Scott Linder [Mon, 4 Feb 2019 20:00:07 +0000 (20:00 +0000)]
[AMDGPU] Support emitting GOT relocations for function calls

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

llvm-svn: 353083

5 years ago[WarnMissedTransforms] Do not warn about already vectorized loops.
Michael Kruse [Mon, 4 Feb 2019 19:55:59 +0000 (19:55 +0000)]
[WarnMissedTransforms] Do not warn about already vectorized loops.

LoopVectorize adds llvm.loop.isvectorized, but leaves
llvm.loop.vectorize.enable. Do not consider such a loop for user-forced
vectorization since vectorization already happened -- by prioritizing
llvm.loop.isvectorized except for TM_SuppressedByUser.

Fixes http://llvm.org/PR40546

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

llvm-svn: 353082

5 years agoGlobalISel: Fix CheckMachineFunction passing if ReadCheckFile files
Matt Arsenault [Mon, 4 Feb 2019 19:53:22 +0000 (19:53 +0000)]
GlobalISel: Fix CheckMachineFunction passing if ReadCheckFile files

This could be tested, but the FileCheck library spams the error
message to the console.

llvm-svn: 353081

5 years agoGlobalISel: Allow constructing SrcOp/DstOp from MachineOperand
Matt Arsenault [Mon, 4 Feb 2019 19:53:19 +0000 (19:53 +0000)]
GlobalISel: Allow constructing SrcOp/DstOp from MachineOperand

llvm-svn: 353080

5 years ago[clang-tidy] Add the abseil-duration-unnecessary-conversion check
Hyrum Wright [Mon, 4 Feb 2019 19:28:20 +0000 (19:28 +0000)]
[clang-tidy] Add the abseil-duration-unnecessary-conversion check

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

llvm-svn: 353079

5 years agoGlobalISel: Fix parameter name in documentation
Matt Arsenault [Mon, 4 Feb 2019 19:16:58 +0000 (19:16 +0000)]
GlobalISel: Fix parameter name in documentation

llvm-svn: 353078

5 years agoGlobalISel: Fix CSE handling of buildConstant
Matt Arsenault [Mon, 4 Feb 2019 19:15:50 +0000 (19:15 +0000)]
GlobalISel: Fix CSE handling of buildConstant

This fixes two problems with CSE done in buildConstant. First, this
would hit an assert when used with a vector result type. Solve this by
allowing CSE on the vector elements, but not on the result vector for
now.

Second, this was also performing the CSE based on the input
ConstantInt pointer. The underlying buildConstant could potentially
convert the constant depending on the result type, giving in a
different ConstantInt*. Stop allowing the APInt and ConstantInt forms
from automatically casting to the result type to avoid any similar
problems in the future.

llvm-svn: 353077

5 years ago[WebAssembly] clang-tidy (NFC)
Heejin Ahn [Mon, 4 Feb 2019 19:13:46 +0000 (19:13 +0000)]
[WebAssembly] clang-tidy (NFC)

Summary:
This patch fixes clang-tidy warnings on wasm-only files.
The list of checks used is:
`-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,readability-identifier-naming,modernize-*`
(LLVM's default .clang-tidy list is the same except it does not have
`modernize-*`.)

The list of fixes are:
- Variable names start with an uppercase letter
- Function names start with a lowercase letter
- Use `auto` when you use casts so the type is evident

Reviewers: sbc100

Subscribers: dschuff, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 353076

5 years ago[WebAssembly] clang-tidy (NFC)
Heejin Ahn [Mon, 4 Feb 2019 19:13:39 +0000 (19:13 +0000)]
[WebAssembly] clang-tidy (NFC)

Summary:
This patch fixes clang-tidy warnings on wasm-only files.
The list of checks used is:
`-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,readability-identifier-naming,modernize-*`
(LLVM's default .clang-tidy list is the same except it does not have
`modernize-*`. But I've seen in multiple CLs in LLVM the modernize style
was recommended and code was fixed based on the style, so I added it as
well.)

The common fixes are:
- Variable names start with an uppercase letter
- Function names start with a lowercase letter
- Use `auto` when you use casts so the type is evident
- Use inline initialization for class member variables
- Use `= default` for empty constructors / destructors
- Use `using` in place of `typedef`

Reviewers: sbc100, tlively, aardappel

Subscribers: dschuff, sunfish, jgravelle-google, yurydelendik, kripken, MatzeB, mgorny, rupprecht, llvm-commits

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

llvm-svn: 353075

5 years ago[llvm-objcopy][NFC] simplify an error return
Jordan Rupprecht [Mon, 4 Feb 2019 19:09:20 +0000 (19:09 +0000)]
[llvm-objcopy][NFC] simplify an error return

llvm-svn: 353074

5 years ago[X86] X86DAGToDAGISel::matchBitExtract(): prepare 'control' in 32 bits
Roman Lebedev [Mon, 4 Feb 2019 19:04:26 +0000 (19:04 +0000)]
[X86] X86DAGToDAGISel::matchBitExtract(): prepare 'control' in 32 bits

Summary:
Noticed while looking at D56052.
```
  // The 'control' of BEXTR has the pattern of:
  // [15...8 bit][ 7...0 bit] location
  // [ bit count][     shift] name
  // I.e. 0b000000011'00000001 means  (x >> 0b1) & 0b11
```
I.e. we do not care about any of the bits aside from the low 16 bits.
So there is no point in doing the `slh`,`or` in 64 bits,
let's just do everything in 32 bits, and anyext if needed.

We could do that in 16 even, but we intentionally don't
zext to i16 (longer encoding IIRC),
so i'm guessing the same applies here.

Reviewers: craig.topper, andreadb, RKSimon

Reviewed By: craig.topper

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 353073

5 years agoGlobalISel: Improve gtest usage
Matt Arsenault [Mon, 4 Feb 2019 18:58:27 +0000 (18:58 +0000)]
GlobalISel: Improve gtest usage

Don't unnecessarily use ASSERT_*, and print the MachineFunction
on failure.

llvm-svn: 353072

5 years agoAdjust cardinality of internal inliner thresholds
David Callahan [Mon, 4 Feb 2019 18:46:25 +0000 (18:46 +0000)]
Adjust cardinality of internal inliner thresholds

Summary:
While compiling openJDK11 (also other workloads), some make files would pass both  CFLAGS  and LDFLAGS at link step ; resulting in duplicate options on the command line when one is using LTO and trying to influence the inliner. Most of the internal flags are ZeroOrMore, this diff changes the remaining ones.

Reviewers: david2050, twoh, modocache

Reviewed By: twoh

Subscribers: mehdi_amini, dexonsmith, eraman, haicheng, llvm-commits

Tags: #llvm

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

Patch by: Abdoul-Kader Keita

llvm-svn: 353071

5 years ago[X86] Add ST0 as an implicit def/use of x87 load/store instructions during FP stackif...
Craig Topper [Mon, 4 Feb 2019 18:43:55 +0000 (18:43 +0000)]
[X86] Add ST0 as an implicit def/use of x87 load/store instructions during FP stackifying.

These instructions implicitly operate on ST0, but we don't currently add that information to the MachineInstr. We also don't add it the tablegen definitions either.

For the most part this doesn't cause any problems because the stackifying occurs after register allocation. All the instructions are marked as having side effects so the postRA scheduler won't reorder them amongst themselves.

But nothing stops inline assembly using X87 instructions from being reordered around other x87 instructions if that inline assembly wasn't marked volatile.

The two test cases I've identified so far in PR40539 involve loads and stores used to set up the inline assembly or capture the results of the inline assembly ending up in the wrong order.

This patch adds implicit ST0 uses/defs to the load/store instructions to prevent this from happening.

I plan to fix all of the FP instructions, but the binops are bit trickier to get right. So I've chosen fixing the known test cases as a good first step.

I think we also need to update the tablegen descriptions so MS inline assembly infers the right clobbers, but I haven't checked that yet.

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

llvm-svn: 353070

5 years agoGlobalISel: Fix moreElementsToNextPow2
Matt Arsenault [Mon, 4 Feb 2019 18:42:24 +0000 (18:42 +0000)]
GlobalISel: Fix moreElementsToNextPow2

This was completely broken. The condition was inverted, and changed
the element type for vectors of pointers.

Fixes bug 40592.

llvm-svn: 353069

5 years ago[llvm-objcopy][NFC] Use StringSaver for --keep-global-symbols
Jordan Rupprecht [Mon, 4 Feb 2019 18:38:00 +0000 (18:38 +0000)]
[llvm-objcopy][NFC] Use StringSaver for --keep-global-symbols

Summary: Use StringSaver/BumpPtrAlloc when parsing lines from --keep-global-symbols files. This allows us to consistently use StringRef for driver options, which avoids copying the full strings for each object copied, as well as simplifies part of D57517.

Reviewers: jhenderson, evgeny777, alexshap

Subscribers: jakehehrlich

Tags: #llvm

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

llvm-svn: 353068

5 years ago[WebAssembly] Make segment/size/type directives optional in asm
Wouter van Oortmerssen [Mon, 4 Feb 2019 18:03:11 +0000 (18:03 +0000)]
[WebAssembly] Make segment/size/type directives optional in asm

Summary:
These were "boilerplate" that repeated information already present
in .functype and end_function, that needed to be repeated to Please
the particular way our object writing works, and missing them would
generate errors.

Instead, we generate the information for these automatically so the
user can concern itself with writing more canonical wasm functions
that always work as expected.

Reviewers: dschuff, sbc100

Subscribers: jgravelle-google, aheejin, sunfish, llvm-commits

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

llvm-svn: 353067

5 years ago[WebAssembly] Update relocation naming to match llvm change. NFC.
Sam Clegg [Mon, 4 Feb 2019 17:49:33 +0000 (17:49 +0000)]
[WebAssembly] Update relocation naming to match llvm change. NFC.

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

llvm-svn: 353066

5 years agoRevert "[GlobalISel] Introduce a generic floating point floor opcode, G_FFLOOR"
Jessica Paquette [Mon, 4 Feb 2019 17:32:47 +0000 (17:32 +0000)]
Revert "[GlobalISel] Introduce a generic floating point floor opcode, G_FFLOOR"

This reverts commit b05ecba6d687fcb3078509220c67458bf1d77a2e.

Apparently adding floor breaks AMDGPU somehow, so I have to back this out
while I look into it.

llvm-svn: 353065

5 years agoRevert "[GlobalISel] Add IRTranslator support for G_FFLOOR"
Jessica Paquette [Mon, 4 Feb 2019 17:32:43 +0000 (17:32 +0000)]
Revert "[GlobalISel] Add IRTranslator support for G_FFLOOR"

This reverts commit 8bbd570fd5205a04d88d2e5513a6e4adbd028039.

Apparently adding ffloor breaks AMDGPU somehow, so I need to back this out
while I look into it.

llvm-svn: 353064

5 years agogn build: Merge r352944
Nico Weber [Mon, 4 Feb 2019 17:32:36 +0000 (17:32 +0000)]
gn build: Merge r352944

llvm-svn: 353063

5 years ago[WebAssembly] Rename relocations from R_WEBASSEMBLY_ to R_WASM_
Sam Clegg [Mon, 4 Feb 2019 17:28:46 +0000 (17:28 +0000)]
[WebAssembly] Rename relocations from R_WEBASSEMBLY_ to R_WASM_

See https://github.com/WebAssembly/tool-conventions/pull/95.

This is less typing and IMHO more readable, and it also fits with
our naming around the binary format which tends to use the short name.
e.g.

include/llvm/BinaryFormat/Wasm.h
tools/llvm-objdump/WasmDump.cpp
etc..

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

llvm-svn: 353062

5 years ago[X86] Print all register forms of x87 fadd/fsub/fdiv/fmul as having two arguments...
Craig Topper [Mon, 4 Feb 2019 17:28:18 +0000 (17:28 +0000)]
[X86] Print all register forms of x87 fadd/fsub/fdiv/fmul as having two arguments where on is %st.

All of these instructions consume one encoded register and the other register is %st. They either write the result to %st or the encoded register. Previously we printed both arguments when the encoded register was written. And we printed one argument when the result was written to %st. For the stack popping forms the encoded register is always the destination and we didn't print both operands. This was inconsistent with gcc and objdump and just makes the output assembly code harder to read.

This patch changes things to always print both operands making us consistent with gcc and objdump. The parser should still be able to handle the single register forms just as it did before. This also matches the GNU assembler behavior.

llvm-svn: 353061

5 years ago[WebAssembly] Remove redundant namespaces qualifiers. NFC.
Sam Clegg [Mon, 4 Feb 2019 17:26:22 +0000 (17:26 +0000)]
[WebAssembly] Remove redundant namespaces qualifiers. NFC.

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

llvm-svn: 353060

5 years ago[Intrinsic] Unsigned Fixed Point Multiplication Intrinsic
Leonard Chan [Mon, 4 Feb 2019 17:18:11 +0000 (17:18 +0000)]
[Intrinsic] Unsigned Fixed Point Multiplication Intrinsic

Add an intrinsic that takes 2 unsigned integers with the scale of them
provided as the third argument and performs fixed point multiplication on
them.

This is a part of implementing fixed point arithmetic in clang where some of
the more complex operations will be implemented as intrinsics.

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

llvm-svn: 353059

5 years ago[GlobalISel] Add IRTranslator support for G_FFLOOR
Jessica Paquette [Mon, 4 Feb 2019 17:15:34 +0000 (17:15 +0000)]
[GlobalISel] Add IRTranslator support for G_FFLOOR

Follow-up to https://reviews.llvm.org/D57484

Adds G_FFLOOR to translateKnownIntrinsic and update arm64-irtranslator.ll.

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

llvm-svn: 353058

5 years ago[GlobalISel] Introduce a generic floating point floor opcode, G_FFLOOR
Jessica Paquette [Mon, 4 Feb 2019 17:10:55 +0000 (17:10 +0000)]
[GlobalISel] Introduce a generic floating point floor opcode, G_FFLOOR

This introduces a generic opcode for floating point floor, working towards
selecting @llvm.floor.

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

llvm-svn: 353057

5 years ago[CGP] use IRBuilder to simplify code
Sanjay Patel [Mon, 4 Feb 2019 16:30:46 +0000 (16:30 +0000)]
[CGP] use IRBuilder to simplify code

This is no-functional-change-intended although there could
be intermediate variations caused by a difference in the
debug info produced by setting that from the builder's
insertion point.

I'm updating the IR test file associated with this code just
to show that the naming differences from using the builder
are visible.

The motivation for adding a helper function is that we are
likely to extend this code to deal with other overflow ops.

llvm-svn: 353056

5 years ago[scudo] Initial standalone skeleton check-in
Kostya Kortchinsky [Mon, 4 Feb 2019 16:25:40 +0000 (16:25 +0000)]
[scudo] Initial standalone skeleton check-in

Summary:
This is the initial check-in for the Standalone version of Scudo.

The project is initially going to live in scudo/standalone then will
replace scudo. See http://lists.llvm.org/pipermail/llvm-dev/2019-January/129113.html
for details.

This initial CL is meant to lay out the project structure, of both
code & tests, providing a minimal amount of functionalities, namely
various definitions, some atomic helpers and an intrusive list.
(empty.cc is just here to have a compilation unit, but will go away
in the upcoming CLs).

Initial support is restricted to Linux i386 & x86_64 in make files
and will be extended once things land & work.

We will grow organically from here, adding functionalities in limited
amounts.

Reviewers: morehouse, eugenis, vitalybuka, kcc, mcgrathr, flowerhack

Reviewed By: morehouse, vitalybuka

Subscribers: srhines, mgorny, krytarowski, delcypher, jfb, #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

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

llvm-svn: 353055

5 years ago[clangd] Enable include insertion for static index
Kadir Cetinkaya [Mon, 4 Feb 2019 16:19:57 +0000 (16:19 +0000)]
[clangd] Enable include insertion for static index

Summary:
This enables include insertion by adding canonical includes into
preambledata.

Reviewers: ioeric, ilya-biryukov

Subscribers: javed.absar, MaskRay, jkorous, arphaman, cfe-commits

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

llvm-svn: 353054

5 years ago[CommandLine] Don't print empty sentinel values from EnumValN lists in help text
James Henderson [Mon, 4 Feb 2019 16:17:57 +0000 (16:17 +0000)]
[CommandLine] Don't print empty sentinel values from EnumValN lists in help text

In order to make an option value truly optional, both the ValueOptional
attribute and an empty-named value are required. Prior to this change,
this empty-named value appears in the command-line help text:

-some-option - some help text
  =v1        - description 1
  =v2        - description 2
  =          -

This change improves the help text for these sort of options in a number
of ways:

1) ValueOptional options with an empty-named value now print their help
   text twice: both without and then with '=<value>' after the name. The
   latter version then lists the allowed values after it.
2) Empty-named values with no help text in ValueOptional options are not
   listed in the permitted values.

-some-option         - some help text
-some-option=<value> - some help text
  =v1                - description 1
  =v2                - description 2

3) Otherwise empty-named options are printed as =<empty> rather than
   simply '='.
4) Option values without help text do not have the '-' separator
   printed.

-some-option=<value> - some help text
  =v1                - description 1
  =v2
  =<empty>           - description

It also tweaks the llvm-symbolizer -functions help text to not print a
trailing ':' as that looks bad combined with 1) above.

This is mostly a reland of r353048 which in turn was a reland of
r352750.

Reviewed by: ruiu, thopre, mstorsjo

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

llvm-svn: 353053

5 years ago[OMPT] Make sure that OMPT is enabled when accessing internals of the runtime
Joachim Protze [Mon, 4 Feb 2019 15:59:42 +0000 (15:59 +0000)]
[OMPT] Make sure that OMPT is enabled when accessing internals of the runtime

The three switch fallthrough generate a warning with -Wimplicit-fallthrough.
Two are documented as fallthrough, one is not, but I think the intention is to also fallthrough in kmp_tasking.cpp.

Not sure whether kmp.h is the best place to define the macro.

Reviewers: jlpeyton, AndreyChurbanov, Hahnfeld

Reviewed By: jlpeyton

Tags: #openmp

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

llvm-svn: 353052

5 years ago[X86][SSE] SimplifyDemandedBitsForTargetNode - PCMPGT(0,X) sign mask
Simon Pilgrim [Mon, 4 Feb 2019 15:43:36 +0000 (15:43 +0000)]
[X86][SSE] SimplifyDemandedBitsForTargetNode - PCMPGT(0,X) sign mask

For PCMPGT(0, X) patterns where we only demand the sign bit (e.g. BLENDV or MOVMSK) then we can use X directly.

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

llvm-svn: 353051

5 years agoRevert r353048.
James Henderson [Mon, 4 Feb 2019 15:09:58 +0000 (15:09 +0000)]
Revert r353048.

It was causing unexpected unit test failures on build bots.

llvm-svn: 353050

5 years agoFixes for the ProcessLaunchInfo move
Pavel Labath [Mon, 4 Feb 2019 15:03:06 +0000 (15:03 +0000)]
Fixes for the ProcessLaunchInfo move

llvm-svn: 353049

5 years ago[CommandLine] Don't print empty sentinel values from EnumValN lists in help text
James Henderson [Mon, 4 Feb 2019 14:48:33 +0000 (14:48 +0000)]
[CommandLine] Don't print empty sentinel values from EnumValN lists in help text

In order to make an option value truly optional, both the ValueOptional
attribute and an empty-named value are required. Prior to this change,
this empty-named value appears in the command-line help text:

-some-option - some help text
  =v1        - description 1
  =v2        - description 2
  =          -

This change improves the help text for these sort of options in a number
of ways:

1) ValueOptional options with an empty-named value now print their help
   text twice: both without and then with '=<value>' after the name. The
   latter version then lists the allowed values after it.
2) Empty-named values with no help text in ValueOptional options are not
   listed in the permitted values.

-some-option         - some help text
-some-option=<value> - some help text
  =v1                - description 1
  =v2                - description 2

3) Otherwise empty-named options are printed as =<empty> rather than
   simply '='.
4) Option values without help text do not have the '-' separator
   printed.

-some-option=<value> - some help text
  =v1                - description 1
  =v2
  =<empty>           - description

It also tweaks the llvm-symbolizer -functions help text to not print a
trailing ':' as that looks bad combined with 1) above.

This is mostly a reland of r352750.

Reviewed by: ruiu, thopre, mstorsjo

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

llvm-svn: 353048

5 years agoMove FileAction, ProcessInfo and ProcessLaunchInfo from Target to Host
Pavel Labath [Mon, 4 Feb 2019 14:28:08 +0000 (14:28 +0000)]
Move FileAction, ProcessInfo and ProcessLaunchInfo from Target to Host

Summary:
These classes describe the details of the process we are about to
launch, and so they are naturally used by the launching code in the Host
module. Previously they were present in Target because that is the most
important (but by far not the only) user of the launching code.

Since the launching code has other customers, must of which do not care
about Targets, it makes sense to move these classes to the Host layer,
next to the launching code.

This move reduces the number of times that Target is included from host
to 8 (it used to be 14).

Reviewers: zturner, clayborg, jingham, davide, teemperor

Subscribers: emaste, mgorny, lldb-commits

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

llvm-svn: 353047

5 years agoGlobalISel: Fix formatting of debug output
Matt Arsenault [Mon, 4 Feb 2019 14:05:33 +0000 (14:05 +0000)]
GlobalISel: Fix formatting of debug output

There was a missing space before the instruction name, and the newline
is redundant since MI::print by default adds one.

llvm-svn: 353046

5 years agoAMDGPU/GlobalISel: Legalize select for v4s16
Matt Arsenault [Mon, 4 Feb 2019 14:04:52 +0000 (14:04 +0000)]
AMDGPU/GlobalISel: Legalize select for v4s16

Also add some more select tests to help show future legalization
changes.

llvm-svn: 353045

5 years ago[DAGCombine] Add ADD(SUB,SUB) combines
Simon Pilgrim [Mon, 4 Feb 2019 13:44:49 +0000 (13:44 +0000)]
[DAGCombine] Add ADD(SUB,SUB) combines

Noticed while investigating PR40483, and fixes the basic test case from the bug - but not a more general case.

We're pretty weak at dealing with ADD/SUB combines compared to the SimplifyAssociativeOrCommutative/SimplifyUsingDistributiveLaws abilities that InstCombine can manage.

llvm-svn: 353044

5 years ago[AsmPrinter] Remove hidden flag -print-schedule.
Andrea Di Biagio [Mon, 4 Feb 2019 12:51:26 +0000 (12:51 +0000)]
[AsmPrinter] Remove hidden flag -print-schedule.

This patch removes hidden codegen flag -print-schedule effectively reverting the
logic originally committed as r300311
(https://llvm.org/viewvc/llvm-project?view=revision&revision=300311).

Flag -print-schedule was originally introduced by r300311 to address PR32216
(https://bugs.llvm.org/show_bug.cgi?id=32216). That bug was about adding "Better
testing of schedule model instruction latencies/throughputs".

These days, we can use llvm-mca to test scheduling models. So there is no longer
a need for flag -print-schedule in LLVM. The main use case for PR32216 is
now addressed by llvm-mca.
Flag -print-schedule is mainly used for debugging purposes, and it is only
actually used by x86 specific tests. We already have extensive (latency and
throughput) tests under "test/tools/llvm-mca" for X86 processor models. That
means, most (if not all) existing -print-schedule tests for X86 are redundant.

When flag -print-schedule was first added to LLVM, several files had to be
modified; a few APIs gained new arguments (see for example method
MCAsmStreamer::EmitInstruction), and MCSubtargetInfo/TargetSubtargetInfo gained
a couple of getSchedInfoStr() methods.

Method getSchedInfoStr() had to originally work for both MCInst and
MachineInstr. The original implmentation of getSchedInfoStr() introduced a
subtle layering violation (reported as PR37160 and then fixed/worked-around by
r330615).
In retrospect, that new API could have been designed more optimally. We can
always query MCSchedModel to get the latency and throughput. More importantly,
the "sched-info" string should not have been generated by the subtarget.
Note, r317782 fixed an issue where "print-schedule" didn't work very well in the
presence of inline assembly. That commit is also reverted by this change.

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

llvm-svn: 353043

5 years ago[X86] Add a couple of missed ADD combine tests
Simon Pilgrim [Mon, 4 Feb 2019 12:37:38 +0000 (12:37 +0000)]
[X86] Add a couple of missed ADD combine tests

Noticed while investigating PR40483

llvm-svn: 353042

5 years agoUse auto for dyn_cast case to save a line. NFCI.
Simon Pilgrim [Mon, 4 Feb 2019 12:32:39 +0000 (12:32 +0000)]
Use auto for dyn_cast case to save a line. NFCI.

llvm-svn: 353041

5 years ago[ARM] Mark 255 and 65535 as cheap for Thumb1 "And"
David Green [Mon, 4 Feb 2019 11:58:48 +0000 (11:58 +0000)]
[ARM] Mark 255 and 65535 as cheap for Thumb1 "And"

This prevents Constant Hoisting from pulling the constant out of the block,
allowing us to still produce LDRH/UXTH nodes. LDRB/UXTB (255) is already cheap
by the default getIntImmCost, but I've added it for clarity.

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

llvm-svn: 353040

5 years ago[ARM] Add testcases for D57671. NFC
David Green [Mon, 4 Feb 2019 11:50:14 +0000 (11:50 +0000)]
[ARM] Add testcases for D57671. NFC

llvm-svn: 353039

5 years ago[NFC] Make a check in GuardWidening more obvious
Max Kazantsev [Mon, 4 Feb 2019 10:41:17 +0000 (10:41 +0000)]
[NFC] Make a check in GuardWidening more obvious

llvm-svn: 353038

5 years agoCommit tests for changes in revision D41608
Dmitry Venikov [Mon, 4 Feb 2019 10:32:07 +0000 (10:32 +0000)]
Commit tests for changes in revision D41608

llvm-svn: 353037

5 years ago[NFC] Rename variables to reflect the actual status of GuardWidening
Max Kazantsev [Mon, 4 Feb 2019 10:31:18 +0000 (10:31 +0000)]
[NFC] Rename variables to reflect the actual status of GuardWidening

llvm-svn: 353036

5 years ago[llvm-objcopy][NFC] Fix trailing semicolon warning.
Clement Courbet [Mon, 4 Feb 2019 10:24:42 +0000 (10:24 +0000)]
[llvm-objcopy][NFC] Fix trailing semicolon warning.

llvm-svn: 353035

5 years ago[NFC] Remove redundant parameters for better readability
Max Kazantsev [Mon, 4 Feb 2019 10:20:51 +0000 (10:20 +0000)]
[NFC] Remove redundant parameters for better readability

llvm-svn: 353034

5 years ago[clang-format] Fix breaking of qualified operator
Krasimir Georgiev [Mon, 4 Feb 2019 09:56:16 +0000 (09:56 +0000)]
[clang-format] Fix breaking of qualified operator

Summary:
From https://bugs.llvm.org/show_bug.cgi?id=40516
```
$ cat a.cpp
const NamespaceName::VeryLongClassName &NamespaceName::VeryLongClassName::myFunction() {
  // do stuff
}

const NamespaceName::VeryLongClassName &NamespaceName::VeryLongClassName::operator++() {
  // do stuff
}
$ ~/ll/build/opt/bin/clang-format -style=LLVM a.cpp
const NamespaceName::VeryLongClassName &
NamespaceName::VeryLongClassName::myFunction() {
  // do stuff
}

const NamespaceName::VeryLongClassName &NamespaceName::VeryLongClassName::
operator++() {
  // do stuff
}
```
What was happening is that the split penalty before `operator` was being set to
a smaller value by a prior if block. Moved checks around to fix this and added a
regression test.

Reviewers: djasper

Reviewed By: djasper

Tags: #clang

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

llvm-svn: 353033

5 years ago[NFC] Replace equivalent condition for better readability
Max Kazantsev [Mon, 4 Feb 2019 09:55:18 +0000 (09:55 +0000)]
[NFC] Replace equivalent condition for better readability

llvm-svn: 353032

5 years ago[clang] Add getCommentHandler to PreambleCallbacks
Kadir Cetinkaya [Mon, 4 Feb 2019 09:42:33 +0000 (09:42 +0000)]
[clang] Add getCommentHandler to PreambleCallbacks

Summary:
Enables users to add comment handlers to preprocessor when building
preambles.

Reviewers: ilya-biryukov, ioeric

Subscribers: cfe-commits

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

llvm-svn: 353030

5 years ago[SelectionDAG] Add a BaseIndexOffset::print() method for debugging.
Clement Courbet [Mon, 4 Feb 2019 09:30:43 +0000 (09:30 +0000)]
[SelectionDAG] Add a BaseIndexOffset::print() method for debugging.

llvm-svn: 353028

5 years ago[clangd] Bump vscode-clangd v0.0.10
Haojian Wu [Mon, 4 Feb 2019 09:26:42 +0000 (09:26 +0000)]
[clangd] Bump vscode-clangd v0.0.10

CHANGELOG:
- cleanup filestatus caches when clangd crashes
- extension workwith LSP v3.14.0, support go-to-declaration feature

llvm-svn: 353027

5 years ago[clangd] Update vscode dependencies
Haojian Wu [Mon, 4 Feb 2019 09:20:41 +0000 (09:20 +0000)]
[clangd] Update vscode dependencies

This allows us to use latest LSP v3.14.0 (for go-to-declaration feature).

llvm-svn: 353026

5 years ago[llvm-exegesis] Cut run time of analysis mode by another -35% (*sic*) (YamlContext...
Roman Lebedev [Mon, 4 Feb 2019 09:12:25 +0000 (09:12 +0000)]
[llvm-exegesis] Cut run time of analysis mode by another -35% (*sic*) (YamlContext::getRegNo())

Summary:

Together with the previous patch, it's an -90% improvement,
or roughly -96% improvement if you look starting with rL347204

```
$ perf stat -r 9 ./bin/llvm-exegesis -mode=analysis -analysis-epsilon=1.0 -benchmarks-file=/tmp/benchmarks-inverse_throughput-onefull.yaml -analysis-clusters-output-file="" -analysis-inconsistencies-output-file=/tmp/clusters-bew.html
no exegesis target for x86_64-unknown-linux-gnu, using default
Parsed 14656 benchmark points
Printing sched class consistency analysis results to file '/tmp/clusters-bew.html'
...
no exegesis target for x86_64-unknown-linux-gnu, using default
Parsed 14656 benchmark points
Printing sched class consistency analysis results to file '/tmp/clusters-bew.html'

 Performance counter stats for './bin/llvm-exegesis -mode=analysis -analysis-epsilon=1.0 -benchmarks-file=/tmp/benchmarks-inverse_throughput-onefull.yaml -analysis-clusters-output-file= -analysis-inconsistencies-output-file=/tmp/clusters-bew.html' (9 runs):

           1483.18 msec task-clock                #    0.999 CPUs utilized            ( +-  0.10% )
                68      context-switches          #   46.085 M/sec                    ( +- 22.62% )
                 0      cpu-migrations            #    0.000 K/sec
             11641      page-faults               # 7850.880 M/sec                    ( +-  0.62% )
        5943246799      cycles                    # 4008184.428 GHz                   ( +-  0.10% )  (83.28%)
         442869514      stalled-cycles-frontend   #    7.45% frontend cycles idle     ( +-  0.41% )  (83.29%)
        1443375663      stalled-cycles-backend    #   24.29% backend cycles idle      ( +-  0.47% )  (33.43%)
        7714006752      instructions              #    1.30  insn per cycle
                                                  #    0.19  stalled cycles per insn  ( +-  0.07% )  (50.17%)
        1977242936      branches                  # 1333472193.855 M/sec              ( +-  0.07% )  (66.79%)
          32624220      branch-misses             #    1.65% of all branches          ( +-  0.18% )  (83.34%)

           1.48438 +- 0.00143 seconds time elapsed  ( +-  0.10% )
```
```
$ perf stat -r 9 ./bin/llvm-exegesis -mode=analysis -analysis-epsilon=1.0 -benchmarks-file=/tmp/benchmarks-inverse_throughput-onefull.yaml -analysis-clusters-output-file="" -analysis-inconsistencies-output-file=/tmp/clusters-newer.html
no exegesis target for x86_64-unknown-linux-gnu, using default
Parsed 14656 benchmark points
Printing sched class consistency analysis results to file '/tmp/clusters-newer.html'
...
no exegesis target for x86_64-unknown-linux-gnu, using default
Parsed 14656 benchmark points
Printing sched class consistency analysis results to file '/tmp/clusters-newer.html'

 Performance counter stats for './bin/llvm-exegesis -mode=analysis -analysis-epsilon=1.0 -benchmarks-file=/tmp/benchmarks-inverse_throughput-onefull.yaml -analysis-clusters-output-file= -analysis-inconsistencies-output-file=/tmp/clusters-newer.html' (9 runs):

            963.28 msec task-clock                #    0.999 CPUs utilized            ( +-  0.37% )
                12      context-switches          #   12.695 M/sec                    ( +- 52.79% )
                 0      cpu-migrations            #    0.000 K/sec
             11599      page-faults               # 12046.971 M/sec                   ( +-  0.59% )
        3860122322      cycles                    # 4009359.596 GHz                   ( +-  0.37% )  (83.19%)
         380300669      stalled-cycles-frontend   #    9.85% frontend cycles idle     ( +-  0.34% )  (83.30%)
        1071910340      stalled-cycles-backend    #   27.77% backend cycles idle      ( +-  1.30% )  (33.51%)
        4773418224      instructions              #    1.24  insn per cycle
                                                  #    0.22  stalled cycles per insn  ( +-  0.15% )  (50.17%)
        1106990316      branches                  # 1149787979.919 M/sec              ( +-  0.11% )  (66.80%)
          23632231      branch-misses             #    2.13% of all branches          ( +-  0.18% )  (83.33%)

           0.96389 +- 0.00356 seconds time elapsed  ( +-  0.37% )
```
```
$ sha512sum /tmp/clusters-*
db4bbd904fe8840853b589b032c5041bc060b91bcd9c27b914b56581fbc473550eea74b852238c79963b5adf2419f379e9f5db76784048b48e3937f9f3e732bf  /tmp/clusters-bew.html
db4bbd904fe8840853b589b032c5041bc060b91bcd9c27b914b56581fbc473550eea74b852238c79963b5adf2419f379e9f5db76784048b48e3937f9f3e732bf  /tmp/clusters-newer.html
db4bbd904fe8840853b589b032c5041bc060b91bcd9c27b914b56581fbc473550eea74b852238c79963b5adf2419f379e9f5db76784048b48e3937f9f3e732bf  /tmp/clusters-old.html
```

Reviewers: courbet, gchatelet

Reviewed By: courbet

Subscribers: tschuett, llvm-commits

Tags: #llvm

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

llvm-svn: 353025

5 years ago[llvm-exegesis] Cut run time of analysis mode by -84% (*sic*) (YamlContext::getInstrO...
Roman Lebedev [Mon, 4 Feb 2019 09:12:21 +0000 (09:12 +0000)]
[llvm-exegesis] Cut run time of analysis mode by -84% (*sic*) (YamlContext::getInstrOpcode())

Summary:
```
$ perf stat -r 9 ./bin/llvm-exegesis -mode=analysis -analysis-epsilon=1.0 -benchmarks-file=/tmp/benchmarks-inverse_throughput-onefull.yaml -analysis-clusters-output-file="" -analysis-inconsistencies-output-file=/tmp/clusters-old.html
no exegesis target for x86_64-unknown-linux-gnu, using default
Parsed 14656 benchmark points
Printing sched class consistency analysis results to file '/tmp/clusters-old.html'
...
no exegesis target for x86_64-unknown-linux-gnu, using default
Parsed 14656 benchmark points
Printing sched class consistency analysis results to file '/tmp/clusters-old.html'

 Performance counter stats for './bin/llvm-exegesis -mode=analysis -analysis-epsilon=1.0 -benchmarks-file=/tmp/benchmarks-inverse_throughput-onefull.yaml -analysis-clusters-output-file= -analysis-inconsistencies-output-file=/tmp/clusters-old.html' (9 runs):

           9465.46 msec task-clock                #    1.000 CPUs utilized            ( +-  0.05% )
                60      context-switches          #    6.363 M/sec                    ( +- 79.45% )
                 0      cpu-migrations            #    0.000 K/sec
             11364      page-faults               # 1200.697 M/sec                    ( +-  0.60% )
       37935623543      cycles                    # 4008083.912 GHz                   ( +-  0.05% )  (83.32%)
        2371625356      stalled-cycles-frontend   #    6.25% frontend cycles idle     ( +-  0.37% )  (83.32%)
        8476077875      stalled-cycles-backend    #   22.34% backend cycles idle      ( +-  0.18% )  (33.36%)
       41822439158      instructions              #    1.10  insn per cycle
                                                  #    0.20  stalled cycles per insn  ( +-  0.02% )  (50.03%)
       11607658944      branches                  # 1226405861.486 M/sec              ( +-  0.01% )  (66.69%)
         210864633      branch-misses             #    1.82% of all branches          ( +-  0.06% )  (83.34%)

           9.46636 +- 0.00441 seconds time elapsed  ( +-  0.05% )
```
```
$ perf stat -r 9 ./bin/llvm-exegesis -mode=analysis -analysis-epsilon=1.0 -benchmarks-file=/tmp/benchmarks-inverse_throughput-onefull.yaml -analysis-clusters-output-file="" -analysis-inconsistencies-output-file=/tmp/clusters-bew.html
no exegesis target for x86_64-unknown-linux-gnu, using default
Parsed 14656 benchmark points
Printing sched class consistency analysis results to file '/tmp/clusters-bew.html'
...
no exegesis target for x86_64-unknown-linux-gnu, using default
Parsed 14656 benchmark points
Printing sched class consistency analysis results to file '/tmp/clusters-bew.html'

 Performance counter stats for './bin/llvm-exegesis -mode=analysis -analysis-epsilon=1.0 -benchmarks-file=/tmp/benchmarks-inverse_throughput-onefull.yaml -analysis-clusters-output-file= -analysis-inconsistencies-output-file=/tmp/clusters-bew.html' (9 runs):

           1480.66 msec task-clock                #    1.000 CPUs utilized            ( +-  0.19% )
                13      context-switches          #    8.483 M/sec                    ( +- 83.10% )
                 0      cpu-migrations            #    0.075 M/sec                    ( +-100.00% )
             11596      page-faults               # 7834.247 M/sec                    ( +-  0.59% )
        5933732194      cycles                    # 4008977.535 GHz                   ( +-  0.19% )  (83.22%)
         438111928      stalled-cycles-frontend   #    7.38% frontend cycles idle     ( +-  0.37% )  (83.25%)
        1454969705      stalled-cycles-backend    #   24.52% backend cycles idle      ( +-  0.94% )  (33.53%)
        7724218604      instructions              #    1.30  insn per cycle
                                                  #    0.19  stalled cycles per insn  ( +-  0.07% )  (50.14%)
        1979796413      branches                  # 1337599858.945 M/sec              ( +-  0.06% )  (66.74%)
          32641638      branch-misses             #    1.65% of all branches          ( +-  0.18% )  (83.31%)

           1.48128 +- 0.00284 seconds time elapsed  ( +-  0.19% )

$ sha512sum /tmp/clusters-*
db4bbd904fe8840853b589b032c5041bc060b91bcd9c27b914b56581fbc473550eea74b852238c79963b5adf2419f379e9f5db76784048b48e3937f9f3e732bf  /tmp/clusters-bew.html
db4bbd904fe8840853b589b032c5041bc060b91bcd9c27b914b56581fbc473550eea74b852238c79963b5adf2419f379e9f5db76784048b48e3937f9f3e732bf  /tmp/clusters-old.html
```

Reviewers: courbet, gchatelet

Reviewed By: courbet

Subscribers: tschuett, llvm-commits, RKSimon

Tags: #llvm

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

llvm-svn: 353024

5 years ago[llvm-exegesis] Throughput support in analysis mode
Roman Lebedev [Mon, 4 Feb 2019 09:12:17 +0000 (09:12 +0000)]
[llvm-exegesis] Throughput support in analysis mode

Summary:
D57000 / [[ https://bugs.llvm.org/show_bug.cgi?id=37698 | PR37698 ]] added support for measuring of the inverse throughput.
But the support for the analysis was not added.
This attempts to fix that. (analysis done o bdver2 / piledriver)

First, small-scale experiment:
```
$ ./bin/llvm-exegesis -num-repetitions=10000 -mode=inverse_throughput -opcode-name=BSF64rr
Check generated assembly with: /usr/bin/objdump -d /tmp/snippet-d0acdd.o
---
mode:            inverse_throughput
key:
  instructions:
    - 'BSF64rr RAX RDX'
  config:          ''
  register_initial_values:
    - 'RDX=0x0'
cpu_name:        bdver2
llvm_triple:     x86_64-unknown-linux-gnu
num_repetitions: 10000
measurements:
  - { key: inverse_throughput, value: 3.0278, per_snippet_value: 3.0278 }
error:           ''
info:            instruction has no tied variables picking Uses different from defs
assembled_snippet: 48BA0000000000000000480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2480FBCC2C3
...
```
If we plug `bsfq %r12, %r10` into llvm-mca:
https://godbolt.org/z/ZtOyhJ
```
Dispatch Width:    4
uOps Per Cycle:    3.00
IPC:               0.50
Block RThroughput: 2.0
```
So RThroughput mismatch exists.

Now, let's upscale and analyse:
{F8207148}
`$ ./bin/llvm-exegesis -mode=analysis -analysis-epsilon=1.0 -benchmarks-file=/tmp/benchmarks-inverse_throughput.yaml -analysis-inconsistencies-output-file=/tmp/clusters.html`:
{F8207172}
{F8207197}
And if we now look at https://www.agner.org/optimize/instruction_tables.pdf,
`Reciprocal throughput` for `BSF r,r` is listed as `3`.
Yay?

Reviewers: courbet, gchatelet

Reviewed By: courbet

Subscribers: tschuett, RKSimon, llvm-commits

Tags: #llvm

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

llvm-svn: 353023

5 years ago[llvm-exegesis] deserializeMCInst(): bump SmallVector small size up to 16
Roman Lebedev [Mon, 4 Feb 2019 09:12:13 +0000 (09:12 +0000)]
[llvm-exegesis] deserializeMCInst(): bump SmallVector small size up to 16

Summary:
... from 8.
`VALIGNDZ128rmbik XMM0 XMM0 K1 XMM3 RDI i_0x1  i_0x0  i_0x1` instruction already has 9 components.
It does not matter much in terms of performance, but avoiding allocation seems to come with low cost here..

Reviewers: courbet, gchatelet

Reviewed By: courbet

Subscribers: tschuett, llvm-commits

Tags: #llvm

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

llvm-svn: 353022

5 years ago[llvm-exegesis] Don't default to running&dumping all analyses to '-'
Roman Lebedev [Mon, 4 Feb 2019 09:12:08 +0000 (09:12 +0000)]
[llvm-exegesis] Don't default to running&dumping all analyses to '-'

Summary:
Up until the point i have looked in the source, i didn't even understood that
i can disable 'cluster' output. I have always silenced it via ` &> /dev/null`.
(And hoped it wasn't contributing much of the run time.)

While i expect that it has it's use-cases i never once needed it so far.
If i forget to silence it, console is completely flooded with that output.

How about not expecting users to opt-out of analyses,
but to explicitly specify the analyses that should be performed?

Reviewers: courbet, gchatelet

Reviewed By: courbet

Subscribers: tschuett, RKSimon, llvm-commits

Tags: #llvm

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

llvm-svn: 353021

5 years ago[OpenMP] Adding support to the mutexinoutset dep-type
Sergi Mateo Bellido [Mon, 4 Feb 2019 07:33:19 +0000 (07:33 +0000)]
[OpenMP] Adding support to the mutexinoutset dep-type

Summary: this commit adds support to a new dependence type introduced in OpenMP
5.0. The LLVM OpenMP RTL already supports this feature, so we  only need to
modify CLANG to take advantage of them.

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

llvm-svn: 353018

5 years ago[SCEV] Do not bother creating separate SCEVUnknown for unreachable nodes
Max Kazantsev [Mon, 4 Feb 2019 05:04:19 +0000 (05:04 +0000)]
[SCEV] Do not bother creating separate SCEVUnknown for unreachable nodes

Currently, SCEV creates SCEVUnknown for every node of unreachable code. If we
have a huge amounts of such code, we will be littering SE with these nodes. We could
just state that they all are undef and save some memory.

Differential Revision: https://reviews.llvm.org/D57567
Reviewed By: sanjoy

llvm-svn: 353017

5 years agoRecommit r352660 "[X86] Mark EMMS and FEMMS as clobbering MM0-7 and ST0-7."
Craig Topper [Mon, 4 Feb 2019 04:44:20 +0000 (04:44 +0000)]
Recommit r352660 "[X86] Mark EMMS and FEMMS as clobbering MM0-7 and ST0-7."

We now print ST0 as 'st' when generating the clobber list for MS inline assembly in clang. This matches what the gcc reg name list expects.

Original commit message:

This fixes the test case in PR35982 by preventing MMX instructions that read MM0-7 from being moved below EMMS/FEMMS by the post RA scheduler.

Though as discussed in bugzilla, this is not a complete fix. There is still the possibility of reordering in IR or by the pre-RA scheduler.

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

llvm-svn: 353016

5 years ago[X86] Print %st(0) as %st when its implicit to the instruction. Continue printing...
Craig Topper [Mon, 4 Feb 2019 04:15:10 +0000 (04:15 +0000)]
[X86] Print %st(0) as %st when its implicit to the instruction. Continue printing it as %st(0) when its encoded in the instruction.

This is a step back from the change I made in r352985. This appears to be more consistent with gcc and objdump behavior.

llvm-svn: 353015

5 years ago[X86] Regenerate test to drop 'End function' comments some other other regex updates.
Craig Topper [Mon, 4 Feb 2019 04:15:04 +0000 (04:15 +0000)]
[X86] Regenerate test to drop 'End function' comments some other other regex updates.

llvm-svn: 353014

5 years agoRevert r352985 "[X86] Print %st(0) as %st to match what gcc inline asm uses as the...
Craig Topper [Mon, 4 Feb 2019 04:15:02 +0000 (04:15 +0000)]
Revert r352985 "[X86] Print %st(0) as %st to match what gcc inline asm uses as the clobber name to make MS inline asm work correctly"

Looking into gcc and objdump behavior more this was overly aggressive. If the register is encoded in the instruction we should print %st(0), if its implicit we should print %st.

I'll be making a more directed change in a future patch.

llvm-svn: 353013

5 years agotests: loosen restriction
Saleem Abdulrasool [Mon, 4 Feb 2019 00:09:32 +0000 (00:09 +0000)]
tests: loosen restriction

The MachO tests can run on any target, but require that the x86 backend
is available.  Broaden the coverage of the test.

llvm-svn: 353012

5 years agoCompute the correct symbol size in llvm-nm even without --print-size
Sunil Srivastava [Sun, 3 Feb 2019 22:40:01 +0000 (22:40 +0000)]
Compute the correct symbol size in llvm-nm even without --print-size

In llvm-nm, the symbol size was being computed only with --print-size option,
even though it was being printed in other cases, such as with --format=posix.

This patch simply removes the guard, so that the size is computed
independently of the later decision to print it or not.

Fixes PR39997.

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

llvm-svn: 353011

5 years agoProvide a placement new definition for the SEH version of UnwindCursor
Martin Storsjo [Sun, 3 Feb 2019 22:16:53 +0000 (22:16 +0000)]
Provide a placement new definition for the SEH version of UnwindCursor

This fixes compilation after SVN r352966 in SEH mode.

llvm-svn: 353010

5 years ago[opaque pointer types] Trivial changes towards CallInst requiring
James Y Knight [Sun, 3 Feb 2019 21:53:49 +0000 (21:53 +0000)]
[opaque pointer types] Trivial changes towards CallInst requiring
explicit function types.

llvm-svn: 353009

5 years ago[docs] Recommend assertions when testing.
Davide Italiano [Sun, 3 Feb 2019 20:37:13 +0000 (20:37 +0000)]
[docs] Recommend assertions when testing.

Pointed out by Shoaib Meenai.

llvm-svn: 353008

5 years ago[LoopIdiomRecognize] @llvm.dbg values shouldn't affect the transformation.
Davide Italiano [Sun, 3 Feb 2019 20:33:20 +0000 (20:33 +0000)]
[LoopIdiomRecognize] @llvm.dbg values shouldn't affect the transformation.

Summary: PR40564

Reviewers: aprantl, rnk

Subscribers: llvm-commits, hiraditya

Tags: #llvm

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

llvm-svn: 353007

5 years ago[AST] Update the comments of the various Expr::Ignore* + Related cleanups
Bruno Ricci [Sun, 3 Feb 2019 19:50:56 +0000 (19:50 +0000)]
[AST] Update the comments of the various Expr::Ignore* + Related cleanups

The description of what the various Expr::Ignore* do has drifted from the
actual implementation.

Inspection reveals that IgnoreParenImpCasts() is not equivalent to doing
IgnoreParens() + IgnoreImpCasts() until reaching a fixed point, but
IgnoreParenCasts() is equivalent to doing IgnoreParens() + IgnoreCasts()
until reaching a fixed point. There is also a fair amount of duplication
in the various Expr::Ignore* functions which increase the chance of further
future inconsistencies. In preparation for the next patch which will factor
out the implementation of the various Expr::Ignore*, do the following cleanups:

Remove Stmt::IgnoreImplicit, in favor of Expr::IgnoreImplicit. IgnoreImplicit
is the only function among all of the Expr::Ignore* which is available in Stmt.
There are only a few users of Stmt::IgnoreImplicit. They can just use instead
Expr::IgnoreImplicit like they have to do for the other Ignore*.

Move Expr::IgnoreImpCasts() from Expr.h to Expr.cpp. This made no difference
in the run-time with my usual benchmark (-fsyntax-only on all of Boost).

While we are at it, make IgnoreParenNoopCasts take a const reference to the
ASTContext for const correctness.

Update the comments to match what the Expr::Ignore* are actually doing.
I am not sure that listing exactly what each Expr::Ignore* do is optimal,
but it certainly looks better than the current state which is in my opinion
between misleading and just plain wrong.

The whole patch is NFC (if you count removing Stmt::IgnoreImplicit as NFC).

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

Reviewed By: aaron.ballman

llvm-svn: 353006

5 years ago[NFC] Make vector types legal in UREM test
Simon Pilgrim [Sun, 3 Feb 2019 19:38:15 +0000 (19:38 +0000)]
[NFC] Make vector types legal in UREM test

As discussed in D50222, this changes the vector types in tests required for that revision to ones legal for X86.

Patch by @hermord (Dmytro Shynkevych)

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

llvm-svn: 353004

5 years ago[ASTDump] Add a flag indicating whether a CXXThisExpr is implicit
Bruno Ricci [Sun, 3 Feb 2019 18:20:27 +0000 (18:20 +0000)]
[ASTDump] Add a flag indicating whether a CXXThisExpr is implicit

There is currently no way to distinguish implicit from explicit
CXXThisExpr in the AST dump output.

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

Reviewed By: steveire

llvm-svn: 353003

5 years ago[PowerPC] adjust test for uaddo change in rL353001
Sanjay Patel [Sun, 3 Feb 2019 18:10:16 +0000 (18:10 +0000)]
[PowerPC] adjust test for uaddo change in rL353001

We don't need a mtctr/bctr for this test now; a regular
conditional branch is fine.

llvm-svn: 353002

5 years ago[CGP] adjust target constraints for forming uaddo
Sanjay Patel [Sun, 3 Feb 2019 17:53:09 +0000 (17:53 +0000)]
[CGP] adjust target constraints for forming uaddo

There are 2 changes visible here:
1. There's no reason to limit this transform based on number
   of condition registers. That diff allows PPC to produce
   slightly better (dot-instructions should be generally good)
   code.
   Note: someone that cares about PPC codegen might want to
   look closer at that output because it seems like we could
   still improve this.

2. We (probably?) should not bother trying to form uaddo (or
   other overflow ops) when there's no target support for such
   an op. This goes beyond checking whether the op is expanded
   because both PPC and AArch64 show better codegen for standard
   types regardless of whether the op is legal/custom.

llvm-svn: 353001

5 years ago[libFuzzer][Windows] Reenable passing tests
Jonathan Metzman [Sun, 3 Feb 2019 16:53:32 +0000 (16:53 +0000)]
[libFuzzer][Windows] Reenable passing tests

Summary:
Enable tests that were previously disabled because they didn't work on
Windows.

Reviewers: morehouse

Reviewed By: morehouse

Subscribers: morehouse

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

llvm-svn: 353000

5 years ago[X86][AVX] Support shuffle combining for VBROADCAST with smaller vector sources
Simon Pilgrim [Sun, 3 Feb 2019 16:51:33 +0000 (16:51 +0000)]
[X86][AVX] Support shuffle combining for VBROADCAST with smaller vector sources

getTargetShuffleMask can only do this safely if we're extracting the lowest subvector from a vector of the same result type.

llvm-svn: 352999

5 years ago[PatternMatch] add special-case uaddo matching for increment-by-one (2nd try)
Sanjay Patel [Sun, 3 Feb 2019 16:16:48 +0000 (16:16 +0000)]
[PatternMatch] add special-case uaddo matching for increment-by-one (2nd try)

This is the most important uaddo problem mentioned in PR31754:
https://bugs.llvm.org/show_bug.cgi?id=31754
...but that was overcome in x86 codegen with D57637.

That patch also corrects the inc vs. add regressions seen with the  previous attempt at this.

Still, we want to make this matcher complete, so we can potentially canonicalize the pattern
even if it's an 'add 1' operation.
Pattern matching, however, shouldn't assume that we have canonicalized IR, so we match 4
commuted variants of uaddo.

There's also a test with a crazy type to show that the existing CGP transform based on this
matcher is not limited by target legality checks.

I'm not sure if the Hexagon diff means the test is no longer testing what it intended to
test, but that should be solvable in a follow-up.

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

llvm-svn: 352998

5 years ago[X86][AVX] Support shuffle combining for VPMOVZX with smaller vector sources
Simon Pilgrim [Sun, 3 Feb 2019 16:10:18 +0000 (16:10 +0000)]
[X86][AVX] Support shuffle combining for VPMOVZX with smaller vector sources

llvm-svn: 352997

5 years agoHot fix two test regressions (%T vs %t)
David Zarzycki [Sun, 3 Feb 2019 15:49:11 +0000 (15:49 +0000)]
Hot fix two test regressions (%T vs %t)

Different Unix "errno" values are returned for the following scenarios:

$ echo test > /tmp/existingFile/impossibleDir/impossibleFile
"Not a directory"
$ echo test > /tmp/nonexistentDir/impossibleFile
"No such file or directory"

This fixes the regression introduced by r352971 / D57592.

llvm-svn: 352996

5 years ago[objc-gnustep] Fix encoding of ivar size for _Bool.
David Chisnall [Sun, 3 Feb 2019 15:05:52 +0000 (15:05 +0000)]
[objc-gnustep] Fix encoding of ivar size for _Bool.

llvm-svn: 352995

5 years ago[X86][AVX] More aggressively simplify BROADCAST source operand
Simon Pilgrim [Sun, 3 Feb 2019 14:39:41 +0000 (14:39 +0000)]
[X86][AVX] More aggressively simplify BROADCAST source operand

Aim to use scalar source or lowest 128-bit vector directly.

We're still missing some VZMOVL_LOAD combines.

llvm-svn: 352994

5 years ago[x86] add CGP uaddo test with weird type; NFC
Sanjay Patel [Sun, 3 Feb 2019 14:22:43 +0000 (14:22 +0000)]
[x86] add CGP uaddo test with weird type; NFC

There's probably no reason to try this transform
for an obviously unsupported op.

llvm-svn: 352993

5 years ago[CGP] move test file to prevent bot failures
Sanjay Patel [Sun, 3 Feb 2019 14:19:45 +0000 (14:19 +0000)]
[CGP] move test file to prevent bot failures

The test specifiies the triple, so it needs to be in the
x86 directory in case a bot has been configured without
the x86 target.

llvm-svn: 352992

5 years agoRemove trailing semicolon. NFCI.
Simon Pilgrim [Sun, 3 Feb 2019 14:11:32 +0000 (14:11 +0000)]
Remove trailing semicolon. NFCI.

llvm-svn: 352991

5 years agoRemove trailing semicolon. NFCI.
Simon Pilgrim [Sun, 3 Feb 2019 14:08:30 +0000 (14:08 +0000)]
Remove trailing semicolon. NFCI.

llvm-svn: 352990

5 years ago[AST] Extract ASTNodeTraverser class from ASTDumper
Stephen Kelly [Sun, 3 Feb 2019 14:06:54 +0000 (14:06 +0000)]
[AST] Extract ASTNodeTraverser class from ASTDumper

Summary:
This new traverser class allows clients to re-use the traversal logic
which was previously part of ASTDumper.  This means that alternative
visit logic may be implemented, such as

* Dump to alternative data formats such as JSON
* Implement AST Matcher parent/child visitation matching AST dumps

Reviewers: aaron.ballman

Subscribers: jfb, cfe-commits

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

llvm-svn: 352989

5 years ago[CGP] refactor optimizeCmpExpression (NFCI)
Sanjay Patel [Sun, 3 Feb 2019 13:48:03 +0000 (13:48 +0000)]
[CGP] refactor optimizeCmpExpression (NFCI)

This is not truly NFC because we are bailing out without
a TLI now. That should not be a real concern though because
there should be a TLI in any real-world scenario.

That seems better than passing around a pointer and then
checking it for null-ness all over the place.

The motivation is to fix what appears to be an unintended
restriction on the uaddo transform -
hasMultipleConditionRegisters() shouldn't be reason to limit
the transform.

llvm-svn: 352988

5 years ago[PowerPC] add tests for saturating add; NFC
Sanjay Patel [Sun, 3 Feb 2019 12:42:54 +0000 (12:42 +0000)]
[PowerPC] add tests for saturating add; NFC

This is copied from the existing test files for x86/AArch.

llvm-svn: 352987

5 years ago[DA][NewPM] Handle transitive dependencies in the new-pm version of DA
Philip Pfaffe [Sun, 3 Feb 2019 12:25:41 +0000 (12:25 +0000)]
[DA][NewPM] Handle transitive dependencies in the new-pm version of DA

Summary:
The analysis result of DA caches pointers to AA, SCEV, and LI, but it
never checks for their invalidation. Fix that.

Reviewers: chandlerc, dmgreen, bogner

Reviewed By: dmgreen

Subscribers: hiraditya, bollu, javed.absar, llvm-commits

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

llvm-svn: 352986

5 years ago[X86] Print %st(0) as %st to match what gcc inline asm uses as the clobber name to...
Craig Topper [Sun, 3 Feb 2019 07:53:39 +0000 (07:53 +0000)]
[X86] Print %st(0) as %st to match what gcc inline asm uses as the clobber name to make MS inline asm work correctly

Summary:
When calculating clobbers for MS style inline assembly we fail if the asm clobbers stack top because we print st(0) and try to pass it through the gcc register name check. This was found with when I attempted to make a emms/femms clobber all ST registers. If you use emms/femms in MS inline asm we would try to use st(0) as the clobber name but clang would think that wasn't a valid clobber name.

This also matches what objdump disassembly prints. It's also what is printed by gcc -S.

Reviewers: RKSimon, rnk, efriedma, spatel, andreadb, lebedev.ri

Reviewed By: rnk

Subscribers: eraman, gbedwell, lebedev.ri, llvm-commits

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

llvm-svn: 352985

5 years ago[X86] Lower ISD::UADDO to use the Z flag instead of C flag when the RHS is a constant...
Craig Topper [Sun, 3 Feb 2019 07:25:06 +0000 (07:25 +0000)]
[X86] Lower ISD::UADDO to use the Z flag instead of C flag when the RHS is a constant 1 to encourage INC formation.

Summary:
Add an additional combine to combineCarryThroughADD to reverse it back to the C flag to avoid regressions.

I believe this catches the cases that D57547 got.

Reviewers: RKSimon, spatel

Reviewed By: spatel

Subscribers: javed.absar, llvm-commits

Tags: #llvm

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

llvm-svn: 352984

5 years agoCorrect test my *really really* overaligning a type.
Eric Fiselier [Sun, 3 Feb 2019 04:10:38 +0000 (04:10 +0000)]
Correct test my *really really* overaligning a type.

llvm-svn: 352983

5 years ago[AMDGPU] Fix -Wunused-variable after rL352978
Fangrui Song [Sun, 3 Feb 2019 03:51:52 +0000 (03:51 +0000)]
[AMDGPU] Fix -Wunused-variable after rL352978

llvm-svn: 352982