platform/upstream/llvm.git
5 years ago[AMDGPU] gfx1010 memory legalizer
Stanislav Mekhanoshin [Mon, 6 May 2019 21:57:02 +0000 (21:57 +0000)]
[AMDGPU] gfx1010 memory legalizer

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

llvm-svn: 360087

5 years agoRevert "Re-commit r357452: SimplifyCFG SinkCommonCodeFromPredecessors: Also sink...
Jordan Rupprecht [Mon, 6 May 2019 21:55:05 +0000 (21:55 +0000)]
Revert "Re-commit r357452: SimplifyCFG SinkCommonCodeFromPredecessors: Also sink function calls without used results (PR41259)"

This reverts r357452 (git commit 21eb771dcb5c11d7500fa6ad551c97a921997f05).

This was causing strange optimization-related test failures on an internal test. Will followup with more details offline.

llvm-svn: 360086

5 years ago[X86] Remove the suffix on vcvt[u]si2ss/sd register variants in assembly printing.
Craig Topper [Mon, 6 May 2019 21:39:51 +0000 (21:39 +0000)]
[X86] Remove the suffix on vcvt[u]si2ss/sd register variants in assembly printing.

We require d/q suffixes on the memory form of these instructions to disambiguate the memory size.
We don't require it on the register forms, but need to support parsing both with and without it.

Previously we always printed the d/q suffix on the register forms, but it's redundant and
inconsistent with gcc and objdump.

After this patch we should support the d/q for parsing, but not print it when its unneeded.

llvm-svn: 360085

5 years agoPR41183: Don't emit strict-prototypes warning for an implicit function
James Y Knight [Mon, 6 May 2019 21:37:59 +0000 (21:37 +0000)]
PR41183: Don't emit strict-prototypes warning for an implicit function
declaration.

It should emit _only_ an implicit-function-declaration warning, not
both of them.

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

llvm-svn: 360084

5 years ago[Docs] Add remote.html redirect
Jonas Devlieghere [Mon, 6 May 2019 21:28:01 +0000 (21:28 +0000)]
[Docs] Add remote.html redirect

Add a redirect for the old remote.html page and sort the pages to make
dding redirects easier in the future.

llvm-svn: 360083

5 years ago[AArch64] Add __builtin_sponentry, for calling setjmp in MinGW
Martin Storsjo [Mon, 6 May 2019 21:19:07 +0000 (21:19 +0000)]
[AArch64] Add __builtin_sponentry, for calling setjmp in MinGW

In MinGW, setjmp isn't expanded as a builtin in the compiler (like it
is for MSVC), but manually hooked up as calls to the right underlying
functions in headers. Using the actual CRT's real setjmp/longjmp
functions requires this intrinsic. (Currently this is worked around by
using MinGW specific reimplementations of setjmp/longjmp on aarch64.)

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

llvm-svn: 360082

5 years ago[MinGW] Use SEH by default on AArch64
Martin Storsjo [Mon, 6 May 2019 21:19:01 +0000 (21:19 +0000)]
[MinGW] Use SEH by default on AArch64

The implementation of SEH is pretty mature at this point.

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

llvm-svn: 360081

5 years ago[AArch64] Default to SEH exception handling on MinGW
Martin Storsjo [Mon, 6 May 2019 21:18:15 +0000 (21:18 +0000)]
[AArch64] Default to SEH exception handling on MinGW

The SEH implementation is pretty mature at this point.

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

llvm-svn: 360080

5 years ago[CMake] Remove lldbPluginSymbolVendorMacOSX to fix CMake build
Jonas Devlieghere [Mon, 6 May 2019 21:17:50 +0000 (21:17 +0000)]
[CMake] Remove lldbPluginSymbolVendorMacOSX to fix CMake build

This should fix check-lldb-unit on the bots.

llvm-svn: 360079

5 years ago[CMake] Remove inlined-functions.yaml
Jonas Devlieghere [Mon, 6 May 2019 21:02:03 +0000 (21:02 +0000)]
[CMake] Remove inlined-functions.yaml

llvm-svn: 360078

5 years ago[Driver] Change the way we deal with local lldbinit files.
Jonas Devlieghere [Mon, 6 May 2019 20:45:31 +0000 (20:45 +0000)]
[Driver] Change the way we deal with local lldbinit files.

Currently we have special handling for local lldbinit files in the
driver. At the same time, we have an SB API named
`SourceInitFileInCurrentWorkingDirectory` that does the same thing.

This patch removes the special handling from the driver and uses the API
instead. In addition to the obvious advantages of having one canonical
way of doing things and removing code duplication, this change also
means that the code path is the same for global and local lldb init
files.

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

llvm-svn: 360077

5 years agoFix the cmake build by removing non-existant source file
Reid Kleckner [Mon, 6 May 2019 20:36:58 +0000 (20:36 +0000)]
Fix the cmake build by removing non-existant source file

llvm-svn: 360076

5 years ago[InstCombine] sink FP negation of operands through select
Sanjay Patel [Mon, 6 May 2019 20:34:05 +0000 (20:34 +0000)]
[InstCombine] sink FP negation of operands through select

We don't always get this:

Cond ? -X : -Y --> -(Cond ? X : Y)

...even with the legacy IR form of fneg in the case with extra uses,
and we miss matching with the newer 'fneg' instruction because we
are expecting binops through the rest of the path.

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

llvm-svn: 360075

5 years agogn build: Merge r360063.
Peter Collingbourne [Mon, 6 May 2019 20:09:12 +0000 (20:09 +0000)]
gn build: Merge r360063.

llvm-svn: 360074

5 years ago[OPENMP]Fix PR41767: diagnose DSA for variables in clauses with
Alexey Bataev [Mon, 6 May 2019 20:07:20 +0000 (20:07 +0000)]
[OPENMP]Fix PR41767: diagnose DSA for variables in clauses with
default(none).

If the combined directive has default(none) clause and has clauses for
inner directive that reference some variables, for which data-sharing
attributes are not specified, the error messages should be emitted for
such variables.

llvm-svn: 360073

5 years agoRevert xcode scheme changes that I didn't mean to check in.
Greg Clayton [Mon, 6 May 2019 20:03:30 +0000 (20:03 +0000)]
Revert xcode scheme changes that I didn't mean to check in.

llvm-svn: 360072

5 years agoInclude inlined functions when figuring out a contiguous address range
Greg Clayton [Mon, 6 May 2019 20:01:21 +0000 (20:01 +0000)]
Include inlined functions when figuring out a contiguous address range

Checking this in for Antonio Afonso:

