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
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
Simon Pilgrim [Mon, 6 May 2019 19:10:55 +0000 (19:10 +0000)]
Remove duplicate assignments. NFCI.
llvm-svn: 360064
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
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
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
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
Sanjay Patel [Mon, 6 May 2019 17:39:18 +0000 (17:39 +0000)]
[InstCombine] reduce code duplication; NFC
llvm-svn: 360059
Sanjay Patel [Mon, 6 May 2019 17:29:22 +0000 (17:29 +0000)]
[InstCombine] add tests for fneg+sel; NFC
llvm-svn: 360058
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
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
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
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
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
Sanjay Patel [Mon, 6 May 2019 16:03:53 +0000 (16:03 +0000)]
[InstCombine] regenerate test checks; NFC
llvm-svn: 360052
Sanjay Patel [Mon, 6 May 2019 15:35:02 +0000 (15:35 +0000)]
[InstCombine] reduce code duplication; NFCI
llvm-svn: 360051
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
Nico Weber [Mon, 6 May 2019 15:06:43 +0000 (15:06 +0000)]
gn build: Merge r360018
llvm-svn: 360049
Ilya Biryukov [Mon, 6 May 2019 14:56:24 +0000 (14:56 +0000)]
[CodeComplete] Update python tests after r360042
llvm-svn: 360048
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
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
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
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
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
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
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
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
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
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
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
Fangrui Song [Mon, 6 May 2019 11:43:19 +0000 (11:43 +0000)]
[test] Remove redundant bracket in rL360035
llvm-svn: 360036
Fangrui Song [Mon, 6 May 2019 11:39:49 +0000 (11:39 +0000)]
Try fix Windows bot after rL360015
llvm-svn: 360035
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
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
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
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
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
Fangrui Song [Mon, 6 May 2019 10:21:17 +0000 (10:21 +0000)]
[CodeGen] Move X86 tests under the X86 directory
llvm-svn: 360029
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
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
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
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
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
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
Fangrui Song [Mon, 6 May 2019 09:24:36 +0000 (09:24 +0000)]
[X86] Move files to correct directories after D60552
llvm-svn: 360022
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Richard Smith [Mon, 6 May 2019 04:00:45 +0000 (04:00 +0000)]
Fix up after r360006.
llvm-svn: 360007
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
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
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
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
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
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
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
Simon Pilgrim [Sun, 5 May 2019 20:03:51 +0000 (20:03 +0000)]
[TTI][X86] Make getAddressComputationCost cost value const. NFCI.
llvm-svn: 359999
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
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
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
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
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
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
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
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
Cameron McInally [Sun, 5 May 2019 18:22:09 +0000 (18:22 +0000)]
Precommit an FNeg InstructionSimplify test.
llvm-svn: 359990
Simon Pilgrim [Sun, 5 May 2019 17:53:09 +0000 (17:53 +0000)]
[SLPVectorizer] Prefer pre-increments. NFCI.
llvm-svn: 359989
Craig Topper [Sun, 5 May 2019 17:46:17 +0000 (17:46 +0000)]
[LLParser] Remove unused variable after r359987. NFC
llvm-svn: 359988
Craig Topper [Sun, 5 May 2019 17:19:23 +0000 (17:19 +0000)]
[LLParser] Remove unnecessary error check making sure NUW/NSW flags aren't set on a non-integer operation.
Summary: This check appears to be a leftover from when add/sub/mul could be either integer or fp. The NSW/NUW flags are only set for add/sub/mul/shl earlier. And we check that those operations only have integer types just below this. So it seems unnecessary to explicitly error for NUW/NSW being used on a add/sub/mul that have the wrong type that would later error for that.
Reviewers: spatel, dblaikie, jyknight, arsenm
Reviewed By: spatel
Subscribers: wdng, llvm-commits, hiraditya
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D61562
llvm-svn: 359987
Craig Topper [Sun, 5 May 2019 17:19:19 +0000 (17:19 +0000)]
[LLParser] Simplify type checking in ParseArithmetic and ParseUnaryOp.
Summary:
These methods previously took a 0, 1, or 2 to indicate what types were allowed, but the 0 encoding which meant both fp and integer types has been unused for years. Its leftover from when add/sub/mul used to be shared between int and fp
Simplify it by changing it to just a bool to distinquish int and fp.
Reviewers: spatel, dblaikie, jyknight, arsenm
Reviewed By: spatel
Subscribers: wdng, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D61561
llvm-svn: 359986
Craig Topper [Sun, 5 May 2019 17:19:16 +0000 (17:19 +0000)]
[Constants] Simplify type checking switch in ConstantExpr::get.
Summary:
Remove duplicate checks that both operands have the same type. This is checked
before the switch.
Use 'integer' or 'floating-point' instead of 'arithmetic' type. I think this
might be a leftover to the days when floating point and integer operations
shared the same opcodes.
Reviewers: spatel, RKSimon, dblaikie
Reviewed By: RKSimon
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D61558
llvm-svn: 359985
Simon Pilgrim [Sun, 5 May 2019 17:10:05 +0000 (17:10 +0000)]
Revert rL359962 : Use DiagRuntimeBehavior for -Wunsequenced to weed out false positives
where either the modification or the other access is unreachable.
........
Try to fix buildbots
llvm-svn: 359984
Andrea Di Biagio [Sun, 5 May 2019 16:07:27 +0000 (16:07 +0000)]
[MCA] Notify event listeners when instructions transition to the Pending state. NFCI
llvm-svn: 359983
Cameron McInally [Sun, 5 May 2019 16:07:09 +0000 (16:07 +0000)]
Add FNeg IR constant folding support
llvm-svn: 359982
Simon Pilgrim [Sun, 5 May 2019 12:51:47 +0000 (12:51 +0000)]
[X86] Make X86RegisterInfo(const Triple &TT) constructor explicit.
Fixes cppcheck warning.
llvm-svn: 359981
Nicolas Lesser [Sun, 5 May 2019 12:35:12 +0000 (12:35 +0000)]
[clang] fixing -ast-print for variadic parameter pack in lambda capture
Summary:
currently for:
```
template<typename ... T>
void f(T... t) {
auto l = [t...]{};
}
```
`clang -ast-print file.cpp`
outputs:
```
template <typename ...T> void f(T ...t) {
auto l = [t] {
}
;
}
```
notice that there is not `...` in the capture list of the lambda. this patch fixes this issue. and add test for it.
Patch by Tyker
Reviewers: rsmith
Reviewed By: rsmith
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D61556
llvm-svn: 359980
Nicolas Lesser [Sun, 5 May 2019 12:15:17 +0000 (12:15 +0000)]
[C++] Interpret unknown identifier in parameter clause as unknown type
instead of as parameter name without a type.
llvm-svn: 359979
Michal Gorny [Sun, 5 May 2019 12:06:32 +0000 (12:06 +0000)]
[lldb] [lit] Simplify general-purpose register tests
Use output constraints for specific general-purpose registers in order
to simplify the tests. They save us from having to manually put
the values in correct registers, and reduce the number of registers
needed as a result.
llvm-svn: 359978
Michal Gorny [Sun, 5 May 2019 12:06:22 +0000 (12:06 +0000)]
[lldb] [lit] Fix more filename mismatches in Register tests
llvm-svn: 359977
Simon Pilgrim [Sun, 5 May 2019 12:00:14 +0000 (12:00 +0000)]
[X86] Fix some cppcheck "Local variable name shadows outer variable" warnings. NFCI.
llvm-svn: 359976
Simon Pilgrim [Sun, 5 May 2019 10:37:38 +0000 (10:37 +0000)]
[SLPVectorizer] Make getSpillCost() const. NFCI.
Ideally getTreeCost() should be const as well but non-const Type creation would need to be addressed first.
llvm-svn: 359975
Simon Pilgrim [Sun, 5 May 2019 10:30:04 +0000 (10:30 +0000)]
[SelectionDAG] Use any_of/all_of where possible. NFCI.
llvm-svn: 359974
Simon Pilgrim [Sun, 5 May 2019 10:27:45 +0000 (10:27 +0000)]
Move Value *RHSCIOp def into the scope where its actually used. NFCI.
llvm-svn: 359973
Cameron McInally [Sat, 4 May 2019 14:56:08 +0000 (14:56 +0000)]
Add InstCombine tests for FNeg instruction.
llvm-svn: 359970
Sanjay Patel [Sat, 4 May 2019 12:46:32 +0000 (12:46 +0000)]
[CodeGenPrepare] limit overflow intrinsic matching to a single basic block (2nd try)
This is a subset of the original commit from rL359879
which was reverted because it could crash when using the 'RemovedInstructions'
structure that enables delayed deletion of dead instructions. The motivating
compile-time win does not require that change though. We should get most of
that win from this change alone.
Using/updating a dominator tree to match math overflow patterns may be very
expensive in compile-time (because of the way CGP uses a DT), so just handle
the single-block case.
See post-commit thread for rL354298 for more details:
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-
20190422/646276.html
Differential Revision: https://reviews.llvm.org/D61075
llvm-svn: 359969
Nicolas Lesser [Sat, 4 May 2019 11:28:11 +0000 (11:28 +0000)]
[NFC] Add parentheses to avoid -Wparentheses.
llvm-svn: 359968
Hamza Sood [Sat, 4 May 2019 10:49:46 +0000 (10:49 +0000)]
[c++20] Implement P0428R2 - Familiar template syntax for generic lambdas
Differential Revision: https://reviews.llvm.org/D36527
llvm-svn: 359967
Nicolas Lesser [Sat, 4 May 2019 10:21:50 +0000 (10:21 +0000)]
[lldb] Fix buildbot failure due to clang AST change.
In r359949 several AST node constructors were modified without the
corresponding change in lldb, which caused build failures.
llvm-svn: 359966
Fangrui Song [Sat, 4 May 2019 09:12:18 +0000 (09:12 +0000)]
[llvm-nm] Convert weak.test to use yaml2obj and fix unntested 'v'
This restores part of the good change reverted by r359830.
llvm-svn: 359965