Vitaly Buka [Wed, 2 Oct 2019 21:20:37 +0000 (21:20 +0000)]
[compiler-rt] Use GetNextInstructionPc in signal handlers
Summary:
All other stack trace callers assume that PC contains return address.
HWAsan already use GetNextInstructionPc in similar code.
PR43339
Reviewers: eugenis, kcc, jfb
Subscribers: dexonsmith, dberris, #sanitizers, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D68313
llvm-svn: 373529
Vitaly Buka [Wed, 2 Oct 2019 21:20:32 +0000 (21:20 +0000)]
NFC: add namespace {}
llvm-svn: 373528
Daniel Sanders [Wed, 2 Oct 2019 21:13:07 +0000 (21:13 +0000)]
[gicombiner] Add the boring boilerplate for the declarative combiner
Summary:
This is the first of a series of patches extracted from a much bigger WIP
patch. It merely establishes the tblgen pass and the way empty combiner
helpers are declared and integrated into a combiner info.
The tablegen pass takes a -combiners option to select the combiner helper
that will be generated. This can be given multiple values to generate
multiple combiner helpers at once. Doing so helps to minimize parsing
overhead.
The reason for creating a GlobalISel subdirectory in utils/TableGen is that
there will be quite a lot of non-pass files (~15) by the time the patch
series is done.
Reviewers: volkan
Subscribers: mgorny, hiraditya, simoncook, Petar.Avramovic, s.egerton, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68286
llvm-svn: 373527
Simon Pilgrim [Wed, 2 Oct 2019 21:05:21 +0000 (21:05 +0000)]
Fix uninitialized variable warning in CodeGenPGO constructor. NFCI.
llvm-svn: 373526
Simon Pilgrim [Wed, 2 Oct 2019 20:45:16 +0000 (20:45 +0000)]
ItaniumCXXABI - silence static analyzer getAs<RecordType> null dereference warnings. NFCI.
The static analyzer is warning about potential null dereferences, but we should be able to use castAs<RecordType> directly and if not assert will fire for us.
llvm-svn: 373525
Louis Dionne [Wed, 2 Oct 2019 20:45:06 +0000 (20:45 +0000)]
[NFC][libc++abi] Convert stray tabs to spaces
llvm-svn: 373524
Sergey Dmitriev [Wed, 2 Oct 2019 20:44:45 +0000 (20:44 +0000)]
[Clang][Driver][NFC] Corrected DeviceActionBuilder methods' comments.
Differential Revision: https://reviews.llvm.org/D68355
llvm-svn: 373523
Florian Hahn [Wed, 2 Oct 2019 20:40:13 +0000 (20:40 +0000)]
Recommit "[GlobalOpt] Pass DTU to removeUnreachableBlocks instead of recomputing."
The cause for the revert should be fixed by r373513 /
a80b6c15425f82521c624ff24c5c0a34cd534d54
This reverts commit
47dbcbd8ec6bf6c0b9cbe5811e81a37cc55e73ef.
llvm-svn: 373522
Simon Pilgrim [Wed, 2 Oct 2019 20:30:37 +0000 (20:30 +0000)]
CGObjCMac - silence static analyzer dyn_cast<>/getAs<> null dereference warnings. NFCI.
The static analyzer is warning about potential null dereferences, but we should be able to use cast<>/castAs<> directly and if not assert will fire for us.
llvm-svn: 373520
Yi-Hong Lyu [Wed, 2 Oct 2019 20:25:16 +0000 (20:25 +0000)]
[PowerPC] Fix SH field overflow issue
Store rlwinm Rx, Ry, 32, 0, 31 as rlwinm Rx, Ry, 0, 0, 31 and store
rldicl Rx, Ry, 64, 0 as rldicl Rx, Ry, 0, 0. Otherwise SH field is overflow and
fails assertion in assembly printing stage.
Differential Revision: https://reviews.llvm.org/D66991
llvm-svn: 373519
Matt Morehouse [Wed, 2 Oct 2019 20:13:21 +0000 (20:13 +0000)]
[sanitizer_common] Rename OnPrint to __sanitizer_on_print.
Summary:
https://reviews.llvm.org/D28596 exposed OnPrint in the global namespace,
which can cause collisions with user-defined OnPrint() functions.
Reviewers: vitalybuka, dvyukov
Reviewed By: vitalybuka, dvyukov
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67987
llvm-svn: 373518
Louis Dionne [Wed, 2 Oct 2019 20:07:01 +0000 (20:07 +0000)]
[libc++] Use functions instead of global variables to set libc++ build flags
This commit follows the trend of doing things per-target instead of
modifying the C++ flags globally. It does so for visibility-related
flags, other basic build flags and Windows-specific flags.
llvm-svn: 373517
Daniel Sanders [Wed, 2 Oct 2019 19:56:04 +0000 (19:56 +0000)]
Fix inconsistent indentation in TableGen.cpp
The anonymous namespace starts out (incorrectly) indented but isn't
indented from the TimeRegionsOpt declaration onwards.
llvm-svn: 373516
Evgeniy Stepanov [Wed, 2 Oct 2019 19:53:19 +0000 (19:53 +0000)]
Handle llvm.launder.invariant.group in msan.
Summary:
[MSan] handle llvm.launder.invariant.group
Msan used to give false-positives in
class Foo {
public:
virtual ~Foo() {};
};
// Return true iff *x is set.
bool f1(void **x, bool flag);
Foo* f() {
void *p;
bool found;
found = f1(&p,flag);
if (found) {
// p is always set here.
return static_cast<Foo*>(p); // False positive here.
}
return nullptr;
}
Patch by Ilya Tokar.
Reviewers: #sanitizers, eugenis
Reviewed By: #sanitizers, eugenis
Subscribers: eugenis, Prazek, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68236
llvm-svn: 373515
Evandro Menezes [Wed, 2 Oct 2019 19:44:53 +0000 (19:44 +0000)]
[TableGen] Improve error reporting of overlapping definitions (NFC)
llvm-svn: 373514
Florian Hahn [Wed, 2 Oct 2019 19:38:24 +0000 (19:38 +0000)]
[Local] Handle terminators with users in removeUnreachableBlocks.
Terminators like invoke can have users outside the current basic block.
We have to replace those users with undef, before replacing the
terminator.
This fixes a crash exposed by rL373430.
Reviewers: brzycki, asbirlea, davide, spatel
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D68327
llvm-svn: 373513
Louis Dionne [Wed, 2 Oct 2019 19:31:30 +0000 (19:31 +0000)]
[libc++] Use a function to set warning flags per target
This is part of a larger shift to move to per-target settings and
eradicate global variables from the CMake build. I'm starting small
with warnings only because those are easy to transition over and I
want to see how it pans out, but we can handle all flags like exceptions
and RTTI in the future.
llvm-svn: 373511
Davide Italiano [Wed, 2 Oct 2019 19:20:24 +0000 (19:20 +0000)]
[ARM64] XPC services are unsupported on device.
While around, clean up support for a 8 years old OS.
<rdar://problem/
55916729>
llvm-svn: 373510
Davide Italiano [Wed, 2 Oct 2019 19:20:21 +0000 (19:20 +0000)]
[RegisterContextDarwin_arm64] Include the headers for getsysctlbyname.
This code is only used under __arm64__, use the correct guard.
<rdar://problem/
55916729>
llvm-svn: 373509
Davide Italiano [Wed, 2 Oct 2019 19:20:18 +0000 (19:20 +0000)]
[ObjectFileMachO] FileSpec::SetFile() now takes the style as arg.
Another block that's only compiled on __arm64__ and wasn't
updated.
<rdar://problem/
55916729>
llvm-svn: 373508
Davide Italiano [Wed, 2 Oct 2019 19:20:15 +0000 (19:20 +0000)]
[ObjectFileMachO] Catch up with FileDesc changes.
This didn't show up because nobody built __arm64__ in a while.
<rdar://problem/
55916729>
llvm-svn: 373507
Louis Dionne [Wed, 2 Oct 2019 19:11:08 +0000 (19:11 +0000)]
[libc++] Revert to using PUBLIC instead of PRIVATE when linking system libs
It turns out the benchmarks need to link against those libraries
explicitly too, so CMake's propagation of PUBLIC dependencies is
used.
llvm-svn: 373506
Alina Sbirlea [Wed, 2 Oct 2019 18:42:33 +0000 (18:42 +0000)]
[MemorySSA] Update Phi creation when inserting a Def.
MemoryPhis should be added in the IDF of the blocks newly gaining Defs.
This includes the blocks that gained a Phi and the block gaining a Def,
if the block did not have one before.
Resolves PR43427.
llvm-svn: 373505
Benjamin Kramer [Wed, 2 Oct 2019 18:33:44 +0000 (18:33 +0000)]
[Stencil] Hide implementaion detai. NFC.
llvm-svn: 373504
Benjamin Kramer [Wed, 2 Oct 2019 18:20:24 +0000 (18:20 +0000)]
[ARM] Make helpers static. NFC.
llvm-svn: 373503
Alexey Bataev [Wed, 2 Oct 2019 18:19:02 +0000 (18:19 +0000)]
[OPENMP50]Add parsing/sema analysis for declare variant score.
Context selectors may include optional score clause in format
`score(<expr>):`, where `<expr>` must be a constant integer expression.
Added parsing/sema analysis only.
llvm-svn: 373502
Jonas Devlieghere [Wed, 2 Oct 2019 18:02:36 +0000 (18:02 +0000)]
[JSON] Remove Utility/JSON.{h|cpp}
This patch is the final step in my quest to get rid of the JSON parser
in LLDB. Vedant's coverage report [1] shows that it was mostly untested.
Furthermore, the LLVM implementation has a much nicer API and using it
means one less thing to maintain for LLDB.
[1] http://lab.llvm.org:8080/coverage/coverage-reports/index.html
Differential revision: https://reviews.llvm.org/D68305
llvm-svn: 373501
Jonas Devlieghere [Wed, 2 Oct 2019 18:02:32 +0000 (18:02 +0000)]
[JSON] Use LLVM's library for encoding JSON in GDBRemoteCommunicationServerCommon
This patch replaces the LLDB's JSON implementation with the one from
LLVM in GDBRemoteCommunicationServerCommon.
Differential revision: https://reviews.llvm.org/D68304
llvm-svn: 373500
Jonas Devlieghere [Wed, 2 Oct 2019 18:02:29 +0000 (18:02 +0000)]
[JSON] Use LLVM's library for encoding JSON in GDBRemoteCommunicationServerPlatform
This patch replaces the LLDB's JSON implementation with the one from
LLVM in GDBRemoteCommunicationServerPlatform.
Differential revision: https://reviews.llvm.org/D68302
llvm-svn: 373499
Jonas Devlieghere [Wed, 2 Oct 2019 18:02:26 +0000 (18:02 +0000)]
[JSON] Use LLVM's library for encoding JSON in GDBRemoteCommunicationClient
This patch replaces the LLDB's JSON implementation with the one from
LLVM in GDBRemoteCommunicationClient.
Differential revision: https://reviews.llvm.org/D68301
llvm-svn: 373498
Jonas Devlieghere [Wed, 2 Oct 2019 18:02:23 +0000 (18:02 +0000)]
[JSON] Use LLVM's library for encoding JSON in GDBRemoteCommunicationServerLLGS
This patch replaces the LLDB's JSON implementation with the one from
LLVM in GDBRemoteCommunicationServerLLGS.
Differential revision: https://reviews.llvm.org/D68299
llvm-svn: 373497
Craig Topper [Wed, 2 Oct 2019 17:47:09 +0000 (17:47 +0000)]
[X86] Rewrite to the vXi1 subvector insertion code to not rely on the value of bits that might be undef
The previous code tried to do a trick where we would extract the subvector from the location we were inserting. Then xor that with the new value. Take the xored value and clear out the bits above the subvector size. Then shift that xored subvector to the insert location. And finally xor that with the original vector. Since the old subvector was used in both xors, this would leave just the new subvector at the inserted location. Since the surrounding bits had been zeroed no other bits of the original vector would be modified.
Unfortunately, if the old subvector came from undef we might aggressively propagate the undef. Then we end up with the XORs not cancelling because they aren't using the same value for the two uses of the old subvector. @bkramer gave me a case that demonstrated this, but we haven't reduced it enough to make it easily readable to see what's happening.
This patch uses a safer, but more costly approach. It isolate the bits above the insertion and bits below the insert point and ORs those together leaving 0 for the insertion location. Then widens the subvector with 0s in the upper bits, shifts it into position with 0s in the lower bits. Then we do another OR.
Differential Revision: https://reviews.llvm.org/D68311
llvm-svn: 373495
Aditya Kumar [Wed, 2 Oct 2019 17:35:06 +0000 (17:35 +0000)]
Fix: Actually erase remove the elements from AssumeHandles
Reviewers: sdmitriev, tejohnson
Reviewed by: tejohnson
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68318
llvm-svn: 373494
Thomas Lively [Wed, 2 Oct 2019 17:34:44 +0000 (17:34 +0000)]
[WebAssembly] Error when using wasm64 for ISel
Summary:
64-bit WebAssembly (wasm64) is not specified and not supported in the
WebAssembly backend. We do have support for it in clang, however, and
we would like to keep that support because we expect wasm64 to be
specified and supported in the future. For now add an error when
trying to use wasm64 from the backend to minimize user confusion from
unexplained crashes.
Reviewers: aheejin, dschuff, sunfish
Subscribers: sbc100, jgravelle-google, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68254
llvm-svn: 373493
GN Sync Bot [Wed, 2 Oct 2019 17:23:41 +0000 (17:23 +0000)]
gn build: Merge r373489
llvm-svn: 373492
Piotr Sobczak [Wed, 2 Oct 2019 17:22:36 +0000 (17:22 +0000)]
[AMDGPU] Extend buffer intrinsics with swizzling
Summary:
Extend cachepolicy operand in the new VMEM buffer intrinsics
to supply information whether the buffer data is swizzled.
Also, propagate this information to MIR.
Intrinsics updated:
int_amdgcn_raw_buffer_load
int_amdgcn_raw_buffer_load_format
int_amdgcn_raw_buffer_store
int_amdgcn_raw_buffer_store_format
int_amdgcn_raw_tbuffer_load
int_amdgcn_raw_tbuffer_store
int_amdgcn_struct_buffer_load
int_amdgcn_struct_buffer_load_format
int_amdgcn_struct_buffer_store
int_amdgcn_struct_buffer_store_format
int_amdgcn_struct_tbuffer_load
int_amdgcn_struct_tbuffer_store
Furthermore, disable merging of VMEM buffer instructions
in SI Load/Store optimizer, if the "swizzled" bit on the instruction
is on.
The default value of the bit is 0, meaning that data in buffer
is linear and buffer instructions can be merged.
There is no difference in the generated code with this commit.
However, in the future it will be expected that front-ends
use buffer intrinsics with correct "swizzled" bit set.
Reviewers: arsenm, nhaehnle, tpr
Reviewed By: nhaehnle
Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, arphaman, jfb, Petar.Avramovic, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68200
llvm-svn: 373491
Aaron Ballman [Wed, 2 Oct 2019 17:18:57 +0000 (17:18 +0000)]
Add the misc-init-local-variables check.
This checks finds all primitive type local variables (integers, doubles, pointers) that are declared without an initial value. Includes fixit functionality to initialize said variables with a default value. This is zero for most types and NaN for floating point types. The use of NaNs is copied from the D programming language.
Patch by Jussi Pakkanen.
llvm-svn: 373489
Florian Hahn [Wed, 2 Oct 2019 16:58:13 +0000 (16:58 +0000)]
[Local] Remove unused LazyValueInfo pointer from removeUnreachableBlock.
There are no users that pass in LazyValueInfo, so we can simplify the
function a bit.
Reviewers: brzycki, asbirlea, davide
Reviewed By: davide
Differential Revision: https://reviews.llvm.org/D68297
llvm-svn: 373488
Louis Dionne [Wed, 2 Oct 2019 16:51:42 +0000 (16:51 +0000)]
[libc++] Use PRIVATE instead of PUBLIC when linking against system libs
llvm-svn: 373487
Teresa Johnson [Wed, 2 Oct 2019 16:36:59 +0000 (16:36 +0000)]
[ThinLTO/WPD] Ensure devirtualized targets use promoted symbol when necessary
Summary:
This fixes a hole in the handling of devirtualized targets that were
local but need promoting due to devirtualization in another module. We
were not correctly referencing the promoted symbol in some cases. Make
sure the code that updates the name also looks at the ExportedGUIDs set
by utilizing a callback that checks all conditions (the callback
utilized by the internalization/promotion code).
Reviewers: pcc, davidxl, hiraditya
Subscribers: mehdi_amini, Prazek, inglorion, steven_wu, dexonsmith, dang, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68159
llvm-svn: 373485
Simon Pilgrim [Wed, 2 Oct 2019 16:20:28 +0000 (16:20 +0000)]
[CodeGen] Remove unused MachineMemOperand::print wrappers (PR41772)
As noted on PR41772, the static analyzer reports that the MachineMemOperand::print partial wrappers set a number of args to null pointers that were then dereferenced in the actual implementation.
It turns out that these wrappers are not being used at all (hence why we're not seeing any crashes), so I'd like to propose we just get rid of them.
Differential Revision: https://reviews.llvm.org/D68208
llvm-svn: 373484
Sanjay Patel [Wed, 2 Oct 2019 16:12:42 +0000 (16:12 +0000)]
[SLP] add test for vectorization of different widths (PR28457); NFC
llvm-svn: 373483
Michal Gorny [Wed, 2 Oct 2019 16:06:50 +0000 (16:06 +0000)]
[llvm] [cmake] Add install targets for missing distribution components
Add install targets as necessary to include all files normally installed
in LLVM_DISTRIBUTION_COMPONENTS. This includes targets for Sphinx docs,
opt-viewer Python modules and TableGens.
Differential Revision: https://reviews.llvm.org/D68339
llvm-svn: 373482
Simon Pilgrim [Wed, 2 Oct 2019 16:03:45 +0000 (16:03 +0000)]
LowerExpectIntrinsic handlePhiDef - silence static analyzer dyn_cast<PHINode> null dereference warning. NFCI.
The static analyzer is warning about a potential null dereference, but we should be able to use cast<PHINode> directly and if not assert will fire for us.
llvm-svn: 373481
Simon Pilgrim [Wed, 2 Oct 2019 16:03:36 +0000 (16:03 +0000)]
Type - 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: 373480
Aditya Kumar [Wed, 2 Oct 2019 15:36:39 +0000 (15:36 +0000)]
[CodeExtractor] NFC: Refactor sanity checks into isEligible
Reviewers: fhahn
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68331
llvm-svn: 373479
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