This diff changes the function LineEntry::GetSameLineContiguousAddressRange so that it also includes function calls that were inlined at the same line of code.

My motivation is to decrease the step over time of lines that heavly rely on inlined functions. I have multiple examples in the code base I work that makes a step over stop 20 or mote times internally. This can easly had up to step overs that take >500ms which I was able to lower to 25ms with this new strategy.

The reason the current code is not extending the address range beyond an inlined function is because when we resolve the symbol at the next address of the line entry we will get the entry line corresponding to where the original code for the inline function lives, making us barely extend the range. This then will end up on a step over having to stop multiple times everytime there's an inlined function.

To check if the range is an inlined function at that line I also get the block associated with the next address and check if there is a parent block with a call site at the line we're trying to extend.

To check this I created a new function in Block called GetContainingInlinedBlockWithCallSite that does exactly that. I also added a new function to Declaration for convinence of checking file/line named CompareFileAndLine.

To avoid potential issues when extending an address range I added an Extend function that extends the range by the AddressRange given as an argument. This function returns true to indicate sucess when the rage was agumented, false otherwise (e.g.: the ranges are not connected). The reason I do is to make sure that we're not just blindly extending complete_line_range by whatever GetByteSize() we got. If for some reason the ranges are not connected or overlap, or even 0, this could be an issue.

I also added a unit tests for this change and include the instructions on the test itself on how to generate the yaml file I use for testing.

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

llvm-svn: 360071

5 years agoPull out repeated CI->getCalledFunction() calls. NFCI.
Simon Pilgrim [Mon, 6 May 2019 19:51:54 +0000 (19:51 +0000)]
Pull out repeated CI->getCalledFunction() calls. NFCI.

llvm-svn: 360070

5 years ago[SelectionDAG][X86] Support inline assembly returning an mmx register into a type...
Craig Topper [Mon, 6 May 2019 19:50:14 +0000 (19:50 +0000)]
[SelectionDAG][X86] Support inline assembly returning an mmx register into a type with fewer than 64 bits.

It's possible to use the 'y' mmx constraint with a type narrower than 64-bits.

This patch supports this by bitcasting the mmx type to 64-bits and then
truncating to the desired type.

There are probably other missing type combinations we need to support, but this
is the case we have a bug report for.

Fixes PR41748.

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

llvm-svn: 360069

5 years ago[GlobalISel] Handle <1 x T> vector return types properly.
Amara Emerson [Mon, 6 May 2019 19:41:01 +0000 (19:41 +0000)]
[GlobalISel] Handle <1 x T> vector return types properly.

After support for dealing with types that need to be extended in some way was
added in r358032 we didn't correctly handle <1 x T> return types. These types
don't have a GISel direct representation, instead we just see them as scalars.
When we need to pad them into <2 x T> types however we need to use a
G_BUILD_VECTOR instead of trying to do a G_CONCAT_VECTOR.

This fixes PR41738.

llvm-svn: 360068

5 years agoInitialization: move InstructionEmulation to full initialization
Saleem Abdulrasool [Mon, 6 May 2019 19:38:24 +0000 (19:38 +0000)]
Initialization: move InstructionEmulation to full initialization

The debug server does not need to use the instruction emulation. This
helps reduce the size of the final lldb-server binary by another ~100K
(~1% savings).

llvm-svn: 360067

5 years agoRevert r359392 and r358887
Craig Topper [Mon, 6 May 2019 19:29:24 +0000 (19:29 +0000)]
Revert r359392 and r358887

Reverts "[X86] Remove (V)MOV64toSDrr/m and (V)MOVDI2SSrr/m. Use 128-bit result MOVD/MOVQ and COPY_TO_REGCLASS instead"
Reverts "[TargetLowering][AMDGPU][X86] Improve SimplifyDemandedBits bitcast handling"

Eric Christopher and Jorge Gorbe Moya reported some issues with these patches to me off list.

Removing the CodeGenOnly instructions has changed how fneg is handled during fast-isel with sse/sse2. We're now emitting fsub -0.0, x instead
moving to the integer domain(in a GPR), xoring the sign bit, and then moving back to xmm. This is because the fast isel table no longer
contains an entry for (f32/f64 bitcast (i32/i64)) so the target independent fneg code fails. The use of fsub changes the behavior of nan with
respect to -O2 codegen which will always use a pxor. NOTE: We still have a difference with double with -m32 since the move to GPR doesn't work
there. I'll file a separate PR for that and add test cases.

Since removing the CodeGenOnly instructions was fixing PR41619, I'm reverting r358887 which exposed that PR. Though I wouldn't be surprised
if that bug can still be hit independent of that.

This should hopefully get Google back to green. I'll work with Simon and other X86 folks to figure out how to move forward again.

llvm-svn: 360066

5 years agoFix more Windows bots after r360015.
Paul Robinson [Mon, 6 May 2019 19:12:25 +0000 (19:12 +0000)]
Fix more Windows bots after r360015.
Depending on the environment, the directory separator might
appear as \ or \\ on different bots.

http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/17446/steps/test-check-all/logs/stdio

llvm-svn: 360065

5 years agoRemove duplicate assignments. NFCI.
Simon Pilgrim [Mon, 6 May 2019 19:10:55 +0000 (19:10 +0000)]
Remove duplicate assignments. NFCI.

llvm-svn: 360064

5 years ago[OpenMP][Clang] Support for target math functions
Gheorghe-Teodor Bercea [Mon, 6 May 2019 18:19:15 +0000 (18:19 +0000)]
[OpenMP][Clang] Support for target math functions

Summary:
In this patch we propose a temporary solution to resolving math functions for the NVPTX toolchain, temporary until OpenMP variant is supported by Clang.

We intercept the inclusion of math.h and cmath headers and if we are in the OpenMP-NVPTX case, we re-use CUDA's math function resolution mechanism.

Authors:
@gtbercea
@jdoerfert

Reviewers: hfinkel, caomhin, ABataev, tra

Reviewed By: hfinkel, ABataev, tra

Subscribers: mgorny, guansong, cfe-commits, jdoerfert

Tags: #clang

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

llvm-svn: 360063

5 years agoAdd non-SSE wrapper for __kmp_{load,store}_mxcsr
Dimitry Andric [Mon, 6 May 2019 17:58:03 +0000 (17:58 +0000)]
Add non-SSE wrapper for __kmp_{load,store}_mxcsr

Summary:
To be able to successfully build OpenMP on FreeBSD/i386, which still
uses i486 as its default processor, I had to provide wrappers for the
`__kmp_load_mxcsr` and `__kmp_store_mxcsr` functions.

