Jonathan Peyton [Fri, 24 Aug 2018 18:03:27 +0000 (18:03 +0000)]
[OpenMP] Fix incorrect barrier imbalance reporting in ITTNOTIFY
Exclude nested explicit tasks from timing, only outer level explicit task
counted and its time added to barrier arrive time for the thread.
Differential Revision: https://reviews.llvm.org/D50584
llvm-svn: 340628
Raphael Isemann [Fri, 24 Aug 2018 18:01:56 +0000 (18:01 +0000)]
[ASTImporter] Add test for PackExpansionExpr
Reviewers: a.sidorin, a_sidorin
Reviewed By: a_sidorin
Subscribers: martong, cfe-commits
Differential Revision: https://reviews.llvm.org/D51142
llvm-svn: 340627
Craig Topper [Fri, 24 Aug 2018 17:48:25 +0000 (17:48 +0000)]
[DAGCombiner][Mips] Don't combine bitcast+store after LegalOperations when the store is volatile, if the resulting store isn't Legal
Previously we allowed the store to be Custom. But without knowing for sure that the Custom handling won't split the store, we shouldn't convert a volatile store. We also probably shouldn't be creating a store the requires custom handling after LegalizeOps. This could lead to an infinite loop if the custom handling was to insert a bitcast. Though I guess isStoreBitCastBeneficial could be used to block such a loop.
The test changes here are due to the volatile part of this. The stores in the test are all volatile and i32 stores are marked custom, So we are no longer converting them
This is related to D50491 where I was trying to allow some bitcasting of volatile loads
Differential Revision: https://reviews.llvm.org/D50578
llvm-svn: 340626
Stefan Pintilie [Fri, 24 Aug 2018 17:27:35 +0000 (17:27 +0000)]
Revert "[Exception Handling] Unwind tables are required for all functions that have an EH personality."
This reverts commit rL340614.
Previous commit broke some llvm-cfi-verify tests.
llvm-svn: 340625
Jonas Toth [Fri, 24 Aug 2018 17:25:06 +0000 (17:25 +0000)]
[clang-format] fix PR38557 - comments between "default" and ':' causes the case label to be treated as an identifier
Summary:
The Bug was reported and fixed by Owen Pan. See the original bug report here: https://bugs.llvm.org/show_bug.cgi?id=38557
Patch by Owen Pan!
Reviewers: krasimir, djasper, klimek
Reviewed By: klimek
Subscribers: JonasToth, cfe-commits
Differential Revision: https://reviews.llvm.org/D50697
llvm-svn: 340624
Jonas Toth [Fri, 24 Aug 2018 17:14:31 +0000 (17:14 +0000)]
[clang-format] fix PR38525 - Extraneous continuation indent spaces with BreakBeforeBinaryOperators set to All
Summary: See bug report https://bugs.llvm.org/show_bug.cgi?id=38525 for more details.
Reviewers: djasper, klimek, krasimir, sammccall
Reviewed By: sammccall
Subscribers: hiraditya, JonasToth, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D50699
llvm-svn: 340623
Krzysztof Parzyszek [Fri, 24 Aug 2018 17:13:42 +0000 (17:13 +0000)]
[Hexagon] Remove unneeded strings from builtin definitions, NFC
llvm-svn: 340622
David Carlier [Fri, 24 Aug 2018 16:53:06 +0000 (16:53 +0000)]
[Sanitizer] implementing remaining function under OSX
- GetRandom and GetnumberOfCPUs using sys call for the former.
- enabling unit tests for the other oses.
Reviewers: kubamracek
Reviewed By: kubamracek
Differential Revision: https://reviews.llvm.org/D50937
llvm-svn: 340621
Julie Hockett [Fri, 24 Aug 2018 16:43:46 +0000 (16:43 +0000)]
[clang-doc] Fix memory leaks
Adds a virtual destructor to the base Info class.
Differential Revision: https://reviews.llvm.org/D51137
llvm-svn: 340620
David Bolvansky [Fri, 24 Aug 2018 16:39:41 +0000 (16:39 +0000)]
Revert [Inliner] Attribute callsites with inline remarks
llvm-svn: 340619
David Bolvansky [Fri, 24 Aug 2018 16:28:36 +0000 (16:28 +0000)]
[Inliner] Attribute callsites with inline remarks
Summary:
Sometimes reading an output *.ll file it is not easy to understand why some callsites are not inlined. We can read output of inline remarks (option --pass-remarks-missed=inline) and try correlating its messages with the callsites.
An easier way proposed by this patch is to add to every callsite processed by Inliner an attribute with the latest message that describes the cause of not inlining this callsite. The attribute is called //inline-remark//. By default this feature is off. It can be switched on by the option //-inline-remark-attribute//.
For example in the provided test the result method //@test1// has two callsites //@bar// and inline remarks report different inlining missed reasons:
remark: <unknown>:0:0: bar not inlined into test1 because too costly to inline (cost=-5, threshold=-6)
remark: <unknown>:0:0: bar not inlined into test1 because it should never be inlined (cost=never): recursive
It is not clear which remark correspond to which callsite. With the inline remark attribute enabled we get the reasons attached to their callsites:
define void @test1() {
call void @bar(i1 true) #0
call void @bar(i1 false) #2
ret void
}
attributes #0 = { "inline-remark"="(cost=-5, threshold=-6)" }
..
attributes #2 = { "inline-remark"="(cost=never): recursive" }
Patch by: yrouban (Yevgeny Rouban)
Reviewers: xbolva00, tejohnson, apilipenko
Reviewed By: xbolva00, tejohnson
Subscribers: eraman, llvm-commits
Differential Revision: https://reviews.llvm.org/D50435
llvm-svn: 340618
Philip Reames [Fri, 24 Aug 2018 16:24:48 +0000 (16:24 +0000)]
[LICM] Hoist an invariant_start out of loops if there are no stores executed before it
Once the invariant_start is reached, we know that no instruction *after* it can modify the memory. So, if we can prove the location isn't read *between entry into the loop and the execution of the invariant_start*, we can execute the invariant_start before entering the loop.
Differential Revision: https://reviews.llvm.org/D51181
llvm-svn: 340617
Joel Galenson [Fri, 24 Aug 2018 16:22:42 +0000 (16:22 +0000)]
Modify tests to show PLT entry labels
llvm-svn: 340616
Joel Galenson [Fri, 24 Aug 2018 16:15:44 +0000 (16:15 +0000)]
Add missing override keyword (NFC)
llvm-svn: 340615
Stefan Pintilie [Fri, 24 Aug 2018 15:51:47 +0000 (15:51 +0000)]
[Exception Handling] Unwind tables are required for all functions that have an EH personality.
This patch is for defect:
https://bugs.llvm.org/show_bug.cgi?id=32611
Functions may require unwind tables even if they are marked with the attribute
nounwind. Any function with an EH personality may require an unwind table.
Differential Revision: https://reviews.llvm.org/D50987
llvm-svn: 340614
John Brawn [Fri, 24 Aug 2018 15:48:30 +0000 (15:48 +0000)]
[PhiValues] Use callback value handles to invalidate deleted values
The way that PhiValues is integrated with BasicAA it is possible for a pass
which uses BasicAA to pick up an instance of BasicAA that uses PhiValues without
intending to, and then delete values from a function in a way that causes
PhiValues to return dangling pointers to these deleted values. Fix this by
having a set of callback value handles to invalidate values when they're
deleted.
llvm-svn: 340613
Joel Galenson [Fri, 24 Aug 2018 15:21:58 +0000 (15:21 +0000)]
[cfi-verify] Support cross-DSO
When used in cross-DSO mode, CFI will generate calls to special functions rather than trap instructions. For example, instead of generating
if (!InlinedFastCheck(f))
abort();
call *f
CFI generates
if (!InlinedFastCheck(f))
__cfi_slowpath(CallSiteTypeId, f);
call *f
This patch teaches cfi-verify to recognize calls to __cfi_slowpath and abort and treat them as trap functions.
In addition to normal symbols, we also parse the dynamic relocations to handle cross-DSO calls in libraries.
We also extend cfi-verify to recognize other patterns that occur using cross-DSO. For example, some indirect calls are not guarded by a branch to a trap but instead follow a call to __cfi_slowpath. For example:
if (!InlinedFastCheck(f))
call *f
else {
__cfi_slowpath(CallSiteTypeId, f);
call *f
}
In this case, the second call to f is not marked as protected by the current code. We thus recognize if indirect calls directly follow a call to a function that will trap on CFI violations and treat them as protected.
We also ignore indirect calls in the PLT, since on AArch64 each entry contains an indirect call that should not be protected by CFI, and these are labeled incorrectly when debug information is not present.
Differential Revision: https://reviews.llvm.org/D49383
llvm-svn: 340612
Joel Galenson [Fri, 24 Aug 2018 15:21:57 +0000 (15:21 +0000)]
[llvm-objdump] Label calls to the PLT.
Differential Revision: https://reviews.llvm.org/D50204
llvm-svn: 340611
Joel Galenson [Fri, 24 Aug 2018 15:21:56 +0000 (15:21 +0000)]
Find PLT entries for x86, x86_64, and AArch64.
This adds a new method to ELFObjectFileBase that returns the symbols and addresses of PLT entries.
This design was suggested by pcc and eugenis in https://reviews.llvm.org/D49383.
Differential Revision: https://reviews.llvm.org/D50203
llvm-svn: 340610
Louis Dionne [Fri, 24 Aug 2018 14:10:28 +0000 (14:10 +0000)]
[libc++] Fix handling of negated character classes in regex
Summary:
This commit fixes a regression introduced in r316095, where we don't match
inverted character classes when there's no negated characrers in the []'s.
rdar://problem/
43060054
Reviewers: mclow.lists, timshen, EricWF
Subscribers: christof, dexonsmith, cfe-commits
Differential Revision: https://reviews.llvm.org/D50534
llvm-svn: 340609
Louis Dionne [Fri, 24 Aug 2018 14:00:59 +0000 (14:00 +0000)]
[libc++] Remove race condition in std::async
Summary:
The state associated to the future was set in one thread (with synchronization)
but read in another thread without synchronization, which led to a data race.
https://bugs.llvm.org/show_bug.cgi?id=38181
rdar://problem/
42548261
Reviewers: mclow.lists, EricWF
Subscribers: christof, dexonsmith, cfe-commits
Differential Revision: https://reviews.llvm.org/D51170
llvm-svn: 340608
Kadir Cetinkaya [Fri, 24 Aug 2018 13:09:41 +0000 (13:09 +0000)]
[clangd] Initial cancellation mechanism for LSP requests.
Reviewers: ilya-biryukov, ioeric, hokein
Reviewed By: ilya-biryukov
Subscribers: mgorny, ioeric, MaskRay, jkorous, arphaman, jfb, cfe-commits
Differential Revision: https://reviews.llvm.org/D50502
llvm-svn: 340607
Florian Hahn [Fri, 24 Aug 2018 11:40:04 +0000 (11:40 +0000)]
[Local] Make DoesKMove required for combineMetadata.
This patch makes the DoesKMove argument non-optional, to force people
to think about it. Most cases where it is false are either code hoisting
or code sinking, where we pick one instruction from a set of
equal instructions among different code paths.
Reviewers: dberlin, nlopes, efriedma, davide
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D47475
llvm-svn: 340606
Kirill Bobyrev [Fri, 24 Aug 2018 11:25:43 +0000 (11:25 +0000)]
[clangd] Implement LIMIT iterator
This patch introduces LIMIT iterator, which is very important for
improving the quality of search query. LIMIT iterators can be applied on
top of BOOST iterators to prevent populating query request with a huge
number of low-quality symbols.
Reviewed by: sammccall
Differential Revision: https://reviews.llvm.org/D51029
llvm-svn: 340605
Eric Liu [Fri, 24 Aug 2018 11:23:56 +0000 (11:23 +0000)]
[clangd] Speculative code completion index request before Sema is run.
Summary:
For index-based code completion, send an asynchronous speculative index
request, based on the index request for the last code completion on the same
file and the filter text typed before the cursor, before sema code completion
is invoked. This can reduce the code completion latency (by roughly latency of
sema code completion) if the speculative request is the same as the one
generated for the ongoing code completion from sema. As a sequence of code
completions often have the same scopes and proximity paths etc, this should be
effective for a number of code completions.
Trace with speculative index request:{
F6997544}
Reviewers: hokein, ilya-biryukov
Reviewed By: ilya-biryukov
Subscribers: javed.absar, jfb, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D50962
llvm-svn: 340604
Dean Michael Berris [Fri, 24 Aug 2018 10:30:37 +0000 (10:30 +0000)]
[XRay] Refactor loadTraceFile(...) into two (NFC)
This patch splits the file trace loading function into two versions, one
that takes a filename and one that takes a `DataExtractor`.
This change is a precursor to larger changes to increase test coverage
for the trace loading implementation.
llvm-svn: 340603
Eric Liu [Fri, 24 Aug 2018 09:53:44 +0000 (09:53 +0000)]
Fix build bot after r340598.
Revert to the original behavior: only calculate real file path when
file is opened and avoid using InterndPath for real path calculation.
llvm-svn: 340602
Kirill Bobyrev [Fri, 24 Aug 2018 09:12:54 +0000 (09:12 +0000)]
[clangd] Log memory usage of DexIndex and MemIndex
This patch prints information about built index size estimation to
verbose logs. This is useful for optimizing memory usage of DexIndex and
comparisons with MemIndex.
Reviewed by: sammccall
Differential Revision: https://reviews.llvm.org/D51154
llvm-svn: 340601
Ilya Biryukov [Fri, 24 Aug 2018 09:03:54 +0000 (09:03 +0000)]
[clangd] Allow to merge symbols on-the-fly in global-symbol-builder
Summary:
The new mode avoids serializing and deserializing YAML.
This results in better performance and less memory usage. Reduce phase
is now almost instant.
The default is to use the old mode going through YAML serialization to
allow migrating MapReduce clients that require the old mode to operate
properly. After we migrate the clients, we can switch the default to
the new mode.
Reviewers: hokein, ioeric, kbobyrev, sammccall
Reviewed By: ioeric
Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D51155
llvm-svn: 340600
Ilya Biryukov [Fri, 24 Aug 2018 09:03:29 +0000 (09:03 +0000)]
[Tooling] Add a isSingleProcess() helper to ToolExecutor
Summary:
Used in clangd's symbol builder to optimize for the common
shared-memory executor case.
Reviewers: ioeric
Reviewed By: ioeric
Subscribers: kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D51164
llvm-svn: 340599
Eric Liu [Fri, 24 Aug 2018 08:59:54 +0000 (08:59 +0000)]
[FileManager] Do not call 'real_path' in getFile().
Summary:
This partially rolls back the change in D48903:
https://github.com/llvm-mirror/clang/commit/
89aa7f45a1f728144935289d4ce69d8522999de0#diff-0025af005307891b5429b6a834823d5eR318
`real_path` can be very expensive on real file systems, and calling it on each
opened file can slow down the compilation. This also slows down deserialized
ASTs for which real paths need to be recalculated for each input files again.
For clangd code completion latency (using preamble):
Before
{
F7039629}
After
{
F7039630}
Reviewers: ilya-biryukov, simark
Reviewed By: ilya-biryukov
Subscribers: kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D51159
llvm-svn: 340598
Aleksandr Urakov [Fri, 24 Aug 2018 07:24:52 +0000 (07:24 +0000)]
[PDB] Make variables.test to pass using a 32-bit compiler too
Summary:
`variables.test` depends on mangled names, but the mangling depends
on the bitness. This patch specifies the bitness explicitly, so mangled names
doesn't differ when a 32-bit version of the compiler is used.
Reviewers: stella.stamenova, asmith
Reviewed By: stella.stamenova
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D51158
llvm-svn: 340597
Chandler Carruth [Fri, 24 Aug 2018 04:45:04 +0000 (04:45 +0000)]
[AVR] Fix inline asm calls now that the addrspace(0) there is explicit.
This updates the test case for r340519 so it should pass again. r340522
only got some of the AVR tests that needed an update.
llvm-svn: 340596
Kito Cheng [Fri, 24 Aug 2018 03:05:08 +0000 (03:05 +0000)]
[RISCV] RISC-V using -fuse-init-array by default
Reviewers: asb, apazos, mgrang
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D50043
llvm-svn: 340595
Justin Bogner [Fri, 24 Aug 2018 02:42:24 +0000 (02:42 +0000)]
[SDAG] Add versions of computeKnownBits that return a value
Having the KnownBits as an output parameter is kind of awkward to use
and a holdover from when it was two separate APInts. Instead, just
return a KnownBits object.
I'm leaving the existing interface in place for now, since updating
the callers all at once would be thousands of lines of diff.
llvm-svn: 340594
Kostya Serebryany [Fri, 24 Aug 2018 01:44:17 +0000 (01:44 +0000)]
[hwasan] implement detection of realloc-after-free
llvm-svn: 340593
Richard Smith [Fri, 24 Aug 2018 01:34:45 +0000 (01:34 +0000)]
Make llvm-profdata show -text work as advertised in the documentation.
Per LLVM's CommandGuide, llvm-profdata show -text is supposed to produce
textual output that can be passed as input to further llvm-profdata
invocations. This previously didn't work for two reasons:
1) -text was not sufficient to enable the machine-readable text format output;
instead, -text was effectively ignored if -counts was not also specified. (With
this patch, -counts is instead ignored if -text is specified, because the
machine-readable text format always includes counts.)
2) When the input data was an IR-level profile, the :ir marker was missing from
the output, resulting in a text format output that would not be usable as
profiling data due to function hash mismatches.
Differential Revision: https://reviews.llvm.org/D51188
llvm-svn: 340592
Kostya Serebryany [Fri, 24 Aug 2018 01:12:26 +0000 (01:12 +0000)]
[hwasan] implement detection of double-free (invalid-free)
llvm-svn: 340591
Nico Weber [Fri, 24 Aug 2018 00:12:58 +0000 (00:12 +0000)]
Attempt to fix ELF/lto-plugin-ignore.s on Windows after r340487.
I removed the ".exe" regex in the wrong place. lld-link in front of the
"error:" no longer has the suffix; the --plugin-opt diagnostic still has it.
llvm-svn: 340590
Raphael Isemann [Thu, 23 Aug 2018 23:21:52 +0000 (23:21 +0000)]
Add more pre-run asserts for the DirCompletionAbsolute test
Summary:
The DirCompletionAbsolute is still randomly failing on the nodes even after D50722, so this patch adds more asserts
that verify certain properties on which the actual completion implementation relies on.
The first assert checks that the directory we complete on actually exists. If the directory doesn't exist on the
next CI failure, this assert should catch it and we know that the 0 matches come from a missing base directory.
The second assert is just checking that we are below the PATH_MAX limit that the completion checks against.
This check could randomly fail if the temporary directories we generate are sometimes longer than PATH_MAX,
and the assert can tell us that this is the reason we failed (instead of the mysterious '0 matches').
(As a sidenote: We shouldn't be checking against PATH_MAX anyway in the code (as this is just wrong). Also
the disk completion API really needs a better error mechanism than returning 0 on both error or no-results.)
Reviewers: aprantl, friss
Reviewed By: aprantl
Subscribers: abidh
Differential Revision: https://reviews.llvm.org/D51111
llvm-svn: 340589
Reid Kleckner [Thu, 23 Aug 2018 22:58:56 +0000 (22:58 +0000)]
Make LLVM_ENABLE_CRASH_DUMPS set a variable default
That way users can set the default to true, but then disable core dumps
from certain apps that link support.
llvm-svn: 340588
Kuba Mracek [Thu, 23 Aug 2018 22:55:58 +0000 (22:55 +0000)]
[sanitizer] Don't call task_for_pid(mach_task_self). NFC.
Calling task_for_pid with mach_task_self is just returning mach_task_self anyway, but it also triggers system warnings (task_for_pid is only supposed to be used by high-privileged executables). NFC.
rdar://problem/
39198248
Differential Revision: https://reviews.llvm.org/D51119
llvm-svn: 340587
Stephen Kelly [Thu, 23 Aug 2018 22:41:52 +0000 (22:41 +0000)]
Fix typo
llvm-svn: 340586
Raphael Isemann [Thu, 23 Aug 2018 22:40:54 +0000 (22:40 +0000)]
Reuse the SelectorTable from Clang's Preprocessor
Summary:
At the moment we create our own SelectorTable even though the Preprocessor always
creates one for us that we can (and should) reuse.
Reviewers: vsk
Reviewed By: vsk
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D51185
llvm-svn: 340585
David Blaikie [Thu, 23 Aug 2018 22:35:58 +0000 (22:35 +0000)]
DebugInfo: Improve debug location merging
Fix a set of related bugs:
* Considering two locations as equivalent when their lines are the same
but their scopes are different causes erroneous debug info that
attributes a commoned call to be attributed to one of the two calls it
was commoned from.
* The previous code to compute a new location's scope was inaccurate and
would use the inlinedAt that was the /parent/ of the inlinedAt that is
the nearest common one, and also used that parent scope instead of the
nearest common scope.
* Not generating new locations generally seemed like a lower quality
choice
There was some risk that generating more new locations could hurt object
size by making more fine grained line table entries, but it looks like
that was offset by the decrease in line table (& address & ranges) size
caused by more accurately computing the scope - which likely lead to
fewer range entries (more contiguous ranges) & reduced size that way.
All up with these changes I saw minor reductions (-1.21%, -1.77%) in
.rela.debug_ranges and .rela.debug_addr (in a fission, compressed debug
info build) as well as other minor size changes (generally reductinos)
across the board (-1.32% debug_info.dwo, -1.28% debug_loc.dwo). Measured
in an optimized (-O2) build of the clang binary.
If you are investigating a size regression in an optimized debug builds,
this is certainly a patch to look into - and I'd be happy to look into
any major regressions found & see what we can do to address them.
llvm-svn: 340583
Alina Sbirlea [Thu, 23 Aug 2018 21:56:30 +0000 (21:56 +0000)]
[IDF] Make GraphDiff a const constructor argument.
llvm-svn: 340581
Aaron Puchert [Thu, 23 Aug 2018 21:53:04 +0000 (21:53 +0000)]
Remove more const_casts by using ConstStmtVisitor [NFC]
Again, this required adding some const specifiers.
llvm-svn: 340580
Peter Collingbourne [Thu, 23 Aug 2018 21:34:57 +0000 (21:34 +0000)]
Revert r340552, "Driver: Enable address-significance tables by default when targeting COFF."
Received multiple reports of breakage due to undefined symbols
suspected to be caused by this change.
llvm-svn: 340579
Leonard Mosescu [Thu, 23 Aug 2018 21:34:33 +0000 (21:34 +0000)]
Restrict the set of plugins used for ProcessMinidump
1. The dynamic loaders should not be needed for loading minidumps
and they may create problems (ex. the macOS loader resets the list of
loaded sections, which for minidumps are already set up during minidump loading)
2. In general, the extra plugins can do extraneous work which hurts performance
(ex. trying to set up implicit symbolic breakpoints, which in turn will trigger
extra debug information loading)
Differential Revision: https://reviews.llvm.org/D51176
llvm-svn: 340578
George Burgess IV [Thu, 23 Aug 2018 21:29:11 +0000 (21:29 +0000)]
[MemorySSA] Fix def optimization handling
In order for more complex updates of MSSA to happen (e.g. those in
D45299), MemoryDefs need to be actual `Use`s of what they're optimized
to. This patch makes that happen.
In addition, this patch changes our optimization behavior for Defs
slightly: we'll now consider a Def optimization invalid if the
MemoryAccess it's optimized to changes. That we weren't doing this
before was a bug, but given that we were tracking these with a WeakVH
before, it was sort of difficult for that to matter.
We're already have both of these behaviors for MemoryUses. The
difference is that a MemoryUse's defining access is always its optimized
access, and defining accesses are always `Use`s (in the LLVM sense).
Nothing exploded when testing a stage3 clang+llvm locally, so...
This also includes the test-case promised in r340461.
llvm-svn: 340577
Kostya Kortchinsky [Thu, 23 Aug 2018 21:13:39 +0000 (21:13 +0000)]
[sanitizer] Change Mmap*NoAccess to return nullptr on error
Summary:
`MmapNoAccess` & `MmapFixedNoAccess` return directly the result of
`internal_mmap`, as opposed to other Mmap functions that return nullptr.
This inconsistency leads to some confusion for the callers, as some check for
`~(uptr)0` (`MAP_FAILED`) for failure (while it can fail with `-ENOMEM` for
example).
Two potential solutions: change the callers, or make the functions return
`nullptr` on failure to follow the precedent set by the other functions.
The second option looked more appropriate to me.
Correct the callers that were wrongly checking for `~(uptr)0` or
`MAP_FAILED`.
TODO for follow up CLs:
- There are a couple of `internal_mmap` calls in XRay that check for
MMAP_FAILED as a result as well (cc: @dberris); they should use
`internal_iserror`;
Reviewers: eugenis, alekseyshl, dberris, kubamracek
Reviewed By: alekseyshl
Subscribers: kristina, kubamracek, delcypher, #sanitizers, dberris, llvm-commits
Differential Revision: https://reviews.llvm.org/D50940
llvm-svn: 340576
Aaron Puchert [Thu, 23 Aug 2018 21:13:32 +0000 (21:13 +0000)]
Remove unnecessary const_cast [NFC]
This required adding a few const specifiers on functions.
Also a minor formatting fix suggested in D49885.
llvm-svn: 340575
Adrian Prantl [Thu, 23 Aug 2018 21:08:30 +0000 (21:08 +0000)]
Change xfail to skipIf. The exact condition is really difficult to get
right and doesn't add much signal.
llvm-svn: 340574
Adrian Prantl [Thu, 23 Aug 2018 21:00:37 +0000 (21:00 +0000)]
XFAIL test for older versions of clang
llvm-svn: 340573
Petar Jovanovic [Thu, 23 Aug 2018 20:41:09 +0000 (20:41 +0000)]
[MIPS GlobalISel] Lower i8 and i16 arguments
Lower integer arguments smaller than i32.
Support both register and stack arguments.
Define setLocInfo function for setting LocInfo field in ArgLocs vector.
Patch by Petar Avramovic.
Differential Revision: https://reviews.llvm.org/D51031
llvm-svn: 340572
Raphael Isemann [Thu, 23 Aug 2018 20:40:45 +0000 (20:40 +0000)]
Fix broken builtin functions in the expression command
Summary:
Calling any non-libc builtin function in the expression command currently just causes Clang
to state that the function is not known. The reason for this is that we actually never
initialize the list of builtin functions in the Builtin::Context.
This patch just calls the initializer for the builtins in the preprocessor. Also adds some tests
for the new builtins.
It also gets rid of the extra list of builtins in the ClangExpressionParser, as we can just reuse
the existing list in the Preprocessor for the ASTContext. Having just one list of builtins around
is also closer to the standard Clang behavior.
Reviewers: #lldb, vsk
Reviewed By: vsk
Subscribers: sgraenitz, clayborg, vsk, lldb-commits
Differential Revision: https://reviews.llvm.org/D50481
llvm-svn: 340571
Walter Lee [Thu, 23 Aug 2018 20:17:42 +0000 (20:17 +0000)]
[llvm-mca] Fix parameter name. NFC.
llvm-svn: 340570
Thomas Lively [Thu, 23 Aug 2018 19:23:13 +0000 (19:23 +0000)]
[WebAssembly] Prioritize splats over v128.consts
Summary:
Splats are fewer bytes than v128.consts, so use them when either could
apply.
Reviewers: aheejin, dschuff
Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D51179
llvm-svn: 340569
Sean Fertile [Thu, 23 Aug 2018 19:10:40 +0000 (19:10 +0000)]
Revert "[PPC64] Fix DQ-form instruction handling and emit error for misalign..."
This reverts commit
5125b44dbb5d06b715213e4bec75c7346bfcc7d3.
ppc64-dq.s and ppc64-error-missaligned-dq.s fail on several of the build-bots.
Reverting to investigate.
llvm-svn: 340568
Alina Sbirlea [Thu, 23 Aug 2018 18:46:48 +0000 (18:46 +0000)]
Remove the use of pair inside the tuple in concat_iterator.
Summary:
Remove the use of pair inside the tuple in concat_iterator, and create separate begins and ends tuples instead.
This fixes the failure for llvm <= 3.7 and libstd++ that broke the hexagon build.
Reviewers: timshen
Subscribers: sanjoy, jlebar, dexonsmith, kparzysz, llvm-commits
Differential Revision: https://reviews.llvm.org/D51067
llvm-svn: 340567
Matt Davis [Thu, 23 Aug 2018 18:42:37 +0000 (18:42 +0000)]
[llvm-mca] Set the Selection strategy to Default if nullptr is passed.
* Set (not reset) the strategy in Scheduler::setCustomStrategyImpl()
llvm-svn: 340566
Sanjay Patel [Thu, 23 Aug 2018 18:38:40 +0000 (18:38 +0000)]
[x86] move/add tests for insertelement with variable index; NFC
The variable index pattern is different than the constant index
cases as shown in D51125. We might want to splat regardless of
whether the scalar is loaded from memory or transferred from GPR.
llvm-svn: 340565
Sean Fertile [Thu, 23 Aug 2018 18:35:09 +0000 (18:35 +0000)]
[PPC64] Fix DQ-form instruction handling and emit error for misalignment.
Fixes the handling of *_DS relocations used on DQ-form instructions where we
were overwriting some of the extended opcode bits. Also adds an alignment check
so that the user will receive a diagnostic error if the value we are writing
is not properly aligned.
Differential Revision: https://reviews.llvm.org/D51124
llvm-svn: 340564
David Bolvansky [Thu, 23 Aug 2018 18:34:58 +0000 (18:34 +0000)]
[LoopVectorize][NFCI] Use find instead of count
Summary:
Avoid "count" if possible -> use "find" to check for the existence of keys.
Passed llvm test suite.
Reviewers: fhahn, dcaballe, mkuper, rengolin
Reviewed By: fhahn
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D51054
llvm-svn: 340563
Walter Lee [Thu, 23 Aug 2018 18:26:26 +0000 (18:26 +0000)]
Fix format string issue introduced in r340548
Make format string portable.
llvm-svn: 340562
Douglas Yung [Thu, 23 Aug 2018 18:20:13 +0000 (18:20 +0000)]
Fixup AreCoreFilesPrevented() to consider first LLVM_ENABLE_CRASH_DUMPS and secondly coreFilesPrevented.
The previous change ignored the latter resulting in crash dumps being generated when LLVM_ENABLE_CRASH_DUMPS was
set, but coreFilesPrevented was true.
llvm-svn: 340561
Alex Langford [Thu, 23 Aug 2018 18:05:45 +0000 (18:05 +0000)]
[cmake] Add option to skip building lldb-server
Summary:
There is currently a way to skip the debugserver build. See how the CMake
variables SKIP_DEBUGSERVER and LLDB_CODESIGN_IDENTITY are used if you're
interested in that.
This allows us to skip building lldb-server as well. There is another
debug server called ds2 that can be used with LLDB. If you choose to use
ds2, this flag is very useful because it can cut down the build time of LLDB.
Differential Revision: https://reviews.llvm.org/D49282
llvm-svn: 340560
Vedant Kumar [Thu, 23 Aug 2018 17:55:03 +0000 (17:55 +0000)]
[docs] Regenerate ClangCommandLineReference.rst
llvm-svn: 340559
Vedant Kumar [Thu, 23 Aug 2018 17:54:48 +0000 (17:54 +0000)]
[options] Document -(static|shared)-libsan
llvm-svn: 340558
Adrian Prantl [Thu, 23 Aug 2018 17:51:14 +0000 (17:51 +0000)]
Fix check for dictionary entry
llvm-svn: 340557
Craig Topper [Thu, 23 Aug 2018 17:45:53 +0000 (17:45 +0000)]
[ValueTracking] Fix assert message and add test case for r340546 and PR38677.
The bug was already fixed. This just adds a test case for it.
llvm-svn: 340556
Peter Collingbourne [Thu, 23 Aug 2018 17:44:42 +0000 (17:44 +0000)]
COFF: Implement safe ICF on rodata using address-significance tables.
Differential Revision: https://reviews.llvm.org/D51050
llvm-svn: 340555
Alexey Bataev [Thu, 23 Aug 2018 17:43:40 +0000 (17:43 +0000)]
[DEBUGINFO] Fix misprint in the name of DebugDirectivesOnly, NFC.
llvm-svn: 340553
Peter Collingbourne [Thu, 23 Aug 2018 17:43:29 +0000 (17:43 +0000)]
Driver: Enable address-significance tables by default when targeting COFF.
Differential Revision: https://reviews.llvm.org/D51049
llvm-svn: 340552
Adrian Prantl [Thu, 23 Aug 2018 17:30:56 +0000 (17:30 +0000)]
XFAIL test for older versions of dsymutil
llvm-svn: 340550
Tim Renouf [Thu, 23 Aug 2018 17:28:33 +0000 (17:28 +0000)]
[RegisterCoalescer] Fix for assert in removePartialRedundancy
Summary:
I got "Use not jointly dominated by defs" when removePartialRedundancy
attempted to prune then re-extend a subrange whose only liveness was a
dead def at the copy being removed.
V2: Removed junk from test. Improved comment.
V3: Addressed minor review comments.
Subscribers: MatzeB, qcolombet, nhaehnle, llvm-commits
Differential Revision: https://reviews.llvm.org/D50914
Change-Id: I6f894e9f517f71e921e0c6d81d28c5f344db8dad
llvm-svn: 340549
Adrian Prantl [Thu, 23 Aug 2018 17:19:08 +0000 (17:19 +0000)]
lldbtest.py: Work around macOS SIP when testing ASANified builds.
llvm-svn: 340548
Shuai Wang [Thu, 23 Aug 2018 17:16:06 +0000 (17:16 +0000)]
[ASTMatchers] Let hasObjectExpression also support UnresolvedMemberExpr, CXXDependentScopeMemberExpr
Reviewers: aaron.ballman
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D50617
llvm-svn: 340547
Craig Topper [Thu, 23 Aug 2018 17:15:02 +0000 (17:15 +0000)]
[ValueTracking] Fix an assert from r340480.
We need to allow ConstantExpr Selects in addition to SelectInst.
I'll try to put together a test case, but I wanted to fix the issues being reported.
Fixes PR38677
llvm-svn: 340546
Andrea Di Biagio [Thu, 23 Aug 2018 17:09:08 +0000 (17:09 +0000)]
[llvm-mca] Fix wrong call to setCustomStrategy().
Thanks to @waltl for reporting this issue.
I have also added an assert to check for invalid null strategy objects, and I
have reworded a couple of code comments in Scheduler.h
llvm-svn: 340545
Erik Pilkington [Thu, 23 Aug 2018 17:08:02 +0000 (17:08 +0000)]
Comment out #define __cpp_lib_node_extract, we only support half of that functionality
Differential revision: https://reviews.llvm.org/D51172
llvm-svn: 340544
Adrian Prantl [Thu, 23 Aug 2018 17:02:39 +0000 (17:02 +0000)]
Add libc++ data formatter for std::function
- Added LibcxxFunctionSummaryProvider
- Removed LibcxxFunctionFrontEnd
- Modified data formatter tests to test new summary functionality
Patch by Shafik Yaghmour!
Differential Revision: https://reviews.llvm.org/D50864
llvm-svn: 340543
Alexandre Eichenberger [Thu, 23 Aug 2018 16:22:42 +0000 (16:22 +0000)]
[OpenMP][libomptarget] Bringing up to spec with respect to OMP_TARGET_OFFLOAD env var
Summary:
Right now, only the OMP_TARGET_OFFLOAD=DISABLED was implemented. Added support for the other MANDATORY and DEFAULT values.
Reviewers: gtbercea, ABataev, grokos, caomhin, Hahnfeld
Reviewed By: Hahnfeld
Subscribers: protze.joachim, gtbercea, AlexEichenberger, RaviNarayanaswamy, Hahnfeld, guansong, openmp-commits
Differential Revision: https://reviews.llvm.org/D50522
llvm-svn: 340542
Raphael Isemann [Thu, 23 Aug 2018 16:06:30 +0000 (16:06 +0000)]
Re-land [ASTImporter] Add test for ObjCAtTryStmt/ObjCAtCatchStmt/ObjCAtThrowStmt
Lands r340468 again, but this time we mark the test as unsupported on Windows
because it seems that try/catch crashes CodeGen at the moment.
llvm-svn: 340541
Sanjay Patel [Thu, 23 Aug 2018 15:58:07 +0000 (15:58 +0000)]
[x86] add debug option for and-immediate shrinking
The commit that added this functionality:
rL322957
may be causing/exposing a miscompile in PR38648:
https://bugs.llvm.org/show_bug.cgi?id=38648
so allow enabling/disabling to make debugging easier.
llvm-svn: 340540
Kadir Cetinkaya [Thu, 23 Aug 2018 15:55:27 +0000 (15:55 +0000)]
[clangd] Check for include overlapping looks for only the line now.
Summary:
Currently we match an include only if we are inside filename, with this patch we
will match whenever we are on the starting line of the include.
Reviewers: ilya-biryukov, hokein, ioeric
Reviewed By: ilya-biryukov
Subscribers: MaskRay, jkorous, arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D51163
llvm-svn: 340539
David Bolvansky [Thu, 23 Aug 2018 15:22:15 +0000 (15:22 +0000)]
[InstCombine] Fold Select with binary op - FP opcodes
Summary:
Follow up for https://reviews.llvm.org/rL339520 and https://reviews.llvm.org/rL338300
Alive:
```
%A = fcmp oeq float %x, 0.0
%B = fadd nsz float %x, %z
%C = select i1 %A, float %B, float %y
=>
%C = select i1 %A, float %z, float %y
----------
%A = fcmp oeq float %x, 0.0
%B = fadd nsz float %x, %z
%C = select %A, float %B, float %y
=>
%C = select %A, float %z, float %y
Done: 1
Optimization is correct
%A = fcmp une float %x, -0.0
%B = fadd nsz float %x, %z
%C = select i1 %A, float %y, float %B
=>
%C = select i1 %A, float %y, float %z
----------
%A = fcmp une float %x, -0.0
%B = fadd nsz float %x, %z
%C = select %A, float %y, float %B
=>
%C = select %A, float %y, float %z
Done: 1
Optimization is correct
```
Reviewers: spatel, lebedev.ri
Reviewed By: spatel
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D50714
llvm-svn: 340538
Brian Homerding [Thu, 23 Aug 2018 15:05:22 +0000 (15:05 +0000)]
[FunctionAttrs] Infer WriteOnly Function Attribute
These changes expand the FunctionAttr logic in order to mark functions as
WriteOnly when appropriate. This is done through an additional bool variable
and extended logic.
Reviewers: hfinkel, jdoerfert
Differential Revision: https://reviews.llvm.org/D48387
llvm-svn: 340537
Andrea Di Biagio [Thu, 23 Aug 2018 15:04:52 +0000 (15:04 +0000)]
[llvm-mca] Allow the definition of custom strategies for selecting processor resource units.
With this patch, users can now customize the pipeline selection strategy for
scheduler resources. The resource selection strategy can be defined at processor
resource granularity. This enables the definition of different strategies for
different hardware schedulers.
To override the strategy associated with a processor resource, users can call
method ResourceManager::setCustomStrategy(), and pass a 'ResourceStrategy'
object in input.
Class ResourceStrategy is an abstract class which declares virtual method
`ResourceStrategy::select()`. Method select() is meant to implement the actual
strategy; it is responsible for picking the next best resource from a set of
available pipeline resources. Custom strategy must simply override that method.
By default, processor resources are associated with instances of
'DefaultResourceStrategy'. A 'DefaultResourceStrategy' internally implements a
simple round-robin selector. For more details, please refer to the code comments
in Scheduler.h.
llvm-svn: 340536
Mikhail R. Gadelha [Thu, 23 Aug 2018 13:21:35 +0000 (13:21 +0000)]
[analyzer] added cache for SMT queries in the SMTConstraintManager
Summary:
This patch implements a new cache for the result of SMT queries; with this patch the regression tests are 25% faster.
It's implemented as a `llvm::DenseMap` where the key is the hash of the set of the constraints in a state.
There is still one method that does not use the cache, `getSymVal`, because it needs to get a symbol interpretation from the SMT, which is not cached yet.
Reviewers: NoQ, george.karpenkov
Reviewed By: george.karpenkov
Subscribers: xazax.hun, szepet, a.sidorin, Szelethus
Differential Revision: https://reviews.llvm.org/D50773
llvm-svn: 340535
Mikhail R. Gadelha [Thu, 23 Aug 2018 13:21:31 +0000 (13:21 +0000)]
[analyzer] Moved all CSA code from the SMT API to a new header, `SMTConv.h`. NFC.
Summary:
With this patch, the SMT backend is almost completely detached from the CSA.
Unfortunate consequence is that we missed the `ConditionTruthVal` from the CSA and had to use `Optional<bool>`.
The Z3 solver implementation is still in the same file as the `Z3ConstraintManager`, in `lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp` though, but except for that, the SMT API can be moved to anywhere in the codebase.
Reviewers: NoQ, george.karpenkov
Reviewed By: george.karpenkov
Subscribers: xazax.hun, szepet, a.sidorin, Szelethus
Differential Revision: https://reviews.llvm.org/D50772
llvm-svn: 340534
Mikhail R. Gadelha [Thu, 23 Aug 2018 13:21:00 +0000 (13:21 +0000)]
[analyzer] Templatefy SMTConstraintManager so more generic code can be moved from solver specific implementations. NFC.
Summary:
By making SMTConstraintManager a template and passing the SMT constraint type and expr, we can further move code from the Z3ConstraintManager class to the generic SMT constraint Manager.
Now, each SMT specific constraint manager only needs to implement the method `bool canReasonAbout(SVal X) const`.
Reviewers: NoQ, george.karpenkov
Reviewed By: george.karpenkov
Subscribers: mgorny, xazax.hun, szepet, a.sidorin, Szelethus
Differential Revision: https://reviews.llvm.org/D50770
llvm-svn: 340533
Mikhail R. Gadelha [Thu, 23 Aug 2018 13:20:18 +0000 (13:20 +0000)]
[analyzer] Delete SMTContext. NFC.
Summary: There is no reason to have a base class for a context anymore as each SMT object carries a reference to the specific solver context.
Reviewers: NoQ, george.karpenkov, hiraditya
Reviewed By: hiraditya
Subscribers: hiraditya, xazax.hun, szepet, a.sidorin, Szelethus
Differential Revision: https://reviews.llvm.org/D50768
llvm-svn: 340532
Mikael Holmen [Thu, 23 Aug 2018 13:18:27 +0000 (13:18 +0000)]
Change dyn_cast<CXXMethodDecl>(FD) to isa<CXXMethodDecl>(FD) [NFC]
The result of the dyn_cast wasn't used to we can just check isa.
llvm-svn: 340531
Kadir Cetinkaya [Thu, 23 Aug 2018 13:14:50 +0000 (13:14 +0000)]
[clangd] Suggest code-completions for overriding base class virtual methods.
Summary:
Whenever a code-completion is triggered within a class/struct/union looks at
base classes and figures out non-overriden virtual functions. Than suggests
completions for those.
Reviewers: ilya-biryukov, hokein, ioeric
Reviewed By: hokein
Subscribers: MaskRay, jkorous, arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D50898
llvm-svn: 340530
John Brawn [Thu, 23 Aug 2018 12:48:17 +0000 (12:48 +0000)]
[GVN] Invalidate cached info for phis when setting dead predecessors to undef
When GVN sets the incoming value for a phi to undef because the incoming block
is unreachable it needs to also invalidate the cached info for that phi in
MemoryDependenceAnalysis, otherwise later queries will return stale information.
Differential Revision: https://reviews.llvm.org/D51099
llvm-svn: 340529
Victor Leschuk [Thu, 23 Aug 2018 12:43:33 +0000 (12:43 +0000)]
[DWARF] Unify warning callbacks. NFC.
Both DWARFDebugLine and DWARFDebugAddr used the same callback mechanism
for handling recoverable errors. They both implemented similar warn() function
to be used as such callbacks.
In this revision we get rid of code duplication and move this warn() function
to DWARFContext as DWARFContext::dumpWarning().
Reviewers: lhames, jhenderson, aprantl, probinson, dblaikie, JDevlieghere
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D51033
llvm-svn: 340528
Kadir Cetinkaya [Thu, 23 Aug 2018 12:19:39 +0000 (12:19 +0000)]
[clangd] Move function argument snippet disable mechanism from LSP rendering to internal clangd reprensentation.
Summary:
We were handling the EnableFunctionArgSnippets only when we are producing LSP
response. Move that code into CompletionItem generation so that internal clients
can benefit from that as well.
Reviewers: ilya-biryukov, ioeric, hokein
Reviewed By: ilya-biryukov
Subscribers: MaskRay, jkorous, arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D51102
llvm-svn: 340527
Florian Hahn [Thu, 23 Aug 2018 11:17:59 +0000 (11:17 +0000)]
[SCCP] Remove unused variable added in r340525.
llvm-svn: 340526
Florian Hahn [Thu, 23 Aug 2018 11:04:00 +0000 (11:04 +0000)]
Recommit r333268: [IPSCCP] Use PredicateInfo to propagate facts from cmp instructions.
This version of the patch fixes cleaning up ssa_copy intrinsics, so it does not
crash for instructions in blocks that have been marked unreachable.
This patch updates IPSCCP to use PredicateInfo to propagate
facts to true branches predicated by EQ and to false branches
predicated by NE.
As a follow up, we should be able to extend it to also propagate additional
facts about nonnull.
Reviewers: davide, mssimpso, dberlin, efriedma
Reviewed By: davide, dberlin
Differential Revision: https://reviews.llvm.org/D45330
llvm-svn: 340525