David Blaikie [Wed, 11 Sep 2019 22:24:45 +0000 (22:24 +0000)]
Add some missing changes to GSYM that was addressing a gcc compilation error due to a type and variable with the same name
llvm-svn: 371681
Vitaly Buka [Wed, 11 Sep 2019 22:19:18 +0000 (22:19 +0000)]
Fix mac build
llvm-svn: 371680
David Blaikie [Wed, 11 Sep 2019 22:15:16 +0000 (22:15 +0000)]
PR43278: Temporarily disable llvm-reduce tests due to exhausting temp files
llvm-svn: 371679
Reid Kleckner [Wed, 11 Sep 2019 21:56:17 +0000 (21:56 +0000)]
[X86] Fix latent bugs in 32-bit CMPXCHG8B inserter
I found three issues:
1. the loop over E[ABCD]X copies run over BB start
2. the direct address of cmpxchg8b could be a frame index
3. the displacement of cmpxchg8b could be a global instead of an
immediate
These were all introduced together in r287875, and should be fixed with
this change.
Issue reported by Zachary Turner.
llvm-svn: 371678
Evandro Menezes [Wed, 11 Sep 2019 21:46:57 +0000 (21:46 +0000)]
[ConstantFolding] Refactor math functions to use LLVM ones (NFC)
When possible, replace calls to library routines on the host with equivalent
ones in LLVM.
Differential revision: https://reviews.llvm.org/D67459
llvm-svn: 371677
Cyndy Ishida [Wed, 11 Sep 2019 21:35:28 +0000 (21:35 +0000)]
Revert [llvm-nm] Add tapi file support
This reverts r371576 (git commit
f88f46358dbffa20af3b054a9346e5154789d50f)
llvm-svn: 371676
Vitaly Buka [Wed, 11 Sep 2019 21:33:06 +0000 (21:33 +0000)]
Update compiler-rt cpplint.py
https://github.com/cpplint/cpplint/commit/
adb3500107f409ac5491188ae652ac3f4d03d9d3
llvm-svn: 371675
Cyndy Ishida [Wed, 11 Sep 2019 21:32:55 +0000 (21:32 +0000)]
Revert [Object][TextAPI] NFC, fix tapi lit tests
This reverts r371577 (git commit
b2b0ccab2f76733679eeceecf31b21ebc1fe23ac)
llvm-svn: 371674
Craig Topper [Wed, 11 Sep 2019 21:30:42 +0000 (21:30 +0000)]
[X86] Add test case for v16i64->v16i32 truncate on min-legal-vector-width=256.
I think this case would crash before I added back the -x86-experimental-vector-widening command line option. Adding this test case to prevent breaking it again when we remove the option.
llvm-svn: 371673
Craig Topper [Wed, 11 Sep 2019 21:30:09 +0000 (21:30 +0000)]
[X86] Move x86_64 fp128 conversion to libcalls from type legalization to DAG legalization
fp128 is considered a legal type for a register, but has almost no legal operations so everything needs to be converted to a libcall. Previously this was implemented by tricking type legalization into softening the operations with various checks for "is legal in hardware register" to change the behavior to still use f128 as the resulting type instead of converting to i128.
This patch abandons this approach and instead moves the libcall conversions to LegalizeDAG. This is the approach taken by AArch64 where they also have a legal fp128 type, but no legal operations. I think this is more in spirit with how SelectionDAG's phases are supposed to work.
I had to make some hacks for STRICT_FP_ROUND because some of the strict FP handling checks if ISD::FP_ROUND is Legal for a given result type, but I had to make ISD::FP_ROUND Custom to allow making a libcall when the input is f128. For all other types the Custom handler just returns the original node. These hacks are incomplete and don't work for a strict truncate from f128, but I don't think it worked before either since LegalizeFloatTypes doesn't know about strict ops yet. I've also raised PR43209 against AArch64 which currently crashes on a strict ftrunc from f64->f32 because of FP_ROUND being marked Custom for the same reason there.
Differential Revision: https://reviews.llvm.org/D67128
llvm-svn: 371672
Austin Kerbow [Wed, 11 Sep 2019 21:28:41 +0000 (21:28 +0000)]
AMDGPU: Move m0 initializations earlier
Summary:
After hoisting and merging m0 initializations schedule them as early as
possible in the MBB. This helps the scheduler avoid hazards in some
cases.
Reviewers: rampitec, arsenm
Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, arphaman, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67450
llvm-svn: 371671
Nico Weber [Wed, 11 Sep 2019 21:24:15 +0000 (21:24 +0000)]
gn build: Merge r371661
llvm-svn: 371670
Nico Weber [Wed, 11 Sep 2019 21:24:11 +0000 (21:24 +0000)]
gn build: Merge r371657
llvm-svn: 371669
Vedant Kumar [Wed, 11 Sep 2019 21:23:45 +0000 (21:23 +0000)]
[DWARF] Evaluate DW_OP_entry_value
Add support for evaluating DW_OP_entry_value. This involves parsing
DW_TAG_call_site_parameter and wiring the information through to the expression
evaluator.
rdar://
54496008
Differential Revision: https://reviews.llvm.org/D67376
llvm-svn: 371668
Vedant Kumar [Wed, 11 Sep 2019 21:23:42 +0000 (21:23 +0000)]
[Status] Add a LLDB_ERRORF macro for error reporting (similar to LLDB_LOGF)
llvm-svn: 371667
Vedant Kumar [Wed, 11 Sep 2019 21:23:39 +0000 (21:23 +0000)]
[DWARF] Emit call site parameter info when tuning for lldb
Emit debug entry values using standard DWARF5 opcodes when the debugger
tuning is set to lldb.
Differential Revision: https://reviews.llvm.org/D67410
llvm-svn: 371666
Volodymyr Sapsai [Wed, 11 Sep 2019 21:19:27 +0000 (21:19 +0000)]
Fix up a test updated in r371655 - require case-insensitive file system.
On case-sensitive file systems include with wrong case is not found instead of
showing a warning.
llvm-svn: 371665
Alex Lorenz [Wed, 11 Sep 2019 21:00:13 +0000 (21:00 +0000)]
[clang-scan-deps] cast Result to ErrorOr<unique_ptr<vfs::File>> explicitly to avoid s390x-linux buildbot failure
llvm-svn: 371664
Reid Kleckner [Wed, 11 Sep 2019 20:56:25 +0000 (20:56 +0000)]
Start porting ivfsoverlay tests to Windows
Part of PR43272, the changes are:
1. Use @ as the sed pattern delimiter instead of : so that the drive
letter in lit substitutions isn't an issue.
2. Use the %/t and %/S substitutions to get paths with forward slashes
to work around string quoting issues in the yaml file.
3. Replace REQUIRES:shell with XFAIL:windows. These tests should pass on
Windows, but do not for reasons that are not yet understood. We would
like to know if they pass unexpectedly.
I was able to remove the XFAILs from two tests, since they already pass
with my sed fix:
clang/test/VFS/module_missing_vfs.m
clang/test/VFS/test_nonmodular.c
Reviewers: amccarth
Differential Revision: https://reviews.llvm.org/D67454
llvm-svn: 371663
Chris Bieneman [Wed, 11 Sep 2019 20:54:38 +0000 (20:54 +0000)]
All Errors must be checked
Summary: If an error is ever returned from any of the functions called here, the error must be joined with the Result Error before being returned otherwise the Result Error will assert on destruction.
Reviewers: lhames
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67407
llvm-svn: 371662
Artem Dergachev [Wed, 11 Sep 2019 20:54:27 +0000 (20:54 +0000)]
[analyzer] NFC: Move PathDiagnostic classes to libAnalysis.
At this point the PathDiagnostic, PathDiagnosticLocation, PathDiagnosticPiece
structures no longer rely on anything specific to Static Analyzer, so we can
move them out of it for everybody to use.
PathDiagnosticConsumers are still to be handed off.
Differential Revision: https://reviews.llvm.org/D67419
llvm-svn: 371661
Artem Dergachev [Wed, 11 Sep 2019 20:54:24 +0000 (20:54 +0000)]
[analyzer] NFC: Move resetDiagnosticLocationToMainFile() to BugReporter.
This method of PathDiagnostic is a part of Static Analyzer's particular
path diagnostic construction scheme. As such, it doesn't belong to
the PathDiagnostic class, but to the Analyzer.
Differential Revision: https://reviews.llvm.org/D67418
llvm-svn: 371660
Artem Dergachev [Wed, 11 Sep 2019 20:54:21 +0000 (20:54 +0000)]
[analyzer] NFC: Move getStmt() and createEndOfPath() out of PathDiagnostic.
These static functions deal with ExplodedNodes which is something we don't want
the PathDiagnostic interface to know anything about, as it's planned to be
moved out of libStaticAnalyzerCore.
Differential Revision: https://reviews.llvm.org/D67382
llvm-svn: 371659
Artem Dergachev [Wed, 11 Sep 2019 20:54:17 +0000 (20:54 +0000)]
[analyzer] NFC: Re-implement stack hints as a side map in BugReport.
That's one of the few random entities in the PathDiagnostic interface that
are specific to the Static Analyzer. By moving them out we could let
everybody use path diagnostics without linking against Static Analyzer.
Differential Revision: https://reviews.llvm.org/D67381
llvm-svn: 371658
Greg Clayton [Wed, 11 Sep 2019 20:51:03 +0000 (20:51 +0000)]
Add a LineTable class to GSYM and test it.
This patch adds the ability to create a gsym::LineTable object, populate it, encode and decode it and test all functionality.
The full format of the LineTable encoding is specified in the header file LineTable.h.
Differential Revision: https://reviews.llvm.org/D66602
llvm-svn: 371657
Alex Lorenz [Wed, 11 Sep 2019 20:40:31 +0000 (20:40 +0000)]
[clang-scan-deps] add skip excluded conditional preprocessor block preprocessing optimization
This commit adds an optimization to clang-scan-deps and clang's preprocessor that skips excluded preprocessor
blocks by bumping the lexer pointer, and not lexing the tokens until reaching appropriate #else/#endif directive.
The skip positions and lexer offsets are computed when the file is minimized, directly from the minimized tokens.
On an 18-core iMacPro with macOS Catalina Beta I got 10-15% speed-up from this optimization when running clang-scan-deps on
the compilation database for a recent LLVM and Clang (3511 files).
Differential Revision: https://reviews.llvm.org/D67127
llvm-svn: 371656
Volodymyr Sapsai [Wed, 11 Sep 2019 20:39:04 +0000 (20:39 +0000)]
Fix -Wnonportable-include-path suppression for header maps with absolute paths.
In `DirectoryLookup::LookupFile` parameter `HasBeenMapped` doesn't cover
the case when clang finds a file through a header map but doesn't remap
the lookup filename because the target path is an absolute path. As a
result, -Wnonportable-include-path suppression for header maps
introduced in r301592 wasn't triggered.
Change parameter `HasBeenMapped` to `IsInHeaderMap` and use parameter
`MappedName` to track the filename remapping. This way we can handle
both relative and absolute paths in header maps, and account for their
specific properties, like filename remapping being a property preserved
across lookups in multiple directories.
rdar://problem/
39516483
Reviewers: dexonsmith, bruno
Reviewed By: dexonsmith
Subscribers: jkorous, cfe-commits, ributzka
Differential Revision: https://reviews.llvm.org/D58094
llvm-svn: 371655
Alex Langford [Wed, 11 Sep 2019 20:36:28 +0000 (20:36 +0000)]
[Plugins/Process] Remove direct use of ClangASTContext from InferiorCallPOSIX
Summary:
InferiorCallPOSIX directly grabs a ClangASTContext from the Target it
has and does no error checking. I don't think these functions have a
reason to know about clang specifically. Additionally, using
`GetScratchTypeSystemForLanguage` forces us to do error checking since
it returns an Expected.
Differential Revision: https://reviews.llvm.org/D67427
llvm-svn: 371654
Reid Kleckner [Wed, 11 Sep 2019 20:29:22 +0000 (20:29 +0000)]
[llvm-reduce] Fix a bug, improve error handling when running test
llvm::sys::ExecuteAndWait can report errors, so let's make use of that.
Second, while iterating uses of functions to remove, a call can appear
multiple times. Use a SetVector so we don't attempt to erase such a call
twice.
llvm-svn: 371653
Adrian Prantl [Wed, 11 Sep 2019 19:57:29 +0000 (19:57 +0000)]
Update link to the DWARF spec.
llvm-svn: 371650
Michael Liao [Wed, 11 Sep 2019 19:55:20 +0000 (19:55 +0000)]
[AMDGPU] Fix crash in phi-elimination hook.
Summary: - Pre-check in case there's just a single PHI insn.
Reviewers: alex-t, rampitec, arsenm
Subscribers: kzhuravl, jvesely, wdng, nhaehnle, dstuttard, tpr, t-tye, hiraditya, llvm-commits, yaxunl
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67451
llvm-svn: 371649
Adrian Prantl [Wed, 11 Sep 2019 19:49:38 +0000 (19:49 +0000)]
Update documentation.
llvm-svn: 371648
Max Moroz [Wed, 11 Sep 2019 19:43:03 +0000 (19:43 +0000)]
[libFuzzer] Remove hardcoded number of new features in merge_two_step.test.
Summary:
The number of features can be different on different platforms.
This should fixed broken builders, e.g.
http://lab.llvm.org:8011/builders/clang-cmake-aarch64-full/builds/7946
Reviewers: Dor1s
Reviewed By: Dor1s
Subscribers: kristof.beyls, delcypher, #sanitizers, llvm-commits
Tags: #llvm, #sanitizers
Differential Revision: https://reviews.llvm.org/D67458
llvm-svn: 371647
David Bolvansky [Wed, 11 Sep 2019 18:55:56 +0000 (18:55 +0000)]
[NFC] Added triple to test file to avoid arm buildbots failures
llvm-svn: 371646
Matt Arsenault [Wed, 11 Sep 2019 18:55:20 +0000 (18:55 +0000)]
Fix test failures after r371640
r371640 evidently fixed bug 39481
llvm-svn: 371645
Eli Friedman [Wed, 11 Sep 2019 18:55:00 +0000 (18:55 +0000)]
[ConstantHoisting] Fix non-determinism.
Differential Revision: https://reviews.llvm.org/D66114
llvm-svn: 371644
Pirama Arumuga Nainar [Wed, 11 Sep 2019 18:35:49 +0000 (18:35 +0000)]
[IRMover] Don't map globals if their types are the same
Summary:
During IR Linking, if the types of two globals in destination and source
modules are the same, it can only be because the global in the
destination module is originally from the source module and got added to
the destination module from a shared metadata.
We shouldn't map this type to itself in case the type's components get
remapped to a new type from the destination (for instance, during the
loop over SrcM->getIdentifiedStructTypes() further below in
IRLinker::computeTypeMapping()).
Fixes PR40312.
Reviewers: tejohnson, pcc, srhines
Subscribers: mehdi_amini, hiraditya, steven_wu, dexonsmith, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66814
llvm-svn: 371643
Reid Kleckner [Wed, 11 Sep 2019 18:09:10 +0000 (18:09 +0000)]
[MS] Consder constexpr globals to be inline, as in C++17
Summary:
Microsoft seems to do this regardless of the language mode, so we must
also do it in order to be ABI compatible.
Fixes PR36125
Reviewers: thakis
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D47956
llvm-svn: 371642
Matt Arsenault [Wed, 11 Sep 2019 17:59:21 +0000 (17:59 +0000)]
LiveIntervals: Split live intervals on multiple dead defs
If there are multiple dead defs of the same virtual register, these
are required to be split into multiple virtual registers with separate
live intervals to avoid a verifier error.
llvm-svn: 371640
Zoe Carver [Wed, 11 Sep 2019 17:39:24 +0000 (17:39 +0000)]
Consolidate swap, swap_ranges, and iter_swap in <type_traits>.
NFC. Thanks to @Quuxplusone (Arthur O'Dwyer) for this change.
llvm-svn: 371639
Louis Dionne [Wed, 11 Sep 2019 16:57:19 +0000 (16:57 +0000)]
[libc++] Add a CMake cache for Apple-specific configuration options
llvm-svn: 371638
Sergey Dmitriev [Wed, 11 Sep 2019 16:28:47 +0000 (16:28 +0000)]
[Clang][Bundler] Replace std::vector by SmallVector [NFC]
Differential Revision: https://reviews.llvm.org/D67413
llvm-svn: 371637
Nico Weber [Wed, 11 Sep 2019 16:26:59 +0000 (16:26 +0000)]
gn build: Merge r371635
llvm-svn: 371636
Petr Hosek [Wed, 11 Sep 2019 16:19:50 +0000 (16:19 +0000)]
Reland "clang-misexpect: Profile Guided Validation of Performance Annotations in LLVM"
This patch contains the basic functionality for reporting potentially
incorrect usage of __builtin_expect() by comparing the developer's
annotation against a collected PGO profile. A more detailed proposal and
discussion appears on the CFE-dev mailing list
(http://lists.llvm.org/pipermail/cfe-dev/2019-July/062971.html) and a
prototype of the initial frontend changes appear here in D65300
We revised the work in D65300 by moving the misexpect check into the
LLVM backend, and adding support for IR and sampling based profiles, in
addition to frontend instrumentation.
We add new misexpect metadata tags to those instructions directly
influenced by the llvm.expect intrinsic (branch, switch, and select)
when lowering the intrinsics. The misexpect metadata contains
information about the expected target of the intrinsic so that we can
check against the correct PGO counter when emitting diagnostics, and the
compiler's values for the LikelyBranchWeight and UnlikelyBranchWeight.
We use these branch weight values to determine when to emit the
diagnostic to the user.
A future patch should address the comment at the top of
LowerExpectIntrisic.cpp to hoist the LikelyBranchWeight and
UnlikelyBranchWeight values into a shared space that can be accessed
outside of the LowerExpectIntrinsic pass. Once that is done, the
misexpect metadata can be updated to be smaller.
In the long term, it is possible to reconstruct portions of the
misexpect metadata from the existing profile data. However, we have
avoided this to keep the code simple, and because some kind of metadata
tag will be required to identify which branch/switch/select instructions
are influenced by the use of llvm.expect
Patch By: paulkirth
Differential Revision: https://reviews.llvm.org/D66324
llvm-svn: 371635
Florian Hahn [Wed, 11 Sep 2019 16:17:03 +0000 (16:17 +0000)]
Revert [InstCombine] Use SimplifyFMulInst to simplify multiply in fma.
This introduces additional rounding error in some cases. See D67434.
This reverts r371518 (git commit
18a1f0818b659cee13865b4fad2648d85984a4ed)
llvm-svn: 371634
Sergey Dmitriev [Wed, 11 Sep 2019 16:03:21 +0000 (16:03 +0000)]
[Clang][Bundler] Fix for a potential memory leak [NFC]
Bundler leaks memory if it is called with -type=o but given input isn't an object file (though it has to have a known binary type like IR, archive, etc...). Memory leak is happening when binary object returned by the createBinary(...) call cannot be casted to an ObjectFile type. In this case returned BinaryOrErr object releases ownership of the binary, but no one is taking it (see line 626).
Differential Revision: https://reviews.llvm.org/D67416
llvm-svn: 371633
Alexey Bataev [Wed, 11 Sep 2019 15:44:06 +0000 (15:44 +0000)]
[OPENMP] Update the diagnosis message for canonical loop form, by Chi
Chun Chen.
The previous patch (https://reviews.llvm.org/D54441) support the
relational-op != very well for openmp canonical loop form, however,
it didn't update the diagnosis message. So this patch is simply
update the diagnosis message by adding !=, update the test
related to it, and update the section number for canonical loop
form for OpenMP 5.0 in comment.
Differential Revision: https://reviews.llvm.org/D66559
llvm-svn: 371631
Roman Lebedev [Wed, 11 Sep 2019 15:32:46 +0000 (15:32 +0000)]
[InstSimplify] Pass SimplifyQuery into simplifyUnsignedRangeCheck() and use it for isKnownNonZero()
This was actually the original intention in D67332,
but i messed up and forgot about it.
This patch was originally part of D67411, but precommitting this.
llvm-svn: 371630
Roman Lebedev [Wed, 11 Sep 2019 15:28:03 +0000 (15:28 +0000)]
[NFC][InstSimplify] Add extra test for D67411 with @llvm.assume
llvm-svn: 371629
Kostya Kortchinsky [Wed, 11 Sep 2019 14:48:41 +0000 (14:48 +0000)]
[scudo][standalone] Android related improvements
Summary:
This changes a few things to improve memory footprint and performances
on Android, and fixes a test compilation error:
- add `stdlib.h` to `wrappers_c_test.cc` to address
https://bugs.llvm.org/show_bug.cgi?id=42810
- change Android size class maps, based on benchmarks, to improve
performances and lower the Svelte memory footprint. Also change the
32-bit region size for said configuration
- change the `reallocate` logic to reallocate in place for sizes larger
than the original chunk size, when they still fit in the same block.
This addresses patterns from `memory_replay` dumps like the following:
```
202: realloc 0xb48fd000 0xb4930650 12352
202: realloc 0xb48fd000 0xb48fd000 12420
202: realloc 0xb48fd000 0xb48fd000 12492
202: realloc 0xb48fd000 0xb48fd000 12564
202: realloc 0xb48fd000 0xb48fd000 12636
202: realloc 0xb48fd000 0xb48fd000 12708
202: realloc 0xb48fd000 0xb48fd000 12780
202: realloc 0xb48fd000 0xb48fd000 12852
202: realloc 0xb48fd000 0xb48fd000 12924
202: realloc 0xb48fd000 0xb48fd000 12996
202: realloc 0xb48fd000 0xb48fd000 13068
202: realloc 0xb48fd000 0xb48fd000 13140
202: realloc 0xb48fd000 0xb48fd000 13212
202: realloc 0xb48fd000 0xb48fd000 13284
202: realloc 0xb48fd000 0xb48fd000 13356
202: realloc 0xb48fd000 0xb48fd000 13428
202: realloc 0xb48fd000 0xb48fd000 13500
202: realloc 0xb48fd000 0xb48fd000 13572
202: realloc 0xb48fd000 0xb48fd000 13644
202: realloc 0xb48fd000 0xb48fd000 13716
202: realloc 0xb48fd000 0xb48fd000 13788
...
```
In this situation we were deallocating the old chunk, and
allocating a new one for every single one of those, but now we can
keep the same chunk (we just updated the header), which saves some
heap operations.
Reviewers: hctim, morehouse, vitalybuka, eugenis, cferris, rengolin
Reviewed By: morehouse
Subscribers: srhines, delcypher, #sanitizers, llvm-commits
Tags: #llvm, #sanitizers
Differential Revision: https://reviews.llvm.org/D67293
llvm-svn: 371628
Alexey Bataev [Wed, 11 Sep 2019 14:44:30 +0000 (14:44 +0000)]
[OPENMP]Updated status page, NFC.
llvm-svn: 371627
Nico Weber [Wed, 11 Sep 2019 14:40:16 +0000 (14:40 +0000)]
gn build: Merge r371562
llvm-svn: 371626
Konrad Kleine [Wed, 11 Sep 2019 14:33:37 +0000 (14:33 +0000)]
Revert "[LLDB][ELF] Load both, .symtab and .dynsym sections"
This reverts commit
3a4781bbf4f39a25562b4c61c9a9ab2483a96b41.
llvm-svn: 371625
Konrad Kleine [Wed, 11 Sep 2019 14:33:21 +0000 (14:33 +0000)]
Revert "[LLDB][ELF] Fixup for comments in D67390"
This reverts commit
813f05915d29904878d926f9849ca3dbe78096af.
llvm-svn: 371624
Raphael Isemann [Wed, 11 Sep 2019 14:33:11 +0000 (14:33 +0000)]
[lldb][NFC] Make include directories in Clang expression parser a std::string
We never compare these directories (where ConstString would be good) and
essentially just convert this back to a normal string in the end. So we might
as well just use std::string. Also makes it easier to unittest this code
(which was the main motivation for this change).
llvm-svn: 371623
Whitney Tsang [Wed, 11 Sep 2019 14:26:22 +0000 (14:26 +0000)]
LLVM: Optimization Pass: Remove conflicting attribute, if any, before
adding new read attribute to an argument
Summary: Update optimization pass to prevent adding read-attribute to an
argument without removing its conflicting attribute.
A read attribute, based on the result of the attribute deduction
process, might be added to an argument. The attribute might be in
conflict with other read/write attribute currently associated with the
argument. To ensure the compatibility of attributes, conflicting
attribute, if any, must be removed before a new one is added.
The following snippet shows the current behavior of the compiler, where
the compilation process is aborted due to incompatible attributes.
$ cat x.ll
; ModuleID = 'x.bc'
%_type_of_d-ccc = type <{ i8*, i8, i8, i8, i8 }>
@d-ccc = internal global %_type_of_d-ccc <{ i8* null, i8 1, i8 13, i8 0,
i8 -127 }>, align 8
define void @foo(i32* writeonly %.aaa) {
foo_entry:
%_param_.aaa = alloca i32*, align 8
store i32* %.aaa, i32** %_param_.aaa, align 8
store i8 0, i8* getelementptr inbounds (%_type_of_d-ccc,
%_type_of_d-ccc* @d-ccc, i32 0, i32 3)
ret void
}
$ opt -O3 x.ll
Attributes 'readnone and writeonly' are incompatible!
void (i32*)* @foo
in function foo
LLVM ERROR: Broken function found, compilation aborted!
The purpose of this changeset is to fix the above error. This fix is
based on a suggestion from Johannes @jdoerfert (many thanks!!!)
Authored By: anhtuyen
Reviewer: nicholas, rnk, chandlerc, jdoerfert
Reviewed By: rnk
Subscribers: hiraditya, jdoerfert, llvm-commits, anhtuyen, LLVM
Tag: LLVM
Differential Revision: https://reviews.llvm.org/D58694
llvm-svn: 371622
Sanjay Patel [Wed, 11 Sep 2019 14:18:48 +0000 (14:18 +0000)]
[ConstProp] add tests for fma that produce NaN; NFC
llvm-svn: 371621
Max Moroz [Wed, 11 Sep 2019 14:11:08 +0000 (14:11 +0000)]
[libFuzzer] Make -merge=1 to reuse coverage information from the control file.
Summary:
This change allows to perform corpus merging in two steps. This is useful when
the user wants to address the following two points simultaneously:
1) Get trustworthy incremental stats for the coverage and corpus size changes
when adding new corpus units.
2) Make sure the shorter units will be preferred when two or more units give the
same unique signal (equivalent to the `REDUCE` logic).
This solution was brainstormed together with @kcc, hopefully it looks good to
the other people too. The proposed use case scenario:
1) We have a `fuzz_target` binary and `existing_corpus` directory.
2) We do fuzzing and write new units into the `new_corpus` directory.
3) We want to merge the new corpus into the existing corpus and satisfy the
points mentioned above.
4) We create an empty directory `merged_corpus` and run the first merge step:
`
./fuzz_target -merge=1 -merge_control_file=MCF ./merged_corpus ./existing_corpus
`
this provides the initial stats for `existing_corpus`, e.g. from the output:
`
MERGE-OUTER: 3 new files with 11 new features added; 11 new coverage edges
`
5) We recreate `merged_corpus` directory and run the second merge step:
`
./fuzz_target -merge=1 -merge_control_file=MCF ./merged_corpus ./existing_corpus ./new_corpus
`
this provides the final stats for the merged corpus, e.g. from the output:
`
MERGE-OUTER: 6 new files with 14 new features added; 14 new coverage edges
`
Alternative solutions to this approach are:
A) Store precise coverage information for every unit (not only unique signal).
B) Execute the same two steps without reusing the control file.
Either of these would be suboptimal as it would impose an extra disk or CPU load
respectively, which is bad given the quadratic complexity in the worst case.
Tested on Linux, Mac, Windows.
Reviewers: morehouse, metzman, hctim, kcc
Reviewed By: morehouse
Subscribers: JDevlieghere, delcypher, mgrang, #sanitizers, llvm-commits, kcc
Tags: #llvm, #sanitizers
Differential Revision: https://reviews.llvm.org/D66107
llvm-svn: 371620
Sanjay Patel [Wed, 11 Sep 2019 14:01:11 +0000 (14:01 +0000)]
[ConstProp] move test file from InstSimplify; NFC
These are constant folding tests; there is no code
directly in InstSimplify for this.
llvm-svn: 371619
Raphael Isemann [Wed, 11 Sep 2019 13:57:41 +0000 (13:57 +0000)]
[lldb][NFC] Remove dead code in SBAddress::GetDescription
llvm-svn: 371618
Sanjay Patel [Wed, 11 Sep 2019 13:56:07 +0000 (13:56 +0000)]
[InstSimplify] regenerate test CHECKs; NFC
llvm-svn: 371617
Guillaume Chatelet [Wed, 11 Sep 2019 13:37:35 +0000 (13:37 +0000)]
[Alignment][NFC] use llvm::Align for AsmPrinter::EmitAlignment
Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790
Reviewers: courbet
Subscribers: dschuff, sdardis, nemanjai, hiraditya, kbarton, jrtc27, MaskRay, atanasyan, jsji, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67443
llvm-svn: 371616
Sanjay Patel [Wed, 11 Sep 2019 13:25:32 +0000 (13:25 +0000)]
[LangRef] add link for fma intrinsic
llvm-svn: 371615
Raphael Isemann [Wed, 11 Sep 2019 12:57:49 +0000 (12:57 +0000)]
[lldb][NFC] Sort files in unittests/Expression/CMakeLists.txt
llvm-svn: 371614
Sanjay Patel [Wed, 11 Sep 2019 12:22:24 +0000 (12:22 +0000)]
[LangRef] fix punctuation; NFC
llvm-svn: 371612
Nico Weber [Wed, 11 Sep 2019 12:21:09 +0000 (12:21 +0000)]
gn build: add include_dir that's necessary after r371564
llvm-svn: 371611
Sanjay Patel [Wed, 11 Sep 2019 12:04:26 +0000 (12:04 +0000)]
[InstCombine] fold sign-bit compares of srem
(srem X, pow2C) sgt/slt 0 can be reduced using bit hacks by masking
off the sign bit and the module (low) bits:
https://rise4fun.com/Alive/jSO
A '2' divisor allows slightly more folding:
https://rise4fun.com/Alive/tDBM
Any chance to remove an 'srem' use is probably worthwhile, but this is limited
to the one-use improvement case because doing more may expose other missing
folds. That means it does nothing for PR21929 yet:
https://bugs.llvm.org/show_bug.cgi?id=21929
Differential Revision: https://reviews.llvm.org/D67334
llvm-svn: 371610
Guillaume Chatelet [Wed, 11 Sep 2019 11:16:48 +0000 (11:16 +0000)]
[Alignment] Use llvm::Align in MachineFunction and TargetLowering - fixes mir parsing
Summary:
This catches malformed mir files which specify alignment as log2 instead of pow2.
See https://reviews.llvm.org/D65945 for reference,
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790
Reviewers: courbet
Subscribers: MatzeB, qcolombet, dschuff, arsenm, sdardis, nemanjai, jvesely, nhaehnle, hiraditya, kbarton, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, jsji, Petar.Avramovic, asbirlea, s.egerton, pzheng, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67433
llvm-svn: 371608
Simon Atanasyan [Wed, 11 Sep 2019 11:16:06 +0000 (11:16 +0000)]
[mips][msa] Fix infinite loop for mips.nori.b intrinsic
When value of immediate in `mips.nori.b` is 255 (which has all ones in
binary form as 8bit integer) DAGCombiner and Legalizer would fall in an
infinite loop. DAGCombiner would try to simplify `or %value, -1` by
turning `%value` into UNDEF. Legalizer will turn it back into `Constant<0>`
which would then be again turned into UNDEF by DAGCombiner. To avoid this
loop we make UNDEF legal for MSA int types on Mips.
Patch by Mirko Brkusanin.
Differential Revision: https://reviews.llvm.org/D67280
llvm-svn: 371607
Simon Pilgrim [Wed, 11 Sep 2019 11:12:00 +0000 (11:12 +0000)]
Fix -Wdocumentation warning - void function doesn't need a @returns. NFCI.
llvm-svn: 371606
David Bolvansky [Wed, 11 Sep 2019 10:59:47 +0000 (10:59 +0000)]
[Diagnostics] Add -Wsizeof-array-div
Summary: Clang version of https://www.viva64.com/en/examples/v706/
Reviewers: rsmith
Differential Revision: https://reviews.llvm.org/D67287
llvm-svn: 371605
David Bolvansky [Wed, 11 Sep 2019 10:51:26 +0000 (10:51 +0000)]
[NFC] Updated objsize-64.ll test
llvm-svn: 371604
David Bolvansky [Wed, 11 Sep 2019 10:42:30 +0000 (10:42 +0000)]
[NFC] Fixed test
llvm-svn: 371603
David Bolvansky [Wed, 11 Sep 2019 10:37:03 +0000 (10:37 +0000)]
[InstCombine] Fixed handling of isOpNewLike (PR11748)
llvm-svn: 371602
Florian Hahn [Wed, 11 Sep 2019 10:32:15 +0000 (10:32 +0000)]
[LoopInterchange] Drop unused splitInnerLoopHeader declaration.
llvm-svn: 371601
Konrad Kleine [Wed, 11 Sep 2019 10:12:36 +0000 (10:12 +0000)]
[LLDB][ELF] Fixup for comments in D67390
llvm-svn: 371600
Konrad Kleine [Wed, 11 Sep 2019 10:00:30 +0000 (10:00 +0000)]
[LLDB][ELF] Load both, .symtab and .dynsym sections
Summary:
This change ensures that the .dynsym section will be parsed even when there's already is a .symtab.
It is motivated because of minidebuginfo (https://sourceware.org/gdb/current/onlinedocs/gdb/MiniDebugInfo.html#MiniDebugInfo).
There it says:
Keep all the function symbols not already in the dynamic symbol table.
That means the .symtab embedded inside the .gnu_debugdata does NOT contain the symbols from .dynsym. But in order to put a breakpoint on all symbols we need to load both. I hope this makes sense.
My other patch D66791 implements support for minidebuginfo, that's why I need this change.
Reviewers: labath, espindola, alexshap
Subscribers: JDevlieghere, emaste, arichardson, MaskRay, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D67390
llvm-svn: 371599
Dmitri Gribenko [Wed, 11 Sep 2019 09:16:17 +0000 (09:16 +0000)]
Revert "clang-misexpect: Profile Guided Validation of Performance Annotations in LLVM"
This reverts commit r371584. It introduced a dependency from compiler-rt
to llvm/include/ADT, which is problematic for multiple reasons.
One is that it is a novel dependency edge, which needs cross-compliation
machinery for llvm/include/ADT (yes, it is true that right now
compiler-rt included only header-only libraries, however, if we allow
compiler-rt to depend on anything from ADT, other libraries will
eventually get used).
Secondly, depending on ADT from compiler-rt exposes ADT symbols from
compiler-rt, which would cause ODR violations when Clang is built with
the profile library.
llvm-svn: 371598
Diogo N. Sampaio [Wed, 11 Sep 2019 09:06:17 +0000 (09:06 +0000)]
[ARM] Take into account -mcpu and -mfpu options while handling 'crypto' feature
Submittin in behalf of krisb (Kristina Bessonova) <ch.bessonova@gmail.com>
Summary:
'+crypto' means '+aes' and '+sha2' for arch >= ARMv8 when they were
not disabled explicitly. But this is correctly handled only in case of
'-march' option, though the feature may also be specified through
the '-mcpu' or '-mfpu' options. In the following example:
$ clang -mcpu=cortex-a57 -mfpu=crypto-neon-fp-armv8
'aes' and 'sha2' are disabled that is quite unexpected:
$ clang -cc1 -triple armv8--- -target-cpu cortex-a57
<...> -target-feature -sha2 -target-feature -aes -target-feature +crypto
This exposed by https://reviews.llvm.org/D63936 that makes
the 'aes' and 'sha2' features disabled by default.
So, while handling the 'crypto' feature we need to take into account:
- a CPU name, as it provides the information about architecture
(if no '-march' option specified),
- features, specified by the '-mcpu' and '-mfpu' options.
Reviewers: SjoerdMeijer, ostannard, labrinea, dnsampaio
Reviewed By: dnsampaio
Subscribers: ikudrin, javed.absar, kristof.beyls, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66018
Author: krisb
llvm-svn: 371597
David Zarzycki [Wed, 11 Sep 2019 08:32:37 +0000 (08:32 +0000)]
[LLDB] Do not try to canonicalize gethostname() result
This code is trying too hard and failing. Either the result of
gethostname() is canonical or it is not. If it is not, then trying to
canonicalize it is – for various reasons – a lost cause. For example, a
given machine might have multiple network interfaces with multiple
addresses per interface, each with a different canonical name.
Separably, the result of HostInfoPosix::GetHostname() and latency
thereof shouldn't depend on whether networking is up or down or what
network the machine happened to be attached to at any given moment (like
a laptop that travels between work and home).
https://reviews.llvm.org/D67230
llvm-svn: 371596
Florian Hahn [Wed, 11 Sep 2019 08:23:23 +0000 (08:23 +0000)]
[LoopInterchange] Properly move condition, induction increment and ops to latch.
Currently we only rely on the induction increment to come before the
condition to ensure the required instructions get moved to the new
latch.
This patch duplicates and moves the required instructions to the
newly created latch. We move the condition to the end of the new block,
then process its operands. We stop at operands that are defined
outside the loop, or are the induction PHI.
We duplicate the instructions and update the uses in the moved
instructions, to ensure other users remain intact. See the added
test2 for such an example.
Reviewers: efriedma, mcrosier
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D67367
llvm-svn: 371595
Sam Parker [Wed, 11 Sep 2019 08:17:48 +0000 (08:17 +0000)]
[NFC][ARM] Add and modify tests
Add test for ParallelDSP.
llvm-svn: 371594
Fangrui Song [Wed, 11 Sep 2019 07:38:21 +0000 (07:38 +0000)]
[LTO] Avoid calling GlobalValue::getGUID (MD5) twice
llvm-svn: 371593
Tim Renouf [Wed, 11 Sep 2019 07:26:39 +0000 (07:26 +0000)]
[TLI][AMDGPU] AMDPAL does not have library functions
Configure TLI to say that r600/amdgpu does not have any library
functions, such that InstCombine does not do anything like turn sin/cos
into the library function @tan with sufficient fast math flags.
Differential Revision: https://reviews.llvm.org/D67406
Change-Id: I02f907d3e64832117ea9800e9f9285282856e5df
llvm-svn: 371592
Fangrui Song [Wed, 11 Sep 2019 07:23:35 +0000 (07:23 +0000)]
[llvm-objcopy] Simplify --prefix-alloc-sections
Handle --prefix-alloc-sections after --rename-sections so that --prefix-alloc-sections code
does not have to check if renaming has been performed.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D66931
llvm-svn: 371591
Hideto Ueno [Wed, 11 Sep 2019 07:00:33 +0000 (07:00 +0000)]
[Attributor] Implement "noalias" callsite argument deduction
Summary: Now, `nocapture` is deduced in Attributor therefore, this patch introduces deduction for `noalias` callsite argument using `nocapture`.
Reviewers: jdoerfert, sstefan1
Reviewed By: jdoerfert
Subscribers: lebedev.ri, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67286
llvm-svn: 371590
Hideto Ueno [Wed, 11 Sep 2019 06:52:11 +0000 (06:52 +0000)]
[Attributor][Fix] Manifest nocapture only in CSArgument or Argument
Summary:
We can query to Attributor whether the value is captured in the scope or not on the following way:
```
const auto & NoCapAA = A.getAAFor<AANoCapture>(*this, IRPosition::value(V));
```
And if V is CallSiteReturned then `getDeducedAttribute` will add `nocatpure` to the callsite returned value. It is not valid.
This patch checks the position is an argument or call site argument.
This is tested in D67286.
Reviewers: jdoerfert, sstefan1
Reviewed By: jdoerfert
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67342
llvm-svn: 371589
Fangrui Song [Wed, 11 Sep 2019 06:20:14 +0000 (06:20 +0000)]
[ELF][test] Make tests more tolerant to exact symbol addresses
llvm-svn: 371588
Alexey Lapshin [Wed, 11 Sep 2019 06:07:16 +0000 (06:07 +0000)]
[Debuginfo][Instcombiner] Do not clone dbg.declare.
TryToSinkInstruction() has a bug: While updating debug info for
sunk instruction, it could clone dbg.declare intrinsic.
That is wrong. There could be only one dbg.declare.
The fix is to not clone dbg.declare intrinsic and to update
it`s arguments, to not to point to sunk instruction.
Differential Revision: https://reviews.llvm.org/D67217
llvm-svn: 371587
Fangrui Song [Wed, 11 Sep 2019 01:54:48 +0000 (01:54 +0000)]
[CodeGen] Add alias for cpu_dispatch function with IFunc & Fix resolver linkage type
Multi-versioned functions defined by cpu_dispatch and implemented with IFunc
can not be called outside the translation units where they are defined due to
lack of symbols. This patch add function aliases for these functions and thus
make them visible outside.
Differential Revision: https://reviews.llvm.org/D67058
Patch by Senran Zhang
llvm-svn: 371586
Fangrui Song [Wed, 11 Sep 2019 01:49:00 +0000 (01:49 +0000)]
[llvm-nm] Fix -DBUILD_SHARED_LIBS=ON builds after D66160/r371576
llvm-svn: 371585
Petr Hosek [Wed, 11 Sep 2019 01:09:16 +0000 (01:09 +0000)]
clang-misexpect: Profile Guided Validation of Performance Annotations in LLVM
This patch contains the basic functionality for reporting potentially
incorrect usage of __builtin_expect() by comparing the developer's
annotation against a collected PGO profile. A more detailed proposal and
discussion appears on the CFE-dev mailing list
(http://lists.llvm.org/pipermail/cfe-dev/2019-July/062971.html) and a
prototype of the initial frontend changes appear here in D65300
We revised the work in D65300 by moving the misexpect check into the
LLVM backend, and adding support for IR and sampling based profiles, in
addition to frontend instrumentation.
We add new misexpect metadata tags to those instructions directly
influenced by the llvm.expect intrinsic (branch, switch, and select)
when lowering the intrinsics. The misexpect metadata contains
information about the expected target of the intrinsic so that we can
check against the correct PGO counter when emitting diagnostics, and the
compiler's values for the LikelyBranchWeight and UnlikelyBranchWeight.
We use these branch weight values to determine when to emit the
diagnostic to the user.
A future patch should address the comment at the top of
LowerExpectIntrisic.cpp to hoist the LikelyBranchWeight and
UnlikelyBranchWeight values into a shared space that can be accessed
outside of the LowerExpectIntrinsic pass. Once that is done, the
misexpect metadata can be updated to be smaller.
In the long term, it is possible to reconstruct portions of the
misexpect metadata from the existing profile data. However, we have
avoided this to keep the code simple, and because some kind of metadata
tag will be required to identify which branch/switch/select instructions
are influenced by the use of llvm.expect
Patch By: paulkirth
Differential Revision: https://reviews.llvm.org/D66324
llvm-svn: 371584
Jason Molenda [Wed, 11 Sep 2019 01:03:24 +0000 (01:03 +0000)]
Ah, only skip this for embedded darwin targets.
llvm-svn: 371583
Jason Molenda [Wed, 11 Sep 2019 01:02:30 +0000 (01:02 +0000)]
Skip a test in TestProcessIO.py when running against ios devices.
llvm-svn: 371582
Reid Kleckner [Wed, 11 Sep 2019 01:01:06 +0000 (01:01 +0000)]
Emit -Wmicrosoft-enum-value warning instead of error in MS ABI
Summary:
The first NFC change is to replace a getCXXABI().isMicrosoft() check
with getTriple().isWindowsMSVCEnvironment(). This code takes effect in
non-C++ compilations, so it doesn't make sense to check the C++ ABI. In
the MS ABI, enums are always considered to be "complete" because the
underlying type of an unfixed enum will always be 'int'. This behavior
was moved from -fms-compatibility to MS ABI back in r249656.
The second change is functional, and it downgrades an error to a warning
when the MS ABI is used rather than only under -fms-compatibility. The
reasoning is that it's unreasonable for the following code to reject the
following code for all MS ABI targets with -fno-ms-compatibility:
enum Foo { Foo_Val = 0xDEADBEEF };
This is valid code for any other target, but in the MS ABI, Foo_Val just
happens to be negative. With this change, clang emits a
-Wmicrosoft-enum-value warning on this code, but compiles it without
error.
Fixes PR38478
Reviewers: hans, rsmith, STL_MSFT
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D67304
llvm-svn: 371581
David Blaikie [Wed, 11 Sep 2019 00:44:17 +0000 (00:44 +0000)]
Revert "llvm-reduce: Add pass to reduce parameters"
Looks to be failing on asan buildbots
This reverts commit r371567.
llvm-svn: 371580
Petr Hosek [Wed, 11 Sep 2019 00:43:35 +0000 (00:43 +0000)]
Revert "Adding support for overriding LLVM_ENABLE_RUNTIMES for runtimes builds."
This reverts commit r371566: this doesn't correctly handle the case
where LLVM_ENABLE_RUNTIMES contains a list of values.
llvm-svn: 371579
Jan Korous [Wed, 11 Sep 2019 00:30:26 +0000 (00:30 +0000)]
[clang-scan-deps][NFC] Fix tests - prevent FileCheck matching test dir path
Differential Revision: https://reviews.llvm.org/D67379
llvm-svn: 371578
Cyndy Ishida [Wed, 11 Sep 2019 00:13:01 +0000 (00:13 +0000)]
[Object][TextAPI] NFC, fix tapi lit tests
FileCheck command had wrong casing, which works fine on macOS, repairs the linux build bots
llvm-svn: 371577
Cyndy Ishida [Wed, 11 Sep 2019 00:00:53 +0000 (00:00 +0000)]
[llvm-nm] Add tapi file support
Summary:
This commit is the final one for adding tapi support to the llvm-nm implementation.
This commit also has accompanying tests the additions to lib/Object
Reviewers: ributzka, steven_wu
Reviewed By: ributzka
Subscribers: hiraditya, plotfi, dexonsmith, rupprecht, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66160
llvm-svn: 371576