If the compiler signals that SSE is not available, loading and storing
mxcsr does not make sense anway, so in that case the inline functions
are empty.  This gives the minimum amount of code churn.

See also https://svnweb.freebsd.org/changeset/base/345283

Reviewers: emaste, jlpeyton, Hahnfeld

Reviewed By: jlpeyton

Subscribers: hfinkel, krytarowski, jdoerfert, openmp-commits, llvm-commits

Tags: #openmp

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

llvm-svn: 360062

5 years ago[OPENMP]Fix PR41768: check DSA for globals with `default(none)` clauses.
Alexey Bataev [Mon, 6 May 2019 17:49:22 +0000 (17:49 +0000)]
[OPENMP]Fix PR41768: check DSA for globals with `default(none)` clauses.

If the `default(none)` was specified for the construct, we might miss
diagnostic for the globals without explicitly specified data-sharing
attributes. Patch fixes this problem.

llvm-svn: 360061

5 years agoAdd libc++ to link XRay test cases if libc++ is used to build CLANG
Xing Xue [Mon, 6 May 2019 17:45:21 +0000 (17:45 +0000)]
Add libc++ to link XRay test cases if libc++ is used to build CLANG

Summary: When libc++ is used to build CLANG, its XRay libraries libclang_rt.xray-*.a have dependencies on libc++. Therefore, libc++ is needed to link and run XRay test cases. For Linux -rpath is also needed to specify where to load libc++. This change sets macro LLVM_LIBCXX_USED to 1 if libc++ is actually used in the build. XRay tests then check the flag and add -L<llvm_shlib_dir> -lc++ and -Wl,-rpath=<llvm_shlib_dir> if needed.

Reviewers: hubert.reinterpretcast, amyk, dberris, jasonliu, sfertile, EricWF

Subscribers: dberris, mgorny, jsji, llvm-commits

Tags: #llvm

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

llvm-svn: 360060

5 years ago[InstCombine] reduce code duplication; NFC
Sanjay Patel [Mon, 6 May 2019 17:39:18 +0000 (17:39 +0000)]
[InstCombine] reduce code duplication; NFC

llvm-svn: 360059

5 years ago[InstCombine] add tests for fneg+sel; NFC
Sanjay Patel [Mon, 6 May 2019 17:29:22 +0000 (17:29 +0000)]
[InstCombine] add tests for fneg+sel; NFC

llvm-svn: 360058

5 years agogn build: More TODO tweaking
Nico Weber [Mon, 6 May 2019 17:17:41 +0000 (17:17 +0000)]
gn build: More TODO tweaking

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

llvm-svn: 360057

5 years agogn build: Update TODO now that libcxx libcxxabi libunwind clang-tools-extra are done
Nico Weber [Mon, 6 May 2019 17:15:19 +0000 (17:15 +0000)]
gn build: Update TODO now that libcxx libcxxabi libunwind clang-tools-extra are done

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

llvm-svn: 360056

5 years ago[ConstantRange] Add srem() support
Nikita Popov [Mon, 6 May 2019 16:59:37 +0000 (16:59 +0000)]
[ConstantRange] Add srem() support

Add support for srem() to ConstantRange so we can use it in LVI. For
srem the sign of the result matches the sign of the LHS. For the RHS
only the absolute value is important. Apart from that the logic is
like urem.

Just like for urem this is only an approximate implementation. The tests
check a few specific cases and run an exhaustive test for conservative
correctness (but not exactness).

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

llvm-svn: 360055

5 years ago[SDAG][AArch64] Boolean and/or reduce to umax/min reduce (PR41635)
Nikita Popov [Mon, 6 May 2019 16:17:17 +0000 (16:17 +0000)]
[SDAG][AArch64] Boolean and/or reduce to umax/min reduce (PR41635)

This addresses one half of https://bugs.llvm.org/show_bug.cgi?id=41635
by combining a VECREDUCE_AND/OR into VECREDUCE_UMIN/UMAX (if latter is
legal but former is not) for zero-or-all-ones boolean reductions (which
are detected based on sign bits).

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

llvm-svn: 360054

5 years agoAdd FNeg support to InstructionSimplify
Cameron McInally [Mon, 6 May 2019 16:05:10 +0000 (16:05 +0000)]
Add FNeg support to InstructionSimplify

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

llvm-svn: 360053

5 years ago[InstCombine] regenerate test checks; NFC
Sanjay Patel [Mon, 6 May 2019 16:03:53 +0000 (16:03 +0000)]
[InstCombine] regenerate test checks; NFC

llvm-svn: 360052

5 years ago[InstCombine] reduce code duplication; NFCI
Sanjay Patel [Mon, 6 May 2019 15:35:02 +0000 (15:35 +0000)]
[InstCombine] reduce code duplication; NFCI

llvm-svn: 360051

5 years agoModernize repmovsb implementation of x86 memcpy and allow runtime sizes.
Guillaume Chatelet [Mon, 6 May 2019 15:10:19 +0000 (15:10 +0000)]
Modernize repmovsb implementation of x86 memcpy and allow runtime sizes.

Summary: This is a prerequisite to RFC http://lists.llvm.org/pipermail/llvm-dev/2019-April/131973.html

Reviewers: courbet

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

Fix typo.

Turn this patch into an NFC.

Addressing comments

llvm-svn: 360050

5 years agogn build: Merge r360018
Nico Weber [Mon, 6 May 2019 15:06:43 +0000 (15:06 +0000)]
gn build: Merge r360018

llvm-svn: 360049

5 years ago[CodeComplete] Update python tests after r360042
Ilya Biryukov [Mon, 6 May 2019 14:56:24 +0000 (14:56 +0000)]
[CodeComplete] Update python tests after r360042

llvm-svn: 360048

5 years ago[X86] Fix uninitialized members in constructor warnings. NFCI.
Simon Pilgrim [Mon, 6 May 2019 14:48:02 +0000 (14:48 +0000)]
[X86] Fix uninitialized members in constructor warnings. NFCI.

Initialize all member variables in X86ATTInstPrinter and X86DAGToDAGISel constructors to fix cppcheck warning.

llvm-svn: 360047

5 years ago[AMDGPU][test] Define local symbols used in amdgpu-relocs.s
Fangrui Song [Mon, 6 May 2019 14:17:59 +0000 (14:17 +0000)]
[AMDGPU][test] Define local symbols used in amdgpu-relocs.s

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

llvm-svn: 360046

