Commit Graph

328473 Commits

Author SHA1 Message Date
Sam McCall e503256790 [ClangFormat] Future-proof Standard option, allow floating or pinning to arbitrary lang version
Summary:
The historical context:
- clang-format was written when C++11 was current,
  and the main language-version concern was >> vs > > template-closers.
  An option was added to allow selection of the 03/11 behavior, or auto-detection.
- there was no option to choose simply "latest standard" so anyone who didn't
  ever want 03 behavior or auto-detection specified Cpp11.
- In r185149 this option started to affect lexer mode.
- no options were added to cover c++14, as parsing/formatting
  didn't change that much. The usage of Cpp11 to mean "latest" became
  codified e.g. in r206263
- c++17 added some new constructs. These were mostly backwards-compatible and so
  not used in old programs, so having no way to turn them off was OK.
- c++20 added some new constructs and keywords (e.g. co_*) that changed the
  meaning of existing programs, and people started to complain that
  the c++20 parsing couldn't be turned off.

New plan:
 - Default ('Auto') behavior remains unchanged: parse as latest, format
   template-closers based on input.
 - Add new 'Latest' option that more clearly expresses the intent "use
   modern features" that many projects have chosen for their .clang-format files.
 - Allow pinning to *any* language version, using the same name as clang -std:
   c++03, c++11, c++14 etc. These set precise lexer options, and any
   clang-format code depending on these can use a >= check.
 - For backwards compatibility, `Cpp11` is an alias for `Latest`, not `c++11`.
   This matches the historical documented semantics of this option.
   This spelling (and `Cpp03`) are deprecated.

Reviewers: klimek, modocache

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 373439
2019-10-02 09:50:40 +00:00
Nico Weber b54302e37d gn build: (manually) merge r373425
llvm-svn: 373438
2019-10-02 09:48:16 +00:00
Kerry McLaughlin 76365b3b24 [IntrinsicEmitter] Add overloaded type VecOfBitcastsToInt for SVE intrinsics
Summary:
This allows intrinsics such as the following to be defined:
 - declare <n x 4 x i32> @llvm.something.nxv4f32(<n x 4 x i32>, <n x 4 x i1>, <n x 4 x float>)

...where <n x 4 x i32> is derived from <n x 4 x float>, but
the element needs bitcasting to int.

Reviewers: c-rhodes, sdesmalen, rovka

Reviewed By: c-rhodes

Subscribers: tschuett, hiraditya, jdoerfert, llvm-commits, cfe-commits

Tags: #llvm

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

llvm-svn: 373437
2019-10-02 09:25:02 +00:00
Sam McCall 442be72777 [clang-tidy] Fix typo in r373428
llvm-svn: 373436
2019-10-02 09:16:48 +00:00
Kadir Cetinkaya e95e516596 [clangd] Always send file URIs to editors
Summary:
Editors only know about file URIs, make sure we do not use any custom
schemes while sending edits.

Reviewers: sammccall

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

Tags: #clang

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

llvm-svn: 373435
2019-10-02 09:12:01 +00:00
Jay Foad c38188c5fe Remove an unnecessary cast. NFC.
llvm-svn: 373434
2019-10-02 08:56:33 +00:00
Jay Foad dafda61021 [AMDGPU] Make printf lowering faster when there are no printfs
Summary:
Printf lowering unconditionally visited every instruction in the module.
To make it faster in the common case where there are no printfs, look up
the printf function (if any) and iterate over its users instead.

Reviewers: rampitec, kzhuravl, alex-t, arsenm

Subscribers: jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 373433
2019-10-02 08:44:15 +00:00
Florian Hahn 47dbcbd8ec Revert [GlobalOpt] Pass DTU to removeUnreachableBlocks instead of recomputing.
This breaks http://lab.llvm.org:8011/builders/sanitizer-windows/builds/52310

This reverts r373430 (git commit 70f7003548)

llvm-svn: 373432
2019-10-02 08:32:25 +00:00
Hans Wennborg cbefc36fcc Switch lowering: omit range check for bit tests when default is unreachable (PR43129)
This is modeled after the same functionality for jump tables, which was
added in r357067.

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

