Simon Pilgrim [Wed, 2 Oct 2019 15:31:25 +0000 (15:31 +0000)]
Silence static analyzer getAs<VectorType> null dereference warnings. NFCI.
The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<VectorType> directly and if not assert will fire for us.
llvm-svn: 373478
Hans Wennborg [Wed, 2 Oct 2019 14:35:06 +0000 (14:35 +0000)]
Reapply r373431 "Switch lowering: omit range check for bit tests when default is unreachable (PR43129)"
This was reverted in r373454 due to breaking the expensive-checks bot.
This version addresses that by omitting the addSuccessorWithProb() call
when omitting the range check.
> 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: 373477
George Rimar [Wed, 2 Oct 2019 14:11:35 +0000 (14:11 +0000)]
[llvm-readelf] - Report a warning when .hash section contains a chain with a cycle.
It is possible to craft a .hash section that triggers an infinite loop
in llvm-readelf code. This patch fixes the issue and introduces
a warning.
Differential revision: https://reviews.llvm.org/D68086
llvm-svn: 373476
Simon Pilgrim [Wed, 2 Oct 2019 14:02:27 +0000 (14:02 +0000)]
SemaOverload - silence static analyzer getAs<> null dereference warnings. NFCI.
The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<> directly and if not assert will fire for us.
llvm-svn: 373475
Simon Pilgrim [Wed, 2 Oct 2019 14:02:18 +0000 (14:02 +0000)]
SemaInit - silence static analyzer getAs<> null dereference warnings. NFCI.
The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<> directly and if not assert will fire for us.
llvm-svn: 373474
George Rimar [Wed, 2 Oct 2019 13:52:37 +0000 (13:52 +0000)]
[yaml2obj] - Alow Size tag for describing SHT_HASH sections.
This is a follow-up for D68085 which allows using "Size"
tag together with "Content" tag or alone.
Differential revision: https://reviews.llvm.org/D68216
llvm-svn: 373473
Shaurya Gupta [Wed, 2 Oct 2019 13:52:14 +0000 (13:52 +0000)]
[Clangd] ExtractFunction: Don't extract body of enclosing function.
Summary:
This patch disable extraction of the body of the enclosing function.
`void f() [[{}]]`
Extracting this CompoundStmt would leave the enclosing function without
a body.
Reviewers: sammccall, kadircet
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D68245
llvm-svn: 373472
Shaurya Gupta [Wed, 2 Oct 2019 13:51:06 +0000 (13:51 +0000)]
[Clangd] Ensure children are always RootStmt in ExtractFunction (Fixes #153)
Summary:
We weren't always checking if children are RootStmts in ExtractFunction.
For `void f([[int a]]);`, the ParmVarDecl appeared as a RootStmt since
we didn't perform the check and ended up being casted to a (null) Stmt.
Reviewers: sammccall, kadircet
Subscribers: kristof.beyls, ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D68182
llvm-svn: 373471
Raphael Isemann [Wed, 2 Oct 2019 13:46:17 +0000 (13:46 +0000)]
[lldb] Fix evaluation of nested classes with parent from other CU
This makes sure that we associate DIEs that are imported from other CUs with the appropriate decl context.
Without this fix, nested classes can be dumped directly into their CU context if their parent was imported from another CU.
Reviewed By: teemperor, labath
Differential Revision: https://reviews.llvm.org/D68278
Patch by Jaroslav Sevcik!
llvm-svn: 373470
Djordje Todorovic [Wed, 2 Oct 2019 13:24:45 +0000 (13:24 +0000)]
[llvm-dwarfdump] Fix dumping of wrong locstats map
llvm-svn: 373469
Kerry McLaughlin [Wed, 2 Oct 2019 13:09:54 +0000 (13:09 +0000)]
[AArch64][SVE] Implement int_aarch64_sve_cnt intrinsic
Summary: This patch includes tests for the VecOfBitcastsToInt type added by D68021
Reviewers: c-rhodes, sdesmalen, rovka
Reviewed By: c-rhodes
Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, llvm-commits, cfe-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68023
llvm-svn: 373468
Simon Pilgrim [Wed, 2 Oct 2019 13:09:12 +0000 (13:09 +0000)]
MemorySSAUpdater::applyInsertUpdates - silence static analyzer dyn_cast<MemoryAccess> null dereference warning. NFCI.
The static analyzer is warning about a potential null dereference, but we should be able to use cast<MemoryAccess> directly and if not assert will fire for us.
llvm-svn: 373467
Simon Pilgrim [Wed, 2 Oct 2019 13:09:04 +0000 (13:09 +0000)]
MemorySSA tryOptimizePhi - assert that we've found a DefChainEnd. NFCI.
Silences static analyzer null dereference warning.
llvm-svn: 373466
Simon Pilgrim [Wed, 2 Oct 2019 13:08:56 +0000 (13:08 +0000)]
LoopAccessAnalysis isConsecutiveAccess() - silence static analyzer dyn_cast<SCEVConstant> null dereference warning. NFCI.
The static analyzer is warning about potential null dereferences, but in these cases we should be able to use cast<SCEVConstant> directly and if not assert will fire for us.
llvm-svn: 373465
Simon Pilgrim [Wed, 2 Oct 2019 13:08:46 +0000 (13:08 +0000)]
AsmPrinter - emitGlobalConstantFP - silence static analyzer null dereference warning. NFCI.
All the calls to emitGlobalConstantFP should provide a nonnull Type for the float.
llvm-svn: 373464
GN Sync Bot [Wed, 2 Oct 2019 12:51:47 +0000 (12:51 +0000)]
gn build: Merge r373462
llvm-svn: 373463
James Molloy [Wed, 2 Oct 2019 12:46:44 +0000 (12:46 +0000)]
[ModuloSchedule] Peel out prologs and epilogs, generate actual code
Summary:
This extends the PeelingModuloScheduleExpander to generate prolog and epilog code,
and correctly stitch uses through the prolog, kernel, epilog DAG.
The key concept in this patch is to ensure that all transforms are *local*; only a
function of a block and its immediate predecessor and successor. By defining the problem in this way
we can inductively rewrite the entire DAG using only local knowledge that is easy to
reason about.
For example, we assume that all prologs and epilogs are near-perfect clones of the
steady-state kernel. This means that if a block has an instruction that is predicated out,
we can redirect all users of that instruction to that equivalent instruction in our
immediate predecessor. As all blocks are clones, every instruction must have an equivalent in
every other block.
Similarly we can make the assumption by construction that if a value defined in a block is used
outside that block, the only possible user is its immediate successors. We maintain this
even for values that are used outside the loop by creating a limited form of LCSSA.
This code isn't small, but it isn't complex.
Enabled a bunch of testing from Hexagon. There are a couple of tests not enabled yet;
I'm about 80% sure there isn't buggy codegen but the tests are checking for patterns
that we don't produce. Those still need a bit more investigation. In the meantime we
(Google) are happy with the code produced by this on our downstream SMS implementation,
and believe it generates correct code.
Subscribers: mgorny, hiraditya, jsji, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68205
llvm-svn: 373462
Fangrui Song [Wed, 2 Oct 2019 12:41:25 +0000 (12:41 +0000)]
[llvm-objcopy] Add --set-section-alignment
Fixes PR43181. This option was recently added to GNU objcopy (binutils
PR24942).
`llvm-objcopy -I binary -O elf64-x86-64 --set-section-alignment .data=8` can set the alignment of .data.
Reviewed By: grimar, jhenderson, rupprecht
Differential Revision: https://reviews.llvm.org/D67656
llvm-svn: 373461
Raphael Isemann [Wed, 2 Oct 2019 12:38:04 +0000 (12:38 +0000)]
[lldb][NFC] Remove ClangASTContext::Clear
We now only use this function directly after initialization. As Clear()
resets the ASTContext back to its initial state, this is just a no-op.
There are no other users for this and we no longer can set the ASTContext
after construction, so Clear has no useful purpose anymore. It's also
mostly copy-pasted from Finalize().
llvm-svn: 373460
Florian Hahn [Wed, 2 Oct 2019 12:32:52 +0000 (12:32 +0000)]
[InstCombine] Simplify fma multiplication to nan for undef or nan operands.
In similar fashion to D67721, we can simplify FMA multiplications if any
of the operands is NaN or undef. In instcombine, we will simplify the
FMA to an fadd with a NaN operand, which in turn gets folded to NaN.
Note that this just changes SimplifyFMAFMul, so we still not catch the
case where only the Add part of the FMA is Nan/Undef.
Reviewers: cameron.mcinally, mcberg2017, spatel, arsenm
Reviewed By: cameron.mcinally
Differential Revision: https://reviews.llvm.org/D68265
llvm-svn: 373459
Florian Hahn [Wed, 2 Oct 2019 12:32:37 +0000 (12:32 +0000)]
[InstCombine] Precommit tests for D68265
llvm-svn: 373458
Raphael Isemann [Wed, 2 Oct 2019 12:26:08 +0000 (12:26 +0000)]
[lldb][NFC] Create the ASTContext in ClangASTContext exactly once.
Reason for this patch is the Ssame reason as for the previous patches:
Having a ClangASTContext and being able to switch the associated ASTContext isn't
a use case we have (or should have), so let's simplify all this code.
This way it becomes clearer in what order we initialize data structures.
The DWARFASTParserClangTests changes are necessary as the test is using
a ClangASTContext but relied on the fact that no called function ever calls
getASTContext() on our ClangASTContext (as that would create the ASTContext).
As we now always create the ASTContext the fact that we had an uninitialized
FileSystem made the test crash.
llvm-svn: 373457
Aditya Kumar [Wed, 2 Oct 2019 12:15:17 +0000 (12:15 +0000)]
NFC: directly return when CommonExitBlock != Succ
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68330
llvm-svn: 373456
Sanjay Patel [Wed, 2 Oct 2019 12:12:02 +0000 (12:12 +0000)]
[InstSimplify] fold fma/fmuladd with a NaN or undef operand
This is intended to be similar to the constant folding results from
D67446
and earlier, but not all operands are constant in these tests, so the
responsibility for folding is left to InstSimplify.
Differential Revision: https://reviews.llvm.org/D67721
llvm-svn: 373455
Hans Wennborg [Wed, 2 Oct 2019 12:08:44 +0000 (12:08 +0000)]
Revert r373431 "Switch lowering: omit range check for bit tests when default is unreachable (PR43129)"
This broke http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/19967
> 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: 373454
Simon Pilgrim [Wed, 2 Oct 2019 11:49:53 +0000 (11:49 +0000)]
LICM - remove unused variable and reduce scope of another variable. NFCI.
Appeases both clang static analyzer and cppcheck
llvm-svn: 373453
Fangrui Song [Wed, 2 Oct 2019 11:49:47 +0000 (11:49 +0000)]
Fix libc++ pretty printer test for Python 3 after D67238
llvm-svn: 373452
Simon Pilgrim [Wed, 2 Oct 2019 11:49:32 +0000 (11:49 +0000)]
Log2_32 returns an unsigned. NFCI.
Silences clang static analyzer warning about out of bounds (negative) shifts.
llvm-svn: 373451
Simon Pilgrim [Wed, 2 Oct 2019 11:48:45 +0000 (11:48 +0000)]
Fix uninitialized variable warning. NFCI.
llvm-svn: 373450
Simon Pilgrim [Wed, 2 Oct 2019 11:48:32 +0000 (11:48 +0000)]
WinException::emitExceptHandlerTable - silence static analyzer dyn_cast<Function> null dereference warning. NFCI.
The static analyzer is warning about a potential null dereference, but we should be able to use cast<Function> directly and if not assert will fire for us.
llvm-svn: 373449
Simon Pilgrim [Wed, 2 Oct 2019 11:48:17 +0000 (11:48 +0000)]
MetadataLoader upgradeCUVariables() - silence static analyzer dyn_cast_or_null<> null dereference warning. NFCI.
The static analyzer is warning about a potential null dereference, but we know that the source won't be null so just use dyn_cast, which will assert if the value somehow is actually null.
llvm-svn: 373448
Simon Pilgrim [Wed, 2 Oct 2019 11:48:06 +0000 (11:48 +0000)]
ASTContext - silence static analyzer getAs<> null dereference warnings. NFCI.
The static analyzer is warning about potential null dereferences, but we should be able to use castAs<> directly and if not assert will fire for us.
llvm-svn: 373447
David Green [Wed, 2 Oct 2019 11:40:51 +0000 (11:40 +0000)]
[ARM] Identity shuffles are legal
Identity shuffles, of the form (0, 1, 2, 3, ...) are perfectly OK under MVE
(they essentially just become bitcasts). We were not catching that in the
existing set of what we considered legal though. On NEON, they would be covered
by vext's, but that is not generally available in MVE.
This uses ShuffleVectorInst::isIdentityMask which is a little odd to use here
but does what we want and prevents us from just rewriting what is the same
function.
Differential Revision: https://reviews.llvm.org/D68241
llvm-svn: 373446
Martin Storsjo [Wed, 2 Oct 2019 11:04:55 +0000 (11:04 +0000)]
[Support, ARM64] Define getHostCPUFeatures for Windows on ARM64 platform
Patch by Adam Kallai!
Differential Revision: https://reviews.llvm.org/D68139
llvm-svn: 373445
Haojian Wu [Wed, 2 Oct 2019 10:46:37 +0000 (10:46 +0000)]
[clangd] Bail out early if we are sure that the symbol is used outside of the file.
Summary:
This would reduce the false positive when the static index is in an
unavailable state, e.g. background index is not finished.
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D68325
llvm-svn: 373444
Sam McCall [Wed, 2 Oct 2019 10:01:53 +0000 (10:01 +0000)]
[clangd] SelectionTree should mark a node as fully-selected if the only claimed tokens were early-claimed.
Summary:
Previously they would be marked as partially-selected based on the early claim,
and never updated as no more tokens were claimed.
This affects simple VarDecls like "int x".
Reviewers: SureYeaah
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66872
llvm-svn: 373442
Sam McCall [Wed, 2 Oct 2019 09:52:52 +0000 (09:52 +0000)]
[ClangFormat] relnotes for r373439
llvm-svn: 373441
Haojian Wu [Wed, 2 Oct 2019 09:50:46 +0000 (09:50 +0000)]
[clang-rename] Better renaming the typedef decl.
Summary:
when renaming a typedef decl, we used to rename the underlying decl of the
typedef, we should rename the typedef itself.
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D68322
llvm-svn: 373440
Sam McCall [Wed, 2 Oct 2019 09:50:40 +0000 (09:50 +0000)]
[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
Nico Weber [Wed, 2 Oct 2019 09:48:16 +0000 (09:48 +0000)]
gn build: (manually) merge r373425
llvm-svn: 373438
Kerry McLaughlin [Wed, 2 Oct 2019 09:25:02 +0000 (09:25 +0000)]
[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
Sam McCall [Wed, 2 Oct 2019 09:16:48 +0000 (09:16 +0000)]
[clang-tidy] Fix typo in r373428
llvm-svn: 373436
Kadir Cetinkaya [Wed, 2 Oct 2019 09:12:01 +0000 (09:12 +0000)]
[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
Jay Foad [Wed, 2 Oct 2019 08:56:33 +0000 (08:56 +0000)]
Remove an unnecessary cast. NFC.
llvm-svn: 373434
Jay Foad [Wed, 2 Oct 2019 08:44:15 +0000 (08:44 +0000)]
[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
Florian Hahn [Wed, 2 Oct 2019 08:32:25 +0000 (08:32 +0000)]
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
70f70035484ba199a329f9f8d9bd67e37bc2b408)
llvm-svn: 373432
Hans Wennborg [Wed, 2 Oct 2019 08:32:15 +0000 (08:32 +0000)]
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
Florian Hahn [Wed, 2 Oct 2019 08:15:31 +0000 (08:15 +0000)]
[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
Florian Hahn [Wed, 2 Oct 2019 07:37:41 +0000 (07:37 +0000)]
[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
Adam Balogh [Wed, 2 Oct 2019 07:14:11 +0000 (07:14 +0000)]
[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
Djordje Todorovic [Wed, 2 Oct 2019 07:00:01 +0000 (07:00 +0000)]
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
Rui Ueyama [Wed, 2 Oct 2019 06:41:52 +0000 (06:41 +0000)]
[llvm-lib] Detect duplicate input files
Differential Revision: https://reviews.llvm.org/D68320
llvm-svn: 373426
John McCall [Wed, 2 Oct 2019 06:35:23 +0000 (06:35 +0000)]
Rename TypeNodes.def to TypeNodes.inc for consistency across all
our autogenerated files. NFC.
As requested by Nico Weber.
llvm-svn: 373425
Rui Ueyama [Wed, 2 Oct 2019 05:24:24 +0000 (05:24 +0000)]
[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
Craig Topper [Wed, 2 Oct 2019 04:45:02 +0000 (04:45 +0000)]
[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
Michael Liao [Wed, 2 Oct 2019 04:13:17 +0000 (04:13 +0000)]
Fix GCC -Wreturn-type warnings. NFC.
llvm-svn: 373422
Richard Trieu [Wed, 2 Oct 2019 02:32:15 +0000 (02:32 +0000)]
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
David Blaikie [Wed, 2 Oct 2019 01:39:48 +0000 (01:39 +0000)]
DebugInfo: Update support for detecting C++ language variants in debug info emission
llvm-svn: 373420
Nico Weber [Wed, 2 Oct 2019 01:26:46 +0000 (01:26 +0000)]
gn build: (manually) merge r373407
llvm-svn: 373419
Richard Smith [Wed, 2 Oct 2019 01:13:57 +0000 (01:13 +0000)]
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
Matt Arsenault [Wed, 2 Oct 2019 01:02:27 +0000 (01:02 +0000)]
AMDGPU/GlobalISel: Use getIntrinsicID helper
llvm-svn: 373417
John McCall [Wed, 2 Oct 2019 01:02:27 +0000 (01:02 +0000)]
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
Matt Arsenault [Wed, 2 Oct 2019 01:02:24 +0000 (01:02 +0000)]
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
Matt Arsenault [Wed, 2 Oct 2019 01:02:21 +0000 (01:02 +0000)]
AMDGPU/GlobalISel: Private loads always use VGPRs
llvm-svn: 373414
Matt Arsenault [Wed, 2 Oct 2019 01:02:18 +0000 (01:02 +0000)]
AMDGPU/GlobalISel: Legalize 1024-bit G_BUILD_VECTOR
This will be needed to support AGPR operations.
llvm-svn: 373413
Matt Arsenault [Wed, 2 Oct 2019 01:02:14 +0000 (01:02 +0000)]
AMDGPU/GlobalISel: Fix RegBankSelect for 1024-bit values
llvm-svn: 373412
Stanislav Mekhanoshin [Wed, 2 Oct 2019 00:26:58 +0000 (00:26 +0000)]
[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
Michael Liao [Wed, 2 Oct 2019 00:22:45 +0000 (00:22 +0000)]
Fix unused variable warning. NFCI.
llvm-svn: 373410
Adrian Prantl [Wed, 2 Oct 2019 00:06:27 +0000 (00:06 +0000)]
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
Craig Topper [Tue, 1 Oct 2019 23:18:31 +0000 (23:18 +0000)]
[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
John McCall [Tue, 1 Oct 2019 23:13:03 +0000 (23:13 +0000)]
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
John McCall [Tue, 1 Oct 2019 23:12:57 +0000 (23:12 +0000)]
Use scope qualifiers in Clang's tblgen backends to get useful
redeclaration checking. NFC.
llvm-svn: 373406
Dan Liew [Tue, 1 Oct 2019 23:08:18 +0000 (23:08 +0000)]
[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
Changpeng Fang [Tue, 1 Oct 2019 23:07:14 +0000 (23:07 +0000)]
AMDGPU: Fix an out of date assert in addressing FrameIndex
Reviewers:
arsenm
Differential Revision:
https://reviews.llvm.org/D67574
llvm-svn: 373404
Matt Morehouse [Tue, 1 Oct 2019 22:49:06 +0000 (22:49 +0000)]
[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
Sterling Augustine [Tue, 1 Oct 2019 22:42:37 +0000 (22:42 +0000)]
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
Craig Topper [Tue, 1 Oct 2019 22:40:03 +0000 (22:40 +0000)]
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
Jordan Rupprecht [Tue, 1 Oct 2019 22:30:10 +0000 (22:30 +0000)]
[clang][OpenMP][NFC] #include GlobalDecl.h to avoid incomplete class type
llvm-svn: 373400
Jordan Rupprecht [Tue, 1 Oct 2019 22:04:14 +0000 (22:04 +0000)]
[lldb] Fix unused variable warning
llvm-svn: 373399
Simon Pilgrim [Tue, 1 Oct 2019 22:02:46 +0000 (22:02 +0000)]
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
Craig Topper [Tue, 1 Oct 2019 21:55:55 +0000 (21:55 +0000)]
[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
Simon Pilgrim [Tue, 1 Oct 2019 21:50:30 +0000 (21:50 +0000)]
CGExprAgg - remove duplicate code. NFCI.
Remove duplicate getAs<> call, avoiding a clang static analyzer null dereference warning.
llvm-svn: 373396
Thomas Preud'homme [Tue, 1 Oct 2019 21:37:55 +0000 (21:37 +0000)]
[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
Sanjay Patel [Tue, 1 Oct 2019 21:25:36 +0000 (21:25 +0000)]
[BypassSlowDivision][CodeGenPrepare] avoid crashing on unused code (PR43514)
https://bugs.llvm.org/show_bug.cgi?id=43514
llvm-svn: 373394
GN Sync Bot [Tue, 1 Oct 2019 21:23:33 +0000 (21:23 +0000)]
gn build: Merge r373392
llvm-svn: 373393
Stephane Moore [Tue, 1 Oct 2019 21:18:40 +0000 (21:18 +0000)]
[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
Leonard Chan [Tue, 1 Oct 2019 20:49:07 +0000 (20:49 +0000)]
[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
Louis Dionne [Tue, 1 Oct 2019 20:34:50 +0000 (20:34 +0000)]
[NFC] Fix typos in libc++ documentation
llvm-svn: 373390
Leonard Chan [Tue, 1 Oct 2019 20:30:46 +0000 (20:30 +0000)]
[ASan] Make GlobalsMD member a const reference.
PR42924 points out that copying the GlobalsMetadata type during
construction of AddressSanitizer can result in exteremely lengthened
build times for translation units that have many globals. This can be addressed
by just making the GlobalsMD member in AddressSanitizer a reference to
avoid the copy. The GlobalsMetadata type is already passed to the
constructor as a reference anyway.
Differential Revision: https://reviews.llvm.org/D68287
llvm-svn: 373389
Paul Hoad [Tue, 1 Oct 2019 20:20:22 +0000 (20:20 +0000)]
[clang-format] [PR43372] - clang-format shows replacements in DOS files when no replacement is needed
Summary:
This is a patch to fix PR43372 (https://bugs.llvm.org/show_bug.cgi?id=43372) - clang-format can't format file with includes, ( which really keep providing replacements for already sorted headers.)
A similar issue was addressed by @krasimir in {D60199}, however, this seemingly only prevented the issue when the files being formatted did not contain windows line endings (\r\n)
It's possible this is related to https://twitter.com/StephanTLavavej/status/
1176722938243895296 given who @STL_MSFT works for!
As people often used the existence of replacements to determine if a file needs clang-formatting, this is probably pretty important for windows users
There may be a better way of comparing 2 strings and ignoring \r (which appear in both Results and Code), I couldn't choose between this idiom or the copy_if approach, but I'm happy to change it to whatever people consider more performant.
Reviewers: krasimir, klimek, owenpan, ioeric
Reviewed By: krasimir
Subscribers: cfe-commits, STL_MSFT, krasimir
Tags: #clang-format, #clang, #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D68227
llvm-svn: 373388
Alexey Bataev [Tue, 1 Oct 2019 20:18:32 +0000 (20:18 +0000)]
[OPENMP50]Initial codegen for declare variant implementation vendor.
Initial implementation of global aliases emission for the declare
variant pragma with implementation vendor context selector set.
llvm-svn: 373387
Bardia Mahjour [Tue, 1 Oct 2019 19:32:42 +0000 (19:32 +0000)]
[DDG] Data Dependence Graph - Root Node
Summary:
This patch adds Root Node to the DDG. The purpose of the root node is to create a single entry node that allows graph walk iterators to iterate through all nodes of the graph, making sure that no node is left unvisited during a graph walk (eg. SCC or DFS). Once the DDG is fully constructed it will have exactly one root node. Every node in the graph is reachable from the root. The algorithm for connecting the root node is based on depth-first-search that keeps track of visited nodes to try to avoid creating unnecessary edges.
Authored By: bmahjour
Reviewer: Meinersbur, fhahn, myhsu, xtian, dmgreen, kbarton, jdoerfert
Reviewed By: Meinersbur
Subscribers: ychen, arphaman, simoll, a.elovikov, mgorny, hiraditya, jfb, wuzish, llvm-commits, jsji, Whitney, etiotto, ppc-slack
Tag: #llvm
Differential Revision: https://reviews.llvm.org/D67970
llvm-svn: 373386
Louis Dionne [Tue, 1 Oct 2019 19:27:38 +0000 (19:27 +0000)]
[libc++] Re-apply workaround for D63883
In reality, this workaround is for the fact that LIBCXX_CXX_ABI=libcxxabi
can't be specified on Linux, since libc++abi isn't shipped with the system.
Since the build bots explicitly specify LIBCXX_CXX_ABI=libcxxabi, they fail
unless we apply the workaround.
llvm-svn: 373385
Louis Dionne [Tue, 1 Oct 2019 19:13:52 +0000 (19:13 +0000)]
[libc++] Remove workaround for D63883
I tried applying D63883 three times and could never get around to
making it work. I'm giving up on that for now, but soon this should
be irrelevant anyway since all builds will move to the monorepo
(where we're always using the in-tree libc++abi unless explicitly
specified otherwise).
llvm-svn: 373384
Alina Sbirlea [Tue, 1 Oct 2019 19:09:50 +0000 (19:09 +0000)]
[MemorySSA] Check for unreachable blocks when getting last definition.
If a single predecessor is found, still check if the block is
unreachable. The test that found this had a self loop unreachable block.
Resolves PR43493.
llvm-svn: 373383
Jakub Kuderski [Tue, 1 Oct 2019 18:53:54 +0000 (18:53 +0000)]
Add a missing pass in ARM O3 pipeline
llvm-svn: 373382
Louis Dionne [Tue, 1 Oct 2019 18:43:02 +0000 (18:43 +0000)]
[libc++abi] Remove uses of C++ headers when possible
This reduces the (circular) dependency of libc++abi on a C++ standard
library. Outside of the demangler which uses fancier C++ features, the
only C++ headers now required by libc++abi are pretty much <new> and
<exception>, and that's because libc++abi defines some types that are
declared in those headers.
llvm-svn: 373381
Alina Sbirlea [Tue, 1 Oct 2019 18:34:39 +0000 (18:34 +0000)]
[MemorySSA] Update last_access_in_block check.
The check for "was there an access in this block" should be: is the last
access in this block and is it not a newly inserted phi.
Resolves new test in PR43438.
Also fix a typo when simplifying trivial Phis to match the comment.
llvm-svn: 373380
Louis Dionne [Tue, 1 Oct 2019 18:28:20 +0000 (18:28 +0000)]
[NFC][libc++abi] Remove trailing whitespace from sources
llvm-svn: 373379
Jakub Kuderski [Tue, 1 Oct 2019 18:27:44 +0000 (18:27 +0000)]
[Dominators][CodeGen] Don't mark MachineDominatorTree as preserved in MachineLICM
llvm-svn: 373378