5 years agoFix CMake Invalid Escape Sequence
Alexandre Ganea [Mon, 6 May 2019 14:07:01 +0000 (14:07 +0000)]
Fix CMake Invalid Escape Sequence

Patch by xoviat

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

llvm-svn: 360045

5 years agoFix compilation warnings when compiling with GCC 7.3
Alexandre Ganea [Mon, 6 May 2019 13:41:54 +0000 (13:41 +0000)]
Fix compilation warnings when compiling with GCC 7.3

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

llvm-svn: 360044

5 years ago[PowerPC] Fix erroneous condition for converting uint-to-fp vector conversion
Nemanja Ivanovic [Mon, 6 May 2019 13:35:49 +0000 (13:35 +0000)]
[PowerPC] Fix erroneous condition for converting uint-to-fp vector conversion

A condition for exiting the legalization of v4i32 conversion to v2f64 through
extract/convert/build erroneously checks for the extract having type i32.
This is not adequate as smaller extracts are actually legalized to i32 as well.
Furthermore, an early exit is missing which means that we only check that
both extracts are from the same vector if that check fails.
As a result, both cases in the included test case fail - the first gets a
select error and the second generates incorrect code.

The culprit commit is r274535.

llvm-svn: 360043

5 years ago[CodeComplete] Add a trailing semicolons to some pattern completions
Ilya Biryukov [Mon, 6 May 2019 13:18:00 +0000 (13:18 +0000)]
[CodeComplete] Add a trailing semicolons to some pattern completions

Summary:
Where semicolon is required in any case. Here's a list of completions
that now have a semicolon:
  - namespace <name> = <target>;
  - using namespace <name>;
  - using <qualifier>::<name>;
  - continue;
  - break;
  - goto <label>;
  - return;
  - return <expression>;

Reviewers: gribozavr

Reviewed By: gribozavr

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 360042

5 years ago[lldb] [lit] Use more readable consts and arrays in register read tests
Michal Gorny [Mon, 6 May 2019 13:06:43 +0000 (13:06 +0000)]
[lldb] [lit] Use more readable consts and arrays in register read tests

Replace the constants used for r8/mm/xmm/ymm/zmm tests with something
more readable to ease debugging in case of failures (0x00 0x01 ...).
While at it, put the constants in array and copy them from memory
to simplify inline asm.

The original constants grew out of necessity.  The xmm constants were
'weird' because they were intended to be different from mm constants
(as that was necessary to catch NetBSD implementation bug).  The ymm
constants were made even weirded to not even partially collide with
other xmm registers (not saying it made sense, just how it was done).
Then, zmm constants were once again designed to avoid accidental
collisions with xmm and ymm constants, and at the same the 16 extra
registers required even more shuffling.

The new constants are meant to be more user-readable, so that a mistake
could be easily spotted.  All of xmm, ymm and zmm tests use a sequence
of {0x00 0x01 0x02 ...}, shifted by 1 for every register.  This should
provide enough uniquity, and space for future increase in number of
registers.  Since mm and r8..r15 are printed as uint64_t rather than
byte-by-byte, they use 0x000102...  As a result, on x86 endianness takes
care of making mm different than xmm.

The use of arrays is something I had to learn for zmm write tests.  It
avoids having to specify all the input values separately, and makes
GCC happy about zmm-read test (it was rejected previously because of
hitting a limit of 30 constraints).

llvm-svn: 360041

5 years ago[lld] A better version of the fix in r359942.
Alexander Kornienko [Mon, 6 May 2019 12:11:30 +0000 (12:11 +0000)]
[lld] A better version of the fix in r359942.

Thanks to George Rimar for the suggestion.

llvm-svn: 360040

5 years ago[clangd] Expose whether no-compile completion was used.
Sam McCall [Mon, 6 May 2019 12:03:26 +0000 (12:03 +0000)]
[clangd] Expose whether no-compile completion was used.

Summary: Embedding clients want to experiment with showing such results in e.g. a different color.

Reviewers: kadircet

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

Tags: #clang

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

llvm-svn: 360039

5 years agoMerge GetCompileUnitAtOffset + GetCompileUnitContainingDIEOffset
Jan Kratochvil [Mon, 6 May 2019 12:01:38 +0000 (12:01 +0000)]
Merge GetCompileUnitAtOffset + GetCompileUnitContainingDIEOffset

These two methods are very similar and various refactorizations need to modify
both similar ways.

One could also just remove GetCompileUnitAtOffset and make
GetCompileUnitContainingDIEOffset to also accept offset of the CU itself
(currently it accepts only DIE offsets after the CU header).
But that would be less safe regarding some internal sanity checking.

Further code refactorization has been suggested by Pavel Labath.

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

llvm-svn: 360038

5 years agoX86DAGToDAGISel::tryVPTESTM - fix uninitialized variable warning. NFCI.
Simon Pilgrim [Mon, 6 May 2019 11:52:16 +0000 (11:52 +0000)]
X86DAGToDAGISel::tryVPTESTM - fix uninitialized variable warning. NFCI.

findBroadcastedOp should always initialize the value if it returns true but static-analyzer isn't great at recognising this.

llvm-svn: 360037

5 years ago[test] Remove redundant bracket in rL360035
Fangrui Song [Mon, 6 May 2019 11:43:19 +0000 (11:43 +0000)]
[test] Remove redundant bracket in rL360035

llvm-svn: 360036

5 years agoTry fix Windows bot after rL360015
Fangrui Song [Mon, 6 May 2019 11:39:49 +0000 (11:39 +0000)]
Try fix Windows bot after rL360015

llvm-svn: 360035

5 years agoTry fix Windows bot after rL360015
Fangrui Song [Mon, 6 May 2019 11:37:20 +0000 (11:37 +0000)]
Try fix Windows bot after rL360015

http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/25599/steps/test/logs/stdio

llvm-svn: 360034

5 years ago[llvm-c-test] Make include-all.c do what its name says it does
Anders Waldenborg [Mon, 6 May 2019 11:31:45 +0000 (11:31 +0000)]
[llvm-c-test] Make include-all.c do what its name says it does

The purpose of this file is to make sure that all includes in llvm-c
works when included from a C source file (i.e no C++isms sneaked in).
To do this it must actually include all the include files.

Reviewed By: whitequark
Differential Revision: https://reviews.llvm.org/D61567

llvm-svn: 360033

5 years ago[clang-tidy] Extend bugprone-sizeof-expression check to detect sizeof misuse in point...
Adam Balogh [Mon, 6 May 2019 10:41:37 +0000 (10:41 +0000)]
[clang-tidy] Extend bugprone-sizeof-expression check to detect sizeof misuse in pointer arithmetic