llvm-svn: 373431
2019-10-02 08:32:15 +00:00
Florian Hahn 70f7003548 [GlobalOpt] Pass DTU to removeUnreachableBlocks instead of recomputing.
removeUnreachableBlocks knows how to preserve the DomTree, so make use
of it instead of re-computing the DT.

Reviewers: davide, kuhar, brzycki

Reviewed By: davide, kuhar

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

llvm-svn: 373430
2019-10-02 08:15:31 +00:00
Florian Hahn 167b0529be [Local] Simplify function removeUnreachableBlocks() to avoid (re-)computation.
Two small changes in llvm::removeUnreachableBlocks() to avoid unnecessary (re-)computation.

First, replace the use of count() with find(), which has better time complexity.

Second, because we have already computed the set of dead blocks, replace the second loop over all basic blocks to a loop only over the already computed dead blocks. This simplifies the loop and avoids recomputation.

Patch by Rodrigo Caetano Rocha <rcor.cs@gmail.com>

Reviewers: efriedma, spatel, fhahn, xbolva00

Reviewed By: fhahn, xbolva00

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

llvm-svn: 373429
2019-10-02 07:37:41 +00:00
Adam Balogh 1c57143742 [clang-tidy] Fix for commits rL372706 and rL372711
The patch committed was not the accepted version but the
previous one. This commit fixes this issue.

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

llvm-svn: 373428
2019-10-02 07:14:11 +00:00
Djordje Todorovic 2ef18fb41a Reland "[utils] Implement the llvm-locstats tool"
The tool reports verbose output for the DWARF debug location coverage.
The llvm-locstats for each variable or formal parameter DIE computes what
percentage from the code section bytes, where it is in scope, it has
location description. The line 0 shows the number (and the percentage) of
DIEs with no location information, but the line 100 shows the number (and
the percentage) of DIEs where there is location information in all code
section bytes (where the variable or parameter is in the scope). The line
50..59 shows the number (and the percentage) of DIEs where the location
information is in between 50 and 59 percentage of its scope covered.

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

The cause of the test failure was resolved.

llvm-svn: 373427
2019-10-02 07:00:01 +00:00
Rui Ueyama 60e9df3362 [llvm-lib] Detect duplicate input files
Differential Revision: https://reviews.llvm.org/D68320

llvm-svn: 373426
2019-10-02 06:41:52 +00:00
John McCall 36b12a861c Rename TypeNodes.def to TypeNodes.inc for consistency across all
our autogenerated files.  NFC.

As requested by Nico Weber.

llvm-svn: 373425
2019-10-02 06:35:23 +00:00
Rui Ueyama 64a362e721 [llvm-lib] Correctly handle .lib input files
If archive files are passed as input files, llvm-lib needs to append
the members of the input archive files to the output file. This patch
implements that behavior.

This patch splits an existing function into smaller functions.
Effectively, the new code is only `if (Magic == file_magic::archive)
{ ... }` part.

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

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

llvm-svn: 373424
2019-10-02 05:24:24 +00:00
Craig Topper 8d6a863b02 [X86] Add broadcast load folding patterns to the NoVLX compare patterns.
These patterns use zmm registers for 128/256-bit compares when
the VLX instructions aren't available. Previously we only
supported registers, but as PR36191 notes we can fold broadcast
loads, but not regular loads.

llvm-svn: 373423
2019-10-02 04:45:02 +00:00
Michael Liao c3aab6eaaa Fix GCC -Wreturn-type warnings. NFC.
llvm-svn: 373422
2019-10-02 04:13:17 +00:00
Richard Trieu e388725316 Revert r368237 - Update fix-it hints for std::move warnings.
r368237 attempted to improve fix-its for move warnings, but introduced some
regressions to -Wpessimizing-move.  Revert that change and add the missing
test cases to the pessimizing move test to prevent future regressions.