Some programmers tend to forget that subtracting two pointers results in the
difference between them in number of elements of the pointee type instead of
bytes. This leads to codes such as `size_t size = (p - q) / sizeof(int)` where
`p` and `q` are of type `int*`. Or similarily, `if (p - q < buffer_size *
sizeof(int)) { ... }`. This patch extends `bugprone-sizeof-expression` to
detect such cases.

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

llvm-svn: 360032

5 years ago[LoadStoreVectorizer] vectorizeStoreChain - ensure we find a store type.
Simon Pilgrim [Mon, 6 May 2019 10:25:11 +0000 (10:25 +0000)]
[LoadStoreVectorizer] vectorizeStoreChain - ensure we find a store type.

Properly initialize store type to null then ensure we find a real store type in the chain.

Fixes scan-build null dereference warning and makes the code clearer.

llvm-svn: 360031

5 years ago[clangd] Boost code completion results that were named in the last few lines.
Sam McCall [Mon, 6 May 2019 10:25:10 +0000 (10:25 +0000)]
[clangd] Boost code completion results that were named in the last few lines.

Summary:
The hope is this will catch a few patterns with repetition:

  SomeClass* S = ^SomeClass::Create()

  int getFrobnicator() { return ^frobnicator_; }

  // discard the factory, it's no longer valid.
  ^MyFactory.reset();

Without triggering antipatterns too often:

  return Point(x.first, x.^second);

I'm going to gather some data on whether this turns out to be a win overall.

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

Tags: #clang

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

llvm-svn: 360030

5 years ago[CodeGen] Move X86 tests under the X86 directory
Fangrui Song [Mon, 6 May 2019 10:21:17 +0000 (10:21 +0000)]
[CodeGen] Move X86 tests under the X86 directory

llvm-svn: 360029

5 years ago[X86] X86InstrInfo::findThreeSrcCommutedOpIndices - fix unread variable warning.
Simon Pilgrim [Mon, 6 May 2019 10:15:34 +0000 (10:15 +0000)]
[X86] X86InstrInfo::findThreeSrcCommutedOpIndices - fix unread variable warning.

scan-build was reporting that CommutableOpIdx1 never used its original initialized value - move it down to where its first used to make the real initialization more obvious (and matches the comment that's there).

llvm-svn: 360028

5 years ago[X86] lowerVectorShuffle - use any_of to detect out of bounds shuffle indices. NFCI.
Simon Pilgrim [Mon, 6 May 2019 10:11:24 +0000 (10:11 +0000)]
[X86] lowerVectorShuffle - use any_of to detect out of bounds shuffle indices. NFCI.

Fixes cppcheck local shadow warning as well.

llvm-svn: 360027

5 years ago[clangd] Qualify uses of ::testing everywhere. NFC
Ilya Biryukov [Mon, 6 May 2019 10:08:47 +0000 (10:08 +0000)]
[clangd] Qualify uses of ::testing everywhere. NFC

Add an initial '::' qualifier to all usages of 'testing' namespace that
did not have one.

The goal is to make our code style in tests more consistent.

llvm-svn: 360026

5 years ago[Analysis] Remove duplicated std::move from LocRange constructor
Simon Pilgrim [Mon, 6 May 2019 10:04:23 +0000 (10:04 +0000)]
[Analysis] Remove duplicated std::move from LocRange constructor

scan-build was reporting that we were referencing a moved variable - in fact we were moving it twice.....

llvm-svn: 360025

5 years agoRevert r359949 "[clang] adding explicit(bool) from c++2a"
Hans Wennborg [Mon, 6 May 2019 09:51:10 +0000 (09:51 +0000)]
Revert r359949 "[clang] adding explicit(bool) from c++2a"

This caused Clang to start erroring on the following:

  struct S {
  Â  template <typename = int> explicit S();
  };

  struct T : S {};

  struct U : T {
  Â  U();
  };
  U::U() {}

  $ clang -c /tmp/x.cc
  /tmp/x.cc:10:4: error: call to implicitly-deleted default constructor of 'T'
  U::U() {}
  Â  Â ^
  /tmp/x.cc:5:12: note: default constructor of 'T' is implicitly deleted
    because base class 'S' has no default constructor
  struct T : S {};
  Â  Â  Â  Â  Â  Â ^
  1 error generated.

See discussion on the cfe-commits email thread.

This also reverts the follow-ups r359966 and r359968.

> this patch adds support for the explicit bool specifier.
>
> Changes:
> - The parsing for the explicit(bool) specifier was added in ParseDecl.cpp.
> - The storage of the explicit specifier was changed. the explicit specifier was stored as a boolean value in the FunctionDeclBitfields and in the DeclSpec class. now it is stored as a PointerIntPair<Expr*, 2> with a flag and a potential expression in CXXConstructorDecl, CXXDeductionGuideDecl, CXXConversionDecl and in the DeclSpec class.
> - Following the AST change, Serialization, ASTMatchers, ASTComparator and ASTPrinter were adapted.
> - Template instantiation was adapted to instantiate the potential expressions of the explicit(bool) specifier When instantiating their associated declaration.
> - The Add*Candidate functions were adapted, they now take a Boolean indicating if the context allowing explicit constructor or conversion function and this boolean is used to remove invalid overloads that required template instantiation to be detected.
> - Test for Semantic and Serialization were added.
>
> This patch is not yet complete. I still need to check that interaction with CTAD and deduction guides is correct. and add more tests for AST operations. But I wanted first feedback.
> Perhaps this patch should be spited in smaller patches, but making each patch testable as a standalone may be tricky.
>
> Patch by Tyker
>
> Differential Revision: https://reviews.llvm.org/D60934

llvm-svn: 360024

5 years ago[NFC] Update memcpy tests
Guillaume Chatelet [Mon, 6 May 2019 09:46:50 +0000 (09:46 +0000)]
[NFC] Update memcpy tests

Summary: Runs utils/update_llc_test_checks.py on a few memcpy files

Reviewers: courbet

Subscribers: llvm-commits

Tags: #llvm

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

Remove cfi noise by adding nounwind

llvm-svn: 360023

5 years ago[X86] Move files to correct directories after D60552
Fangrui Song [Mon, 6 May 2019 09:24:36 +0000 (09:24 +0000)]
[X86] Move files to correct directories after D60552

llvm-svn: 360022

5 years ago[SimplifyLibCalls] Simplify bcmp too.
Clement Courbet [Mon, 6 May 2019 09:15:22 +0000 (09:15 +0000)]
[SimplifyLibCalls] Simplify bcmp too.

Summary: Fixes PR40699.

Reviewers: gchatelet

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 360021

5 years ago[clangd] Always call getFormatStyleForFile().
Sam McCall [Mon, 6 May 2019 08:39:17 +0000 (08:39 +0000)]
[clangd] Always call getFormatStyleForFile().

This means "format" will no longer return an error if the -fallback-style flag
is invalid, it will log and use LLVM style. This doesn't really matter.

Also document the dependence on global variables. (This patch is a
compromise - it's probably not worth actually avoiding the globals).

llvm-svn: 360020

5 years ago[NFC] This is a test for the commit access.
Pengfei Wang [Mon, 6 May 2019 08:31:18 +0000 (08:31 +0000)]
[NFC] This is a test for the commit access.

Summary: Signed-off-by: Pengfei Wang <pengfei.wang@intel.com>

Reviewers: LuoYuanke

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 360019

5 years agoEnable intrinsics of AVX512_BF16, which are supported for BFLOAT16 in Cooper Lake
Luo, Yuanke [Mon, 6 May 2019 08:25:11 +0000 (08:25 +0000)]
Enable intrinsics of AVX512_BF16, which are supported for BFLOAT16 in Cooper Lake

Summary:
1. Enable infrastructure of AVX512_BF16, which is supported for BFLOAT16 in Cooper Lake;
2. Enable intrinsics for VCVTNE2PS2BF16, VCVTNEPS2BF16 and DPBF16PS instructions, which are Vector Neural Network Instructions supporting BFLOAT16 inputs and conversion instructions from IEEE single precision.
For more details about BF16 intrinsic, please refer to the latest ISE document: https://software.intel.com/en-us/download/intel-architecture-instruction-set-extensions-programming-reference

Patch by LiuTianle

Reviewers: craig.topper, smaslov, LuoYuanke, wxiao3, annita.zhang, spatel, RKSimon

Reviewed By: craig.topper

Subscribers: mgorny, cfe-commits

Tags: #clang

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

llvm-svn: 360018

5 years agoEnable AVX512_BF16 instructions, which are supported for BFLOAT16 in Cooper Lake
Luo, Yuanke [Mon, 6 May 2019 08:22:37 +0000 (08:22 +0000)]
Enable AVX512_BF16 instructions, which are supported for BFLOAT16 in Cooper Lake

Summary:
1. Enable infrastructure of AVX512_BF16, which is supported for BFLOAT16 in Cooper Lake;
2. Enable VCVTNE2PS2BF16, VCVTNEPS2BF16 and DPBF16PS  instructions, which are Vector Neural Network Instructions supporting BFLOAT16 inputs and conversion instructions from IEEE single precision.
VCVTNE2PS2BF16: Convert Two Packed Single Data to One Packed BF16 Data.
VCVTNEPS2BF16: Convert Packed Single Data to Packed BF16 Data.
VDPBF16PS: Dot Product of BF16 Pairs Accumulated into Packed Single Precision.
For more details about BF16 isa, please refer to the latest ISE document: https://software.intel.com/en-us/download/intel-architecture-instruction-set-extensions-programming-reference

Author: LiuTianle

Reviewers: craig.topper, smaslov, LuoYuanke, wxiao3, annita.zhang, RKSimon, spatel

Reviewed By: craig.topper

Subscribers: kristina, llvm-commits

Tags: #llvm

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

llvm-svn: 360017

5 years ago[clangd] Support -fallback-style, similar to clang-format.
Sam McCall [Mon, 6 May 2019 08:11:59 +0000 (08:11 +0000)]
[clangd] Support -fallback-style, similar to clang-format.

Reviewers: kadircet

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

Tags: #clang

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

llvm-svn: 360016

5 years agoDWARF v5: fix directory index in the line table
Fangrui Song [Mon, 6 May 2019 08:03:46 +0000 (08:03 +0000)]
DWARF v5: fix directory index in the line table

Summary:
Prior to DWARF v5, a directory index of 0 represents DW_AT_comp_dir.

In DWARF v5, the index starts with 0 and Entry.DirIdx is the index into
Prologue.IncludeDirectories.

Reviewed By: labath

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

llvm-svn: 360015

5 years ago[DWARF] Reimplement/simplify DWARFUnit::GetID
Pavel Labath [Mon, 6 May 2019 07:45:28 +0000 (07:45 +0000)]
[DWARF] Reimplement/simplify DWARFUnit::GetID

Summary:
The implementation of GetID used a relatively complicated algorithm,
which returned some kind of an offset of the unit in some file
(depending on the debug info flavour). The only thing this ID was used
for was to enable subseqent retrieval of the unit from the SymbolFile.

This can be made simpler if we just make the "ID" of the unit an index
into the list of the units belonging to the symbol file. We already
support indexed access to the units, so each unit already has a well
"index" -- this just makes it accessible from within the unit.

To make the distincion between "id" and "offset" clearer (and help catch
any misuses), I also rename DWARFDebugInfo::GetCompileUnit (which
accesses by offset) into DWARFDebugInfo::GetCompileUnitAtOffset.

On its own, this only brings a minor simplification, but it enables
further simplifications in the DIERef class (coming in a follow-up
patch).

Reviewers: JDevlieghere, clayborg, aprantl

Subscribers: arphaman, jdoerfert, lldb-commits, tberghammer, jankratochvil

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

llvm-svn: 360014

5 years ago[DebugInfo] GlobalOpt DW_OP_deref_size instead of DW_OP_deref.
Markus Lavin [Mon, 6 May 2019 07:20:56 +0000 (07:20 +0000)]
[DebugInfo] GlobalOpt DW_OP_deref_size instead of DW_OP_deref.

Optimization pass lib/Transforms/IPO/GlobalOpt.cpp needs to insert
DW_OP_deref_size instead of DW_OP_deref to be compatible with big-endian
targets for same reasons as in D59687.

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

llvm-svn: 360013

5 years ago[llvm-c] Make LLVMGetStringErrorTypeId a proper prototype
Anders Waldenborg [Mon, 6 May 2019 06:42:06 +0000 (06:42 +0000)]
[llvm-c] Make LLVMGetStringErrorTypeId a proper prototype

In C a function declaration with an empty argument list isn't a real
prototype, it will allow calling the function with any number of
arguments. It will also cause warnings when used in C code compiled with
'-Wstrict-prototypes'

Reviewed By: whitequark
Differential Revision: https://reviews.llvm.org/D61568

llvm-svn: 360012

5 years agoP1286R2: Remove restriction that the exception specification of a
Richard Smith [Mon, 6 May 2019 05:04:56 +0000 (05:04 +0000)]
P1286R2: Remove restriction that the exception specification of a
defaulted special member matches the implicit exception specification.

llvm-svn: 360011

5 years agoUse DiagRuntimeBehavior for -Wunsequenced to weed out false positives
Richard Smith [Mon, 6 May 2019 04:14:01 +0000 (04:14 +0000)]
Use DiagRuntimeBehavior for -Wunsequenced to weed out false positives
where either the modification or the other access is unreachable.

This reverts r359984 (which reverted r359962). The bug in clang-tidy's
test suite exposed by the original commit was fixed in r360009.

llvm-svn: 360010

5 years agoFix test to avoid assuming clang will diagnose problems in unreachable code.
Richard Smith [Mon, 6 May 2019 04:07:30 +0000 (04:07 +0000)]
Fix test to avoid assuming clang will diagnose problems in unreachable code.

llvm-svn: 360009

5 years ago[SelectionDAG] Replace llvm_unreachable at the end of getCopyFromParts with a report_...
Craig Topper [Mon, 6 May 2019 04:01:49 +0000 (04:01 +0000)]
[SelectionDAG] Replace llvm_unreachable at the end of getCopyFromParts with a report_fatal_error.

Based on PR41748, not all cases are handled in this function.

llvm_unreachable is treated as an optimization hint than can prune code paths
in a release build. This causes weird behavior when PR41748 is encountered on a
release build. It appears to generate an fp_round instruction from the floating
point code.

Making this a report_fatal_error prevents incorrect optimization of the code
and will instead generate a message to file a bug report.

llvm-svn: 360008

5 years agoFix up after r360006.
Richard Smith [Mon, 6 May 2019 04:00:45 +0000 (04:00 +0000)]
Fix up after r360006.

llvm-svn: 360007

5 years ago[c++20] Implement P1009R2: allow omitting the array bound in an array
Richard Smith [Mon, 6 May 2019 03:47:15 +0000 (03:47 +0000)]
[c++20] Implement P1009R2: allow omitting the array bound in an array
new expression.

This was voted into C++20 as a defect report resolution, so we
retroactively apply it to all prior language modes (though it can never
actually be used before C++11 mode).

llvm-svn: 360006

5 years agoThe 'CodeGenObjC/illegal-UTF8.m' get failed with Clang built with 32-bit targets...
Galina Kistanova [Mon, 6 May 2019 03:30:09 +0000 (03:30 +0000)]
The 'CodeGenObjC/illegal-UTF8.m' get failed with Clang built with 32-bit targets only (as example ARM-only) with the following error:

error: unable to create target: 'No available targets are compatible with triple "< ... any 64-bit target triple ... >"'

I didn't find any 64-bit dependencies for the test and I think removing '-m64' option should fix the problem and allow this test for any target specified by LLVM_DEFAULT_TARGET_TRIPLE.

Patch by Vlad Vereschaka.

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

llvm-svn: 360005

5 years ago[libcxxabi] Don't use -fvisibility-global-new-delete-hidden when not defining them
Petr Hosek [Mon, 6 May 2019 01:25:31 +0000 (01:25 +0000)]
[libcxxabi] Don't use -fvisibility-global-new-delete-hidden when not defining them

When builing the hermetic static library, the compiler switch
-fvisibility-global-new-delete-hidden is necessary to get the new and
delete operator definitions made correctly. However, when those
definitions are not included in the library, then this switch does harm.
With lld (though not all linkers) setting STV_HIDDEN on SHN_UNDEF
symbols makes it an error to leave them undefined or defined via dynamic
linking that should generate PLTs for -shared linking (lld makes this a
hard error even without -z defs). Though leaving the symbols undefined
would usually work in practice if the linker were to allow it (and the
user didn't pass -z defs), this actually indicates a real problem that
could bite some target configurations more subtly at runtime. For
example, x86-32 ELF -fpic code generation uses hidden visibility on
declarations in the caller's scope as a signal that the call will never
be resolved to a PLT entry and so doesn't have to meet the special ABI
requirements for PLT calls (setting %ebx). Since these functions might
actually be resolved to PLT entries at link time (we don't know what the
user is linking in when the hermetic library doesn't provide all the
symbols itself), it's not safe for the compiler to treat their
declarations at call sites as having hidden visibility.

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

llvm-svn: 360004

5 years ago[libcxx] Don't use -fvisibility-global-new-delete-hidden when not defining them
Petr Hosek [Mon, 6 May 2019 01:22:28 +0000 (01:22 +0000)]
[libcxx] Don't use -fvisibility-global-new-delete-hidden when not defining them

When builing the hermetic static library, the compiler switch
-fvisibility-global-new-delete-hidden is necessary to get the new and
delete operator definitions made correctly. However, when those
definitions are not included in the library, then this switch does harm.
With lld (though not all linkers) setting STV_HIDDEN on SHN_UNDEF
symbols makes it an error to leave them undefined or defined via dynamic
linking that should generate PLTs for -shared linking (lld makes this a
hard error even without -z defs). Though leaving the symbols undefined
would usually work in practice if the linker were to allow it (and the
user didn't pass -z defs), this actually indicates a real problem that
could bite some target configurations more subtly at runtime. For
example, x86-32 ELF -fpic code generation uses hidden visibility on
declarations in the caller's scope as a signal that the call will never
be resolved to a PLT entry and so doesn't have to meet the special ABI
requirements for PLT calls (setting %ebx). Since these functions might
actually be resolved to PLT entries at link time (we don't know what the
user is linking in when the hermetic library doesn't provide all the
symbols itself), it's not safe for the compiler to treat their
declarations at call sites as having hidden visibility.

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

llvm-svn: 360003

5 years ago[clang-tidy] openmp-exception-escape check: point to the structured-block
Roman Lebedev [Sun, 5 May 2019 21:26:32 +0000 (21:26 +0000)]
[clang-tidy] openmp-exception-escape check: point to the structured-block

I'm not sure what i was thinking when i wrote it to point at the directive.
It's at the very least confusing, and in the `for` is very misleading.

We should point at the actual Stmt out of which the exception escapes,
to highlight where it should be fixed e.g. via adding try-catch block.

Yes, this breaks existing NOLINT, which is why this change needs to
happen now, not any later.

llvm-svn: 360002

5 years ago[X86] Pull out repeated Subtarget feature tests. NFCI.
Simon Pilgrim [Sun, 5 May 2019 20:45:20 +0000 (20:45 +0000)]
[X86] Pull out repeated Subtarget feature tests. NFCI.

Avoids a scan-build "uninitialized value" warning in X86FastISel::X86SelectFPExtOrFPTrunc

llvm-svn: 360001

5 years ago[TargetLowering] getValueType - use dyn_cast directly to find VectorType. NFCI.
Simon Pilgrim [Sun, 5 May 2019 20:23:45 +0000 (20:23 +0000)]
[TargetLowering] getValueType - use dyn_cast directly to find VectorType. NFCI.

Matches what we do in other getValueType functions and fixes a null dereference warning in scan-build.

Also cleans up the rest of the function - use auto and standardize the variable names.

llvm-svn: 360000

5 years ago[TTI][X86] Make getAddressComputationCost cost value const. NFCI.
Simon Pilgrim [Sun, 5 May 2019 20:03:51 +0000 (20:03 +0000)]
[TTI][X86] Make getAddressComputationCost cost value const. NFCI.

llvm-svn: 359999

5 years ago[analyzer][UninitializedObjectChecker] PR41741: Regard all scalar types as primitive.
Kristof Umann [Sun, 5 May 2019 19:42:33 +0000 (19:42 +0000)]
[analyzer][UninitializedObjectChecker] PR41741: Regard all scalar types as primitive.

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

Pretty much the same as D61246 and D61106, this time for __complex__ types. Upon
further investigation, I realized that we should regard all types
Type::isScalarType returns true for as primitive, so I merged
isMemberPointerType(), isBlockPointerType() and isAnyComplexType()` into that
instead.

I also stumbled across yet another bug,
https://bugs.llvm.org/show_bug.cgi?id=41753, but it seems to be unrelated to
this checker.

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

llvm-svn: 359998

5 years ago[NFC] BasicBlock: generalize replaceSuccessorsPhiUsesWith(), take Old bb
Roman Lebedev [Sun, 5 May 2019 18:59:45 +0000 (18:59 +0000)]
[NFC] BasicBlock: generalize replaceSuccessorsPhiUsesWith(), take Old bb

Thus it does not assume that the old basic block is the basic block
for which we are looking at successors.

Not reviewed, but seems rather trivial, in line with the rest of
previous few patches.

llvm-svn: 359997

5 years ago[NFC] BasicBlock: refactor changePhiUses() out of replacePhiUsesWith(), use it
Roman Lebedev [Sun, 5 May 2019 18:59:39 +0000 (18:59 +0000)]
[NFC] BasicBlock: refactor changePhiUses() out of replacePhiUsesWith(), use it

Summary:
It is a common thing to loop over every `PHINode` in some `BasicBlock`
and change old `BasicBlock` incoming block to a new `BasicBlock` incoming block.
`replaceSuccessorsPhiUsesWith()` already had code to do that,
it just wasn't a function.
So outline it into a new function, and use it.

Reviewers: chandlerc, craig.topper, spatel, danielcdh

Reviewed By: craig.topper

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 359996

5 years ago[NFC] PHINode: introduce replaceIncomingBlockWith() function, use it
Roman Lebedev [Sun, 5 May 2019 18:59:30 +0000 (18:59 +0000)]
[NFC] PHINode: introduce replaceIncomingBlockWith() function, use it

Summary:
There is `PHINode::getBasicBlockIndex()`, `PHINode::setIncomingBlock()`
and `PHINode::getNumOperands()`, but no function to replace every
specified `BasicBlock*` predecessor with some other specified `BasicBlock*`.
Clearly, there are a lot of places that could use that functionality.

Reviewers: chandlerc, craig.topper, spatel, danielcdh

Reviewed By: craig.topper

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 359995

5 years ago[NFC] Instruction: introduce replaceSuccessorWith() function, use it
Roman Lebedev [Sun, 5 May 2019 18:59:22 +0000 (18:59 +0000)]
[NFC] Instruction: introduce replaceSuccessorWith() function, use it

Summary:
There is `Instruction::getNumSuccessors()`, `Instruction::getSuccessor()`
and `Instruction::setSuccessor()`, but no function to replace every
specified `BasicBlock*` successor with some other specified `BasicBlock*`.
I've found one place where it should clearly be used.

Reviewers: chandlerc, craig.topper, spatel, danielcdh

Reviewed By: craig.topper

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 359994

5 years ago[NFC][Utils] deleteDeadLoop(): add an assert that exit block has some non-PHI instruction
Roman Lebedev [Sun, 5 May 2019 18:59:12 +0000 (18:59 +0000)]
[NFC][Utils] deleteDeadLoop(): add an assert that exit block has some non-PHI instruction

Summary:
If `deleteDeadLoop()` is called on such a loop, that has "bad" exit block,
one that e.g. has no terminator instruction, the `DIBuilder::insertDbgValueIntrinsic()`
will be told to insert the Dbg Value Intrinsic after `nullptr`
(since there is no first non-PHI instruction), which will cause it to not insert
those instructions into any basic block. The instructions will be parent-less,
and IR verifier will complain. It is rather obvious to track down the root cause
when that happens, so let's just assert it never happens.

Reviewers: sanjoy, davide, vsk

Reviewed By: vsk

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 359993

5 years ago[test] Remove randomness
Jonas Devlieghere [Sun, 5 May 2019 18:54:16 +0000 (18:54 +0000)]
[test] Remove randomness

This particular test fails once every so many runs on GreenDragon. Given
that the randomness in the inferior isn't critical to the test, I
removed it in the hopes that it is the cause of the flakiness.

llvm-svn: 359992

5 years agoMove getOpcode() call into if statement. NFCI.
Simon Pilgrim [Sun, 5 May 2019 18:34:38 +0000 (18:34 +0000)]
Move getOpcode() call into if statement. NFCI.

Avoids a cppcheck "Local variable name shadows outer variable" warning.

llvm-svn: 359991

5 years agoPrecommit an FNeg InstructionSimplify test.
Cameron McInally [Sun, 5 May 2019 18:22:09 +0000 (18:22 +0000)]
Precommit an FNeg InstructionSimplify test.

llvm-svn: 359990

5 years ago[SLPVectorizer] Prefer pre-increments. NFCI.
Simon Pilgrim [Sun, 5 May 2019 17:53:09 +0000 (17:53 +0000)]
[SLPVectorizer] Prefer pre-increments. NFCI.

llvm-svn: 359989

5 years ago[LLParser] Remove unused variable after r359987. NFC
Craig Topper [Sun, 5 May 2019 17:46:17 +0000 (17:46 +0000)]
[LLParser] Remove unused variable after r359987. NFC

llvm-svn: 359988