llvm-svn: 373421
2019-10-02 02:32:15 +00:00
David Blaikie bfc68885d9 DebugInfo: Update support for detecting C++ language variants in debug info emission
llvm-svn: 373420
2019-10-02 01:39:48 +00:00
Nico Weber 9e763e1b36 gn build: (manually) merge r373407
llvm-svn: 373419
2019-10-02 01:26:46 +00:00
Richard Smith 5e18f4db08 Fix crash on constant-evaluation of pseudo-destruction of a pointer.
We got confused and thought we might be pseudo-destroying the pointee
instead.

llvm-svn: 373418
2019-10-02 01:13:57 +00:00
Matt Arsenault 86f864dace AMDGPU/GlobalISel: Use getIntrinsicID helper
llvm-svn: 373417
2019-10-02 01:02:27 +00:00
John McCall c60a824205 Remove TypeNodes.def from the modulemap.
We currently just look for files named in the modulemap in its
associated source directory.  This means that we can't name
generated files, like TypeNodes.def now is, which means we can't
explicitly mark it as textual.  But fortunately that's okay
because (as I understand it) the most important purpose of naming
the header in the modulemap is to ensure that it's not treated as
public, and the search for public headers also only considers
files in the associated source directory.  This isn't an elegant
solution, since among other things it means that a build which
wrote the generated files directly into the source directory would
result in something that wouldn't build as a module, but that's
a problem for all our other generated files as well.

llvm-svn: 373416
2019-10-02 01:02:27 +00:00
Matt Arsenault cdfe5efe9b AMDGPU/GlobalISel: Assume VGPR for G_FRAME_INDEX
In principle this should behave as any other constant. However
eliminateFrameIndex currently assumes a VALU use and uses a vector
shift. Work around this by selecting to VGPR for now until
eliminateFrameIndex is fixed.

llvm-svn: 373415
2019-10-02 01:02:24 +00:00
Matt Arsenault bfce0c2664 AMDGPU/GlobalISel: Private loads always use VGPRs
llvm-svn: 373414
2019-10-02 01:02:21 +00:00
Matt Arsenault 05aa8a733e AMDGPU/GlobalISel: Legalize 1024-bit G_BUILD_VECTOR
This will be needed to support AGPR operations.

llvm-svn: 373413
2019-10-02 01:02:18 +00:00
Matt Arsenault 3a657afb3a AMDGPU/GlobalISel: Fix RegBankSelect for 1024-bit values
llvm-svn: 373412
2019-10-02 01:02:14 +00:00
Stanislav Mekhanoshin 075bc48a7f [AMDGPU] separate accounting for agprs
Account and report agprs separately on gfx908. Other targets
do not change the reporting.

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

llvm-svn: 373411
2019-10-02 00:26:58 +00:00
Michael Liao d838cf76ca Fix unused variable warning. NFCI.
llvm-svn: 373410
2019-10-02 00:22:45 +00:00
Adrian Prantl e2385e089d Make yet another attempt in restoring SymbolFilePDBTests
The original test was passing false to the append argument of
FindTypes (the only use of this feature!). This patch now replicates
that by passing a fresh TypeMap into the function where applicable.

llvm-svn: 373409
2019-10-02 00:06:27 +00:00
Craig Topper 8c19925f42 [X86] Add a DAG combine to shrink vXi64 gather/scatter indices that are constant with sufficient sign bits to fit in vXi32
The gather/scatter instructions can implicitly sign extend the indices. If we're operating on 32-bit data, an v16i64 index can force a v16i32 gather to be split in two since the index needs 2 registers. If we can shrink the index to the i32 we can avoid the split. It should always be safe to shrink the index regardless of the number of elements. We have gather/scatter instructions that can use v2i32 index stored in a v4i32 register with v2i64 data size.

I've limited this to before legalize types to avoid creating a v2i32 after type legalization. We could check for it, but we'd also need testing. I'm also only handling build_vectors with no bitcasts to be sure the truncate will constant fold.

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

llvm-svn: 373408
2019-10-01 23:18:31 +00:00
John McCall a82d2fe944 Emit TypeNodes.def with tblgen.
The primary goal here is to make the type node hierarchy available to
other tblgen backends, although it should also make it easier to generate
more selective x-macros in the future.

Because tblgen doesn't seem to allow backends to preserve the source
order of defs, this is not NFC because it significantly re-orders IDs.
I've fixed the one (fortunately obvious) place where we relied on
the old order.  Unfortunately, I wasn't able to share code with the
existing AST-node x-macro generators because the x-macro schema we use
for types is different in a number of ways.  The main loss is that
subclasses aren't ordered together, which doesn't seem important for
types because the hierarchy is generally very shallow with little
clustering.

llvm-svn: 373407
2019-10-01 23:13:03 +00:00
John McCall c45f8d4989 Use scope qualifiers in Clang's tblgen backends to get useful
redeclaration checking.  NFC.

llvm-svn: 373406
2019-10-01 23:12:57 +00:00
Dan Liew bbde056b88 [CMake] Fix the value of `config.target_cflags` for non-macOS Apple platforms. Attempt #3.
The main problem here is that `-*-version_min=` was not being passed to
the compiler when building test cases. This can cause problems when
testing on devices running older OSs because Clang would previously
assume the minimum deployment target is the the latest OS in the SDK
which could be much newer than what the device is running.

Previously the generated value looked like this:

`-arch arm64 -isysroot
<path_to_xcode>/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk`

With this change it now looks like:

`-arch arm64 -stdlib=libc++ -miphoneos-version-min=8.0 -isysroot
<path_to_xcode>/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk`

This mirrors the setting of config.target_cflags on macOS.

This change is made for ASan, LibFuzzer, TSan, and UBSan.

To implement this a new `get_test_cflags_for_apple_platform()` function
has been added that when given an Apple platform name and architecture
returns a string containing the C compiler flags to use when building
tests. This also calls a new helper function `is_valid_apple_platform()`
that validates Apple platform names.

This is the third attempt at landing the patch.

The first attempt (r359305) had to be reverted (r359327) due to a buildbot
failure. The problem was that calling `get_test_cflags_for_apple_platform()`
can trigger a CMake error if the provided architecture is not supported by the
current CMake configuration. Previously, this could be triggered by passing
`-DCOMPILER_RT_ENABLE_IOS=OFF` to CMake. The root cause is that we were
generating test configurations for a list of architectures without checking if
the relevant Sanitizer actually supported that architecture. We now intersect
the list of architectures for an Apple platform with
`<SANITIZER>_SUPPORTED_ARCH` (where `<SANITIZER>` is a Sanitizer name) to
iterate through the correct list of architectures.

The second attempt (r363633) had to be reverted (r363779) due to a build
failure. The failed build was using a modified Apple toolchain where the iOS
simulator SDK was missing. This exposed a bug in the existing UBSan test
generation code where it was assumed that `COMPILER_RT_ENABLE_IOS` implied that
the toolchain supported both iOS and the iOS simulator. This is not true. This
has been fixed by using the list `SANITIZER_COMMON_SUPPORTED_OS` for the list
of supported Apple platforms for UBSan. For consistency with the other
Sanitizers we also now intersect the list of architectures with
UBSAN_SUPPORTED_ARCH.

rdar://problem/50124489

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

llvm-svn: 373405
2019-10-01 23:08:18 +00:00
Changpeng Fang e4ee28d14c AMDGPU: Fix an out of date assert in addressing FrameIndex
Reviewers:
  arsenm

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

llvm-svn: 373404
2019-10-01 23:07:14 +00:00
Matt Morehouse 1c8e05110c [libFuzzer] Remove lazy counters.
Summary: Lazy counters haven't improved performance for large fuzz targets.

Reviewers: kcc

Reviewed By: kcc

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 373403
2019-10-01 22:49:06 +00:00
Sterling Augustine 9b36c1cf27 Determine endianness at a time when it doesn't inadvertantly clear gdb's wrap_buffer via gdb.execute.
Summary:
I haven't managed a small reproduction for this bug, it involves
complicated and deeply nested data structures with a wide variety
of pretty printers. But in general, we shouldn't be combining
gdb's command line interface (via gdb.execute) with pretty-printers.

Subscribers: christof, llvm-commits

Tags: #llvm

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

llvm-svn: 373402
2019-10-01 22:42:37 +00:00
Craig Topper 0da163a2cf Revert r373172 "[X86] Add custom isel logic to match VPTERNLOG from 2 logic ops."
This seems to be causing some performance regresions that I'm
trying to investigate.

One thing that stands out is that this transform can increase
the live range of the operands of the earlier logic op. This
can be bad for register allocation. If there are two logic
op inputs we should really combine the one that is closest, but
SelectionDAG doesn't have a good way to do that. Maybe we need
to do this as a basic block transform in Machine IR.

llvm-svn: 373401
2019-10-01 22:40:03 +00:00
Jordan Rupprecht 5269091dc7 [clang][OpenMP][NFC] #include GlobalDecl.h to avoid incomplete class type
llvm-svn: 373400
2019-10-01 22:30:10 +00:00
Jordan Rupprecht a77c3ef03c [lldb] Fix unused variable warning
llvm-svn: 373399
2019-10-01 22:04:14 +00:00
Simon Pilgrim 5e0a0b707b CGVTables - silence static analyzer getAs<FunctionProtoType> null dereference warnings. NFCI.
The static analyzer is warning about potential null dereferences, but we should be able to use castAs<FunctionProtoType> directly and if not assert will fire for us.

llvm-svn: 373398
2019-10-01 22:02:46 +00:00
Craig Topper 912870573c [X86] convertToThreeAddress, make sure second operand of SUB32ri is really an immediate before calling getImm().
It might be a symbol instead. We can't fold those since we can't
negate them.

Similar for other SUB with immediates.

Fixes PR43529.

llvm-svn: 373397
2019-10-01 21:55:55 +00:00
Simon Pilgrim f7133b7977 CGExprAgg - remove duplicate code. NFCI.
Remove duplicate getAs<> call, avoiding a clang static analyzer null dereference warning.

llvm-svn: 373396
2019-10-01 21:50:30 +00:00
Thomas Preud'homme ed1178689f [FileCheck] Move private interface to its own header
Summary:
Most of the class definition in llvm/include/llvm/Support/FileCheck.h
are actually implementation details that should not be relied upon. This
commit moves all of it in a new header file under
llvm/lib/Support/FileCheck. It also takes advantage of the code movement
to put the code into a new llvm::filecheck namespace.

Reviewers: jhenderson, chandlerc, jdenny, probinson, grimar, arichardson, rnk

Subscribers: hiraditya, llvm-commits, probinson, dblaikie, grimar, arichardson, tra, rnk, kristina, hfinkel, rogfer01, JonChesterfield

Tags: #llvm

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

llvm-svn: 373395
2019-10-01 21:37:55 +00:00
Sanjay Patel 9738fd6387 [BypassSlowDivision][CodeGenPrepare] avoid crashing on unused code (PR43514)
https://bugs.llvm.org/show_bug.cgi?id=43514

llvm-svn: 373394
2019-10-01 21:25:36 +00:00
GN Sync Bot 081e9df1e1 gn build: Merge r373392
llvm-svn: 373393
2019-10-01 21:23:33 +00:00
Stephane Moore e4acb971f1 [clang-tidy] Rename objc-avoid-spinlock check to darwin-avoid-spinlock
Summary:
OSSpinLock* are Apple/Darwin functions, but were previously located with ObjC checks as those were most closely tied to Apple platforms before.

Now that there's a specific Darwin module, relocating the check there.

This change was prepared by running rename_check.py.

Contributed By: mwyman

Reviewers: stephanemoore, dmaclach

Reviewed By: stephanemoore

Subscribers: Eugene.Zelenko, mgorny, xazax.hun, cfe-commits

Tags: #clang-tools-extra, #clang, #llvm

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

llvm-svn: 373392
2019-10-01 21:18:40 +00:00
Leonard Chan 8830975cf6 [ASan][NFC] Address remaining comments for https://reviews.llvm.org/D68287
I submitted that patch after I got the LGTM, but the comments didn't
appear until after I submitted the change. This adds `const` to the
constructor argument and makes it a pointer.

llvm-svn: 373391
2019-10-01 20:49:07 +00:00
Louis Dionne 85ee0c2ec3 [NFC] Fix typos in libc++ documentation
llvm-svn: 373390
2019-10-01 20:34:50 +00:00