Peter Collingbourne [Tue, 24 Jul 2018 19:34:37 +0000 (19:34 +0000)]
Put "built-in" function definitions in global Used list, for LTO. (fix bug 34169)
When building with LTO, builtin functions that are defined but whose calls have not been inserted yet, get internalized. The Global Dead Code Elimination phase in the new LTO implementation then removes these function definitions. Later optimizations add calls to those functions, and the linker then dies complaining that there are no definitions. This CL fixes the new LTO implementation to check if a function is builtin, and if so, to not internalize (and later DCE) the function. As part of this fix I needed to move the RuntimeLibcalls.{def,h} files from the CodeGen subidrectory to the IR subdirectory. I have updated all the files that accessed those two files to access their new location.
Fixes PR34169
Patch by Caroline Tice!
Differential Revision: https://reviews.llvm.org/D49434
llvm-svn: 337847
Chandler Carruth [Tue, 24 Jul 2018 19:04:37 +0000 (19:04 +0000)]
[x86] Teach the x86 backend that it can fold between TCRETURNm* and TCRETURNr* and fix latent bugs with register class updates.
Summary:
Enabling this fully exposes a latent bug in the instruction folding: we
never update the register constraints for the register operands when
fusing a load into another operation. The fused form could, in theory,
have different register constraints on its operands. And in fact,
TCRETURNm* needs its memory operands to use tailcall compatible
registers.
I've updated the folding code to re-constrain all the registers after
they are mapped onto their new instruction.
However, we still can't enable folding in the general case from
TCRETURNr* to TCRETURNm* because doing so may require more registers to
be available during the tail call. If the call itself uses all but one
register, and the folded load would require both a base and index
register, there will not be enough registers to allocate the tail call.
It would be better, IMO, to teach the register allocator to *unfold*
TCRETURNm* when it runs out of registers (or specifically check the
number of registers available during the TCRETURNr*) but I'm not going
to try and solve that for now. Instead, I've just blocked the forward
folding from r -> m, leaving LLVM free to unfold from m -> r as that
doesn't introduce new register pressure constraints.
The down side is that I don't have anything that will directly exercise
this. Instead, I will be immediately using this it my SLH patch. =/
Still worse, without allowing the TCRETURNr* -> TCRETURNm* fold, I don't
have any tests that demonstrate the failure to update the memory operand
register constraints. This patch still seems correct, but I'm nervous
about the degree of testing due to this.
Suggestions?
Reviewers: craig.topper
Subscribers: sanjoy, mcrosier, hiraditya, llvm-commits
Differential Revision: https://reviews.llvm.org/D49717
llvm-svn: 337845
Craig Topper [Tue, 24 Jul 2018 18:49:00 +0000 (18:49 +0000)]
[Inliner] Teach inliner to merge 'min-legal-vector-width' function attribute
When we inline a function with a min-legal-vector-width attribute we need to make sure the caller also ends up with at least that vector width.
This patch is necessary to make always_inline functions like intrinsics propagate their min-legal-vector-width. Though nothing uses min-legal-vector-width yet.
A future patch will add heuristics to preventing inlining with different vector width mismatches. But that code would need to be in inline cost analysis which is separate from the code added here.
Differential Revision: https://reviews.llvm.org/D49162
llvm-svn: 337844
Craig Topper [Tue, 24 Jul 2018 18:36:46 +0000 (18:36 +0000)]
[X86] Add test case to show failure to combine away negates that may be created by mul by constant expansion.
Mul by constant can expand to a sequence that ends with a negate. If the next instruction is an add or sub we might be able to fold the negate away.
We currently fail to do this because we explicitly don't add anything to the DAG combine worklist when we expand multiplies. This is primarily to keep the multipy from being reformed, but we should consider adding the users to worklist.
llvm-svn: 337843
Azharuddin Mohammed [Tue, 24 Jul 2018 18:34:13 +0000 (18:34 +0000)]
[docker] Fix LLVM_EXTERNAL_PROJECTS cmake variable value
Summary:
LLVM_ENABLE_PROJECTS expects a semicolon separated project list.
Fixes PR38158.
Reviewers: ilya-biryukov
Reviewed By: ilya-biryukov
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D49712
llvm-svn: 337842
Jessica Paquette [Tue, 24 Jul 2018 17:42:11 +0000 (17:42 +0000)]
[MachineOutliner][NFC] Make Candidates own their call information
Before this, TCI contained all the call information for each Candidate.
This moves that information onto the Candidates. As a result, each Candidate
can now supply how it ought to be called. Thus, Candidates will be able to,
say, call the same function in cheaper ways when possible. This also removes
that information from TCI, since it's no longer used there.
A follow-up patch for the AArch64 outliner will demonstrate this.
llvm-svn: 337840
Jessica Paquette [Tue, 24 Jul 2018 17:37:28 +0000 (17:37 +0000)]
[MachineOutliner][NFC] Move missed opt remark into its own function
Having the missed remark code in the middle of `findCandidates` made the
function hard to follow. This yanks that out into a new function,
`emitNotOutliningCheaperRemark`.
llvm-svn: 337839
Jessica Paquette [Tue, 24 Jul 2018 17:36:13 +0000 (17:36 +0000)]
[MachineOutliner][NFC] Sink some candidate logic into OutlinedFunction
Just some simple gardening to improve clarity.
Before, we had something along the lines of
1) Create a std::vector of Candidates
2) Create an OutlinedFunction
3) Create a std::vector of pointers to Candidates
4) Copy those over to the OutlinedFunction and the Candidate list
Now, OutlinedFunctions create the Candidate pointers. They're still copied
over to the main list of Candidates, but it makes it a bit clearer what's
going on.
llvm-svn: 337838
Kuba Mracek [Tue, 24 Jul 2018 16:19:06 +0000 (16:19 +0000)]
[tsan] Fix crash in objc_sync_enter/objc_sync_exit when using an Obj-C tagged pointer
Objective-C tagged pointers (either bottom-most or top-most bit is 1) are valid Obj-C objects but are not valid pointers. Make sure we don't crash on them when used in objc_sync_enter/objc_sync_exit. Instead, let's synchronize on a global object.
Differential Revision: https://reviews.llvm.org/D49707
llvm-svn: 337837
Erich Keane [Tue, 24 Jul 2018 16:11:30 +0000 (16:11 +0000)]
Remove stale documentation from InternalsManual.rst
The DuplicatesAllowedWhileMerging was removed a while ago,
but the documentation remained.
llvm-svn: 337835
Sam McCall [Tue, 24 Jul 2018 16:00:55 +0000 (16:00 +0000)]
[VFS] Cleanups to VFS interfaces.
Summary:
- add comments clarifying semantics
- Status::copyWithNewName(Status, Name) --> instance method
- Status::copyWithNewName(fs::file_status, Name) --> constructor (it's not a copy)
- File::getName() -> getRealPath(), reflecting its actual behavior/function
and stop returning status().getName() in the base class (callers can do this
fallback if they want to, it complicates the contracts).
This is mostly NFC, but the behavior of File::getName() affects FileManager's
FileEntry::tryGetRealPathName(), which now fails in more cases:
- non-real file cases
- real-file cases where the underlying vfs::File was opened in a way that
doesn't call realpath().
(In these cases we don't know a distinct real name, so in principle it seems OK)
Reviewers: klimek
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D49724
llvm-svn: 337834
Petr Hosek [Tue, 24 Jul 2018 15:49:29 +0000 (15:49 +0000)]
[CMake] Fix the setting of LIBCXX_HEADER_DIR in standalone build
This is an alternative approach to r337727 which broke the build
because libc++ headers were copied into the location outside of
directories used by Clang. This change sets LIBCXX_HEADER_DIR to
different values depending on whether libc++ is being built as
part of LLVM w/ per-target multiarch runtime, LLVM or standalone.
Differential Revision: https://reviews.llvm.org/D49711
llvm-svn: 337833
Pavel Labath [Tue, 24 Jul 2018 15:48:13 +0000 (15:48 +0000)]
Move dumping code out of RegisterValue class
Summary:
The dump function was the only part of this class which depended on
high-level functionality. This was due to the DumpDataExtractor
function, which uses info from a running target to control dump format
(although, RegisterValue doesn't really use the high-level part of
DumpDataExtractor).
This patch follows the same approach done for the DataExtractor class,
and extracts the dumping code into a separate function/file. This file
can stay in the higher level code, while the RegisterValue class and
anything that does not depend in dumping can stay go to lower layers.
The XCode project will need to be updated after this patch.
Reviewers: zturner, jingham, clayborg
Subscribers: lldb-commits, mgorny
Differential Revision: https://reviews.llvm.org/D48351
llvm-svn: 337832
Joel Galenson [Tue, 24 Jul 2018 15:21:54 +0000 (15:21 +0000)]
Use SCEV to avoid inserting some bounds checks.
This patch uses SCEV to avoid inserting some bounds checks when they are not needed. This slightly improves the performance of code compiled with the bounds check sanitizer.
Differential Revision: https://reviews.llvm.org/D49602
llvm-svn: 337830
Sid Manning [Tue, 24 Jul 2018 15:08:13 +0000 (15:08 +0000)]
[ELF][HEXAGON] Add R_HEX_B15_PCREL_X relocation
Update testcase
Differential Revision: https://reviews.llvm.org/D49567
llvm-svn: 337829
Florian Hahn [Tue, 24 Jul 2018 14:49:52 +0000 (14:49 +0000)]
[PredicateInfo] Use custom mangling to support ssa_copy with unnamed types.
This is a workaround and it would be better to fix this generally, but
doing it generally is quite tricky. See D48541 and PR38117.
Doing it in PredicateInfo directly allows us to use the type address to
differentiate different unnamed types, because neither the created
declarations nor the ssa_copy calls should be visible after
PredicateInfo got destroyed.
Reviewers: efriedma, davide
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D49126
llvm-svn: 337828
Simon Atanasyan [Tue, 24 Jul 2018 13:47:52 +0000 (13:47 +0000)]
[mips] Fix local dynamic TLS with Sym64
For the final DTPREL addition, rather than a lui/daddiu/daddu triple,
LLVM was erronously emitting a daddiu/daddiu pair, treating the %dtprel_hi
as if it were a %dtprel_lo, since Mips::Hi expands unshifted for Sym64.
Instead, use a new TlsHi node and, although unnecessary due to the exact
structure of the nodes emitted, use TlsHi for local exec too to prevent
future bugs. Also garbage-collect the unused TprelLo and TlsGd nodes,
and TprelHi since its functionality is provided by the new common TlsHi node.
Patch by James Clarke.
Differential revision: https://reviews.llvm.org/D49259
llvm-svn: 337827
Igor Kudrin [Tue, 24 Jul 2018 13:06:19 +0000 (13:06 +0000)]
[profile] Fix finding the first and last directory separators on Windows.
Until now, our code preferred backslashes to slashes, whereas Windows
allows using both types of directory separators in one path string.
Differential Revision: https://reviews.llvm.org/D49664
llvm-svn: 337826
Chandler Carruth [Tue, 24 Jul 2018 12:44:00 +0000 (12:44 +0000)]
[x86/SLH] Extract the core register hardening logic to a low-level
helper and restructure the post-load hardening to use this.
This isn't as trivial as I would have liked because the post-load
hardening used a trick that only works for it where it swapped in
a temporary register to the load rather than replacing anything.
However, there is a simple way to do this without that trick that allows
this to easily reuse a friendly API for hardening a value in a register.
That API will in turn be usable in subsequent patcehs.
This also techincally changes the position at which we insert the subreg
extraction for the predicate state, but that never resulted in an actual
instruction and so tests don't change at all.
llvm-svn: 337825
Alexander Richardson [Tue, 24 Jul 2018 12:40:56 +0000 (12:40 +0000)]
Stop wrapping __has_include in another macro
Summary:
This is not guaranteed to work since the characters after '__has_include('
have special lexing rules that can't possibly be applied when
__has_include is generated by a macro. It also breaks the crash reproducers
generated by -frewrite-includes (see https://llvm.org/pr37990).
Reviewers: EricWF, rsmith, mclow.lists
Reviewed By: mclow.lists
Differential Revision: https://reviews.llvm.org/D49067
llvm-svn: 337824
Igor Kudrin [Tue, 24 Jul 2018 12:28:53 +0000 (12:28 +0000)]
[profile] Fix a possible memory leak in parseFilenamePattern().
Differential Revision: https://reviews.llvm.org/D49666
llvm-svn: 337823
Chandler Carruth [Tue, 24 Jul 2018 12:19:01 +0000 (12:19 +0000)]
[x86/SLH] Tidy up a comment, using doxygen structure and wording it to
be more accurate and understandable.
llvm-svn: 337822
Sam Parker [Tue, 24 Jul 2018 12:04:23 +0000 (12:04 +0000)]
[ARM] Disable ARMCodeGenPrepare by default
ARM Stage 2 builders have been suspiciously broken since the pass was
committed. Disabling to hopefully fix the bots and give me time to
debug.
llvm-svn: 337821
Duncan P. N. Exon Smith [Tue, 24 Jul 2018 11:32:13 +0000 (11:32 +0000)]
ADT: Shrink SmallVector size 0 to 16B on 64-bit platforms
SmallVectorTemplateCommon wants to know the address of the first element
so it can detect whether it's in "small size" mode.
The old implementation split the small array, creating the storage for
the first element in SmallVectorTemplateCommon, and pulling the rest
into SmallVectorStorage where we know the size of the array. This
bloats SmallVector size 0 by the larger of sizeof(void*) and sizeof(T),
and we're not even using the storage.
The new implementation leaves the full small storage to
SmallVectorStorage. To calculate the offset of the first element in
SmallVectorTemplateCommon, we just need to know how far to jump, which
we can calculate out-of-band. One subtlety is that we need
SmallVectorStorage to be properly aligned even when the size is 0, to be
sure that (for large alignments) we actually have the padding and it's
well defined to do the pointer math.
llvm-svn: 337820
Pavel Labath [Tue, 24 Jul 2018 10:49:14 +0000 (10:49 +0000)]
Reimplement EventDataBytes::Dump to avoid DumpDataExtractor
This is the only external non-trivial dependency of the Event classes.
llvm-svn: 337819
Florian Hahn [Tue, 24 Jul 2018 10:32:54 +0000 (10:32 +0000)]
Recommit r334887: [SmallSet] Add SmallSetIterator.
Updated to make sure we properly construct/destroy SetIter if it has a
non-trivial ctors/dtors, like in MSVC.
llvm-svn: 337818
Eric Fiselier [Tue, 24 Jul 2018 09:15:03 +0000 (09:15 +0000)]
Fix use of incorrect _LIBCXX macro (should be _LIBCPP).
llvm-svn: 337817
Eric Liu [Tue, 24 Jul 2018 08:51:52 +0000 (08:51 +0000)]
[clangd] Tune down quality score for class constructors so that it's ranked after class types.
Summary:
Currently, class constructors have the same score as the class types, and they
are often ranked before class types. This is often not desireable and can
be annoying when snippet is enabled and constructor signatures are added.
Metrics:
```
==================================================================================================
OVERALL
==================================================================================================
Total measurements: 111117 (+0)
All measurements:
MRR: 64.06 (+0.20) Top-5: 75.73% (+0.14%) Top-100: 93.71% (+0.01%)
Full identifiers:
MRR: 98.25 (+0.55) Top-5: 99.04% (+0.03%) Top-100: 99.16% (+0.00%)
Filter length 0-5:
MRR: 15.23 (+0.02) 50.50 (-0.02) 65.04 (+0.11) 70.75 (+0.19) 74.37 (+0.25) 79.43 (+0.32)
Top-5: 40.90% (+0.03%) 74.52% (+0.03%) 87.23% (+0.15%) 91.68% (+0.08%) 93.68% (+0.14%) 95.87% (+0.12%)
Top-100: 68.21% (+0.02%) 96.28% (+0.07%) 98.43% (+0.00%) 98.72% (+0.00%) 98.74% (+0.01%) 98.81% (+0.00%)
==================================================================================================
DEFAULT
==================================================================================================
Total measurements: 57535 (+0)
All measurements:
MRR: 58.07 (+0.37) Top-5: 69.94% (+0.26%) Top-100: 90.14% (+0.03%)
Full identifiers:
MRR: 97.13 (+1.05) Top-5: 98.14% (+0.06%) Top-100: 98.34% (+0.00%)
Filter length 0-5:
MRR: 13.91 (+0.00) 38.53 (+0.01) 55.58 (+0.21) 63.63 (+0.30) 69.23 (+0.47) 72.87 (+0.60)
Top-5: 24.99% (+0.00%) 62.70% (+0.06%) 82.80% (+0.30%) 88.66% (+0.16%) 92.02% (+0.27%) 93.53% (+0.21%)
Top-100: 51.56% (+0.05%) 93.19% (+0.13%) 97.30% (+0.00%) 97.81% (+0.00%) 97.85% (+0.01%) 97.79% (+0.00%)
```
Remark:
- The full-id completions have +1.05 MRR improvement.
- There is no noticeable impact on EXPLICIT_MEMBER_ACCESS and WANT_LOCAL.
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D49667
llvm-svn: 337816
Roman Lebedev [Tue, 24 Jul 2018 08:16:50 +0000 (08:16 +0000)]
[Sema] Mark implicitly-inserted ICE's as being part of explicit cast (PR38166)
Summary:
As discussed in [[ https://bugs.llvm.org/show_bug.cgi?id=38166 | PR38166 ]], we need to be able to distinqush whether the cast
we are visiting is actually a cast, or part of an `ExplicitCast`.
There are at least four ways to get there:
1. Introduce a new `CastKind`, and use it instead of `IntegralCast` if we are in `ExplicitCast`.
Would work, but does not scale - what if we will need more of these cast kinds?
2. Introduce a flag in `CastExprBits`, whether this cast is part of `ExplicitCast` or not.
Would work, but it isn't immediately clear where it needs to be set.
2. Fix `ScalarExprEmitter::VisitCastExpr()` to visit these `NoOp` casts.
As pointed out by @rsmith, CodeGenFunction::EmitMaterializeTemporaryExpr calls
skipRValueSubobjectAdjustments, which steps over the CK_NoOp cast`,
which explains why we currently don't visit those.
This is probably impossible, as @efriedma points out, that is intentional as per `[class.temporary]` in the standard
3. And the simplest one, just record which NoOp casts we skip.
It just kinda works as-is afterwards.
But, the approach with a flag is the least intrusive one, and is probably the best one overall.
Reviewers: rsmith, rjmccall, majnemer, efriedma
Reviewed By: rsmith
Subscribers: cfe-commits, aaron.ballman, vsk, llvm-commits, rsmith
Differential Revision: https://reviews.llvm.org/D49508
llvm-svn: 337815
Petr Hosek [Tue, 24 Jul 2018 07:06:17 +0000 (07:06 +0000)]
Reland "[CMake] Support statically linking dependencies only to shared or static library"
This is a reland of commit r337668.
llvm-svn: 337814
Jiading Gai [Tue, 24 Jul 2018 06:49:27 +0000 (06:49 +0000)]
Add a .keep file to prevent svn from skipping over an empty folder.
llvm-svn: 337813
Shiva Chen [Tue, 24 Jul 2018 06:17:45 +0000 (06:17 +0000)]
Revert "[DebugInfo] Generate DWARF debug information for labels."
This reverts commit
b454fa1b4079b6c0a5b1565982d16516385838d7.
llvm-svn: 337812
Jiading Gai [Tue, 24 Jul 2018 06:07:22 +0000 (06:07 +0000)]
For x86_64, gcc 7.2 under Amazon Linux AMI sets its path to x86_64-amazon-linux.
gcc 7.2 under Amazon Linux AMI sets its paths to x86_64-amazon-linux. Adding
this triple to the list of search, plus a test case to cover this.
The patch fixes the following bug reported in bugzilla:
https://bugs.llvm.org/show_bug.cgi?id=35992
Reviewers: echristo
Differential Revision: https://reviews.llvm.org/D46230
llvm-svn: 337811
Simon Atanasyan [Tue, 24 Jul 2018 05:40:37 +0000 (05:40 +0000)]
[ELF][MIPS] Fix primary GOT sometimes overflowing by one or two words
If we fail to merge a secondary GOT with the primary GOT but so far only
one merged GOT has been created (the primary one), the final element in
MergedGots is the primary GOT. Thus we should not try to merge with this
final element passing IsPrimary=false, since this will ignore the fact
that the destination GOT does in fact need a header, and those extra two
entries can be enough to allow the merge to incorrectly occur. Instead
we should check for this case before attempting the second merge.
Patch by James Clarke.
Differential revision: https://reviews.llvm.org/D49422
llvm-svn: 337810
Marshall Clow [Tue, 24 Jul 2018 03:56:38 +0000 (03:56 +0000)]
fix nesting of namespace and standard-version check. Also include <__config>
llvm-svn: 337809
Marshall Clow [Tue, 24 Jul 2018 03:41:36 +0000 (03:41 +0000)]
Disable 'suggest braces' warnings for std::array in tests
llvm-svn: 337808
Jiading Gai [Tue, 24 Jul 2018 03:34:15 +0000 (03:34 +0000)]
[Test commit] Fix a spelling error.
llvm-svn: 337807
Chandler Carruth [Tue, 24 Jul 2018 03:18:08 +0000 (03:18 +0000)]
[x86] Clean up and convert test to use generated CHECK lines.
This test was already checking microscopic behavior of tail call under
specific conditions. This just makes the CHECK lines much more
consistent, clear, and easily updated when intentional changes are made.
I've also switched the test to consistently name the entry block and to
order the helper declarations and comments for specific tests in the
more usual locations.
llvm-svn: 337806
Chandler Carruth [Tue, 24 Jul 2018 03:07:07 +0000 (03:07 +0000)]
[x86] Update the CHECK lines of this test to use the latest patterns
from the script. This minimizes the diff in subsequent changes.
llvm-svn: 337805
Marshall Clow [Tue, 24 Jul 2018 03:01:02 +0000 (03:01 +0000)]
Implement <span>. Reviewed as https://reviews.llvm.org/D49338
llvm-svn: 337804
Shiva Chen [Tue, 24 Jul 2018 02:57:11 +0000 (02:57 +0000)]
Revert "[DebugInfo] Generate debug information for labels. (Fix PR37395)"
This reverts commit
4288dd3bf082482e02c8a044c611c18168cb0180.
llvm-svn: 337803
Petr Hosek [Tue, 24 Jul 2018 02:34:24 +0000 (02:34 +0000)]
[sanitizer][fuzzer] Temporarily transition to ZX_TIME_INFINITE_OLD
This is a preparation for breaking change when all Zircon calls that
take time as an argument will start using signed valued. We will
transition back to ZX_TIME_INFITINE after all the changes to these
symbols are done and become part of the Fuchsia SDK.
Differential Revision: https://reviews.llvm.org/D49694
llvm-svn: 337802
Petr Hosek [Tue, 24 Jul 2018 02:28:54 +0000 (02:28 +0000)]
[sanitizer] Transition from _zx_vmar_... to _zx_vmar_..._old calls
This is a preparation for breaking changes to _zx_vmar_... calls.
We will transition back to _zx_vmar_... after all the changes to
these symbols are done and become part of the Fuchsia SDK.
Differential Revision: https://reviews.llvm.org/D49697
llvm-svn: 337801
Shiva Chen [Tue, 24 Jul 2018 02:23:59 +0000 (02:23 +0000)]
[DebugInfo] Generate debug information for labels. (Fix PR37395)
Generate DILabel metadata and call llvm.dbg.label after label
statement to associate the metadata with the label.
After fixing PR37395.
Differential Revision: https://reviews.llvm.org/D45045
Patch by Hsiangkai Wang.
llvm-svn: 337800
Shiva Chen [Tue, 24 Jul 2018 02:22:55 +0000 (02:22 +0000)]
[DebugInfo] Generate DWARF debug information for labels.
There are two forms for label debug information in DWARF format.
1. Labels in a non-inlined function:
DW_TAG_label
DW_AT_name
DW_AT_decl_file
DW_AT_decl_line
DW_AT_low_pc
2. Labels in an inlined function:
DW_TAG_label
DW_AT_abstract_origin
DW_AT_low_pc
We will collect label information from DBG_LABEL. Before every DBG_LABEL,
we will generate a temporary symbol to denote the location of the label.
The symbol could be used to get DW_AT_low_pc afterwards. So, we create a
mapping between 'inlined label' and DBG_LABEL MachineInstr in DebugHandlerBase.
The DBG_LABEL in the mapping is used to query the symbol before it.
The AbstractLabels in DwarfCompileUnit is used to process labels in inlined
functions.
We also keep a mapping between scope and labels in DwarfFile to help to
generate correct tree structure of DIEs.
Differential Revision: https://reviews.llvm.org/D45556
Patch by Hsiangkai Wang.
llvm-svn: 337799
Tom Stellard [Tue, 24 Jul 2018 02:19:20 +0000 (02:19 +0000)]
AMDGPU/GlobalISel: Legalize G_INSERT
Reviewers: arsenm
Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, rovka, kristof.beyls, dstuttard, tpr, t-tye, llvm-commits
Differential Revision: https://reviews.llvm.org/D49601
llvm-svn: 337798
Yaxun Liu [Tue, 24 Jul 2018 02:12:24 +0000 (02:12 +0000)]
Attempt to fix regression due to r337791
llvm-svn: 337797
George Burgess IV [Tue, 24 Jul 2018 02:10:53 +0000 (02:10 +0000)]
Fix unused variable warnings; NFC
Looks like MTE was previously used for its SourceLoc, but we're now
using a seperate SourceLocation here.
llvm-svn: 337796
Dean Michael Berris [Tue, 24 Jul 2018 01:45:34 +0000 (01:45 +0000)]
llvm-xray: Broken chrome trace event format output
Summary:
Missing comma separator for EXIT and TAIL_EXIT RecordTypes emit invalid
JSON output for Chrome Trace Event Format.
Reviewers: dberris
Reviewed By: dberris
Subscribers: sammccall, kpw, llvm-commits
Differential Revision: https://reviews.llvm.org/D49687
llvm-svn: 337795
Tom Stellard [Tue, 24 Jul 2018 01:43:49 +0000 (01:43 +0000)]
AMDGPU/GlobalISel: Remove unnecessary legality constraint for G_EXTRACT
Summary:
We were marking G_EXTRACT operations unsupported if the output type
was larger than the input type. I don't see how this could ever actually
happen, so I dropped the constraint. Doing this makes it possible to
reuse the same legality code for G_INSERT.
Reviewers: arsenm
Reviewed By: arsenm
Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, rovka, kristof.beyls, dstuttard, tpr, t-tye, llvm-commits
Differential Revision: https://reviews.llvm.org/D49600
llvm-svn: 337794
Yaxun Liu [Tue, 24 Jul 2018 01:40:44 +0000 (01:40 +0000)]
[HIP] pass -target-cpu when running the device-mode compiler
Differential Revision: https://reviews.llvm.org/D49643
llvm-svn: 337793
Richard Smith [Tue, 24 Jul 2018 01:23:36 +0000 (01:23 +0000)]
Add missing testcase update for r337790.
llvm-svn: 337792
Yaxun Liu [Tue, 24 Jul 2018 01:03:44 +0000 (01:03 +0000)]
Enable .hip files for test/Driver
Partially revert r334128 due to regressions.
llvm-svn: 337791
Richard Smith [Tue, 24 Jul 2018 00:55:08 +0000 (00:55 +0000)]
Warn if a local variable's initializer retains a pointer/reference to a
non-lifetime-extended temporary object.
llvm-svn: 337790
Andres Freund [Tue, 24 Jul 2018 00:54:06 +0000 (00:54 +0000)]
Add PerfJITEventListener for perf profiling support.
This new JIT event listener supports generating profiling data for
the linux 'perf' profiling tool, allowing it to generate function and
instruction level profiles.
Currently this functionality is not enabled by default, but must be
enabled with LLVM_USE_PERF=yes. Given that the listener has no
dependencies, it might be sensible to enable by default once the
initial issues have been shaken out.
I followed existing precedent in registering the listener by default
in lli. Should there be a decision to enable this by default on linux,
that should probably be changed.
Please note that until https://reviews.llvm.org/D47343 is resolved,
using this functionality with mcjit rather than orcjit will not
reliably work.
Disregarding the previous comment, here's an example:
$ cat /tmp/expensive_loop.c
bool stupid_isprime(uint64_t num)
{
if (num == 2)
return true;
if (num < 1 || num % 2 == 0)
return false;
for(uint64_t i = 3; i < num / 2; i+= 2) {
if (num % i == 0)
return false;
}
return true;
}
int main(int argc, char **argv)
{
int numprimes = 0;
for (uint64_t num = argc; num < 100000; num++)
{
if (stupid_isprime(num))
numprimes++;
}
return numprimes;
}
$ clang -ggdb -S -c -emit-llvm /tmp/expensive_loop.c -o
/tmp/expensive_loop.ll
$ perf record -o perf.data -g -k 1 ./bin/lli -jit-kind=mcjit /tmp/expensive_loop.ll 1
$ perf inject --jit -i perf.data -o perf.jit.data
$ perf report -i perf.jit.data
- 92.59% lli jitted-5881-2.so [.] stupid_isprime
stupid_isprime
main
llvm::MCJIT::runFunction
llvm::ExecutionEngine::runFunctionAsMain
main
__libc_start_main
0x4bf6258d4c544155
+ 0.85% lli ld-2.27.so [.] do_lookup_x
And line-level annotations also work:
│ for(uint64_t i = 3; i < num / 2; i+= 2) {
│1 30: movq $0x3,-0x18(%rbp)
0.03 │1 38: mov -0x18(%rbp),%rax
0.03 │ mov -0x10(%rbp),%rcx
│ shr $0x1,%rcx
3.63 │ ┌──cmp %rcx,%rax
│ ├──jae 6f
│ │ if (num % i == 0)
0.03 │ │ mov -0x10(%rbp),%rax
│ │ xor %edx,%edx
89.00 │ │ divq -0x18(%rbp)
│ │ cmp $0x0,%rdx
0.22 │ │↓ jne 5f
│ │ return false;
│ │ movb $0x0,-0x1(%rbp)
│ │↓ jmp 73
│ │ }
3.22 │1 5f:│↓ jmp 61
│ │ for(uint64_t i = 3; i < num / 2; i+= 2) {
Subscribers: mgorny, llvm-commits
Differential Revision: https://reviews.llvm.org/D44892
llvm-svn: 337789
Thomas Anderson [Tue, 24 Jul 2018 00:43:47 +0000 (00:43 +0000)]
Borrow visibility from __fundamental_type_info for generated fundamental type infos
This is necessary so the clang gives hidden visibility to fundamental types when
-fvisibility=hidden is passed. Fixes
https://bugs.llvm.org/show_bug.cgi?id=35066
Differential Revision: https://reviews.llvm.org/D49109
llvm-svn: 337788
Vedant Kumar [Tue, 24 Jul 2018 00:41:29 +0000 (00:41 +0000)]
[Debugify] Export per-pass debug info loss statistics
Add a -debugify-export option to opt. This exports per-pass `debugify`
loss statistics to a file in CSV format.
For some interesting numbers on debug value loss during an -O2 build
of the sqlite3 amalgamation, see the review thread.
Differential Revision: https://reviews.llvm.org/D49003
llvm-svn: 337787
Vedant Kumar [Tue, 24 Jul 2018 00:41:28 +0000 (00:41 +0000)]
[Debugify] Move interface definitions to a header, NFC
This is a minor cleanup in preparation for a change to export DI
statistics from -check-debugify. To do that, it would be cleaner to have
a dedicated header for the debugify interface.
llvm-svn: 337786
Chandler Carruth [Tue, 24 Jul 2018 00:35:36 +0000 (00:35 +0000)]
[x86/SLH] Simplify the code for hardening a loaded value. NFC.
This is in preparation for extracting this into a re-usable utility in
this code.
llvm-svn: 337785
Petr Hosek [Tue, 24 Jul 2018 00:34:55 +0000 (00:34 +0000)]
Revert "[Fuzzer] Update path to libc++ headers"
This reverts commit r337775 since r337727 has been reverted in r337782.
llvm-svn: 337784
Dan Gohman [Tue, 24 Jul 2018 00:29:58 +0000 (00:29 +0000)]
[WebAssembly] Change size_t to `unsigned long`.
Changing it to unsigned long (which is 32-bit on wasm32) makes it the same
type as wasm64 (where unsigned long is 64-bit), which would eliminate the most
common cause for mangled names being different between wasm32 and wasm64. For
example, export lists containing symbol names could now often be the same
between wasm32 and wasm64.
Differential Revision: https://reviews.llvm.org/D40526
llvm-svn: 337783
Alex Lorenz [Tue, 24 Jul 2018 00:27:31 +0000 (00:27 +0000)]
Revert r337727 as it caused Darwin bot failures
llvm-svn: 337782
Chandler Carruth [Tue, 24 Jul 2018 00:21:59 +0000 (00:21 +0000)]
[x86/SLH] Remove complex SHRX-based post-load hardening.
This code was really nasty, had several bugs in it originally, and
wasn't carrying its weight. While on Zen we have all 4 ports available
for SHRX, on all of the Intel parts with Agner's tables, SHRX can only
execute on 2 ports, giving it 1/2 the throughput of OR.
Worse, all too often this pattern required two SHRX instructions in
a chain, hurting the critical path by a lot.
Even if we end up needing to safe/restore EFLAGS, that is no longer so
bad. We pay for a uop to save the flag, but we very likely get fusion
when it is used by forming a test/jCC pair or something similar. In
practice, I don't expect the SHRX to be a significant savings here, so
I'd like to avoid the complex code required. We can always resurrect
this if/when someone has a specific performance issue addressed by it.
llvm-svn: 337781
Erik Pilkington [Tue, 24 Jul 2018 00:07:49 +0000 (00:07 +0000)]
NFC: Add the emacs c++ mode hint "-*- C++ -*-" to the headers that don't have it
https://llvm.org/docs/CodingStandards.html#file-headers
llvm-svn: 337780
Raphael Isemann [Tue, 24 Jul 2018 00:01:32 +0000 (00:01 +0000)]
Added unit test for StreamTee
Reviewers: davide
Reviewed By: davide
Subscribers: davide, mgorny, lldb-commits
Differential Revision: https://reviews.llvm.org/D49708
llvm-svn: 337778
Sam Clegg [Mon, 23 Jul 2018 23:51:19 +0000 (23:51 +0000)]
[WebAssembly] Add support for --whole-archive.
Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D49706
llvm-svn: 337777
Artem Dergachev [Mon, 23 Jul 2018 23:48:13 +0000 (23:48 +0000)]
[analyzer] Add a no-crash to a recently added test.
No functional change intended.
llvm-svn: 337776
Petr Hosek [Mon, 23 Jul 2018 23:38:28 +0000 (23:38 +0000)]
[Fuzzer] Update path to libc++ headers
The path to headers which are installed into libc++ build directory
has changed in r337727 which broke the libFuzzer build.
Differential Revision: https://reviews.llvm.org/D49705
llvm-svn: 337775
Jason Molenda [Mon, 23 Jul 2018 23:34:50 +0000 (23:34 +0000)]
Change sort-pbxproj.rb to find the project.pbxproj in the
most likely locations. And have it overwrite the original
file with the sorted output.
llvm-svn: 337774
Fangrui Song [Mon, 23 Jul 2018 23:27:45 +0000 (23:27 +0000)]
[DWARF] Use deque in place of SmallVector to fix use-after-free issue
Summary: SmallVector's elements are moved when resizing and cause use-after-free.
Reviewers: probinson, dblaikie
Subscribers: JDevlieghere, llvm-commits
Differential Revision: https://reviews.llvm.org/D49702
llvm-svn: 337772
Thomas Anderson [Mon, 23 Jul 2018 23:19:53 +0000 (23:19 +0000)]
Fix typo in test/CodeGen/Mips/dins.ll
Differential Revision: https://reviews.llvm.org/D49704
llvm-svn: 337771
Wolfgang Pieb [Mon, 23 Jul 2018 23:14:23 +0000 (23:14 +0000)]
Embed a template specialization in a namespace to work around a gcc bug.
llvm-svn: 337770
Artem Dergachev [Mon, 23 Jul 2018 23:09:44 +0000 (23:09 +0000)]
[analyzer] pr38273: Legalize Loc<>NonLoc comparison symbols.
Remove an assertion in RangeConstraintManager that expects such symbols to never
appear, while admitting that the constraint manager doesn't yet handle them.
Differential Revision: https://reviews.llvm.org/D49703
llvm-svn: 337769
Eric Fiselier [Mon, 23 Jul 2018 22:58:46 +0000 (22:58 +0000)]
Handle DT_UNKNOWN correctly during directory iteration.
Unlike stat and lstat, where unknown really means we know it's something weird,
during directory iteration DT_UNKNOWN simply means that the underlying FS doesn't
support the dirent::dt_type field.
This patch fixes libc++ to correctly set the cache to empty when DT_UNKNOWN is reported.
llvm-svn: 337768
Richard Smith [Mon, 23 Jul 2018 22:56:45 +0000 (22:56 +0000)]
Support lifetime-extension of conditional temporaries.
llvm-svn: 337767
Erik Pilkington [Mon, 23 Jul 2018 22:47:37 +0000 (22:47 +0000)]
[Sema] Fix crash on BlockExprs in a default member initializers
Clang would crash when instantiating a BlockDecl that appeared in a
default-member-initializer of a class template. Fix this by deferring the
instantiation until we instantate the BlockExpr.
rdar://
41200624
Differential revision: https://reviews.llvm.org/D49688
llvm-svn: 337766
Eric Fiselier [Mon, 23 Jul 2018 22:40:41 +0000 (22:40 +0000)]
Recommit "Use possibly cached directory entry values when performing recursive directory iteration."
The initial patch didn't correctly handle systems when the dirent struct
didn't provide the d_type member. Specifically it set the cache to the incorrect state,
and claimed it was partially populated.
The updated version of this change correctly handles setting up the
cache when the file type is not known (aka file_type::none).
llvm-svn: 337765
Eric Fiselier [Mon, 23 Jul 2018 22:39:56 +0000 (22:39 +0000)]
Fix accidentally removed test.
When adding the new tests for the filesystem_error::what method,
I incorrectly removed a test case and replaced it with something else.
This patch restores that test case
llvm-svn: 337764
Wolfgang Pieb [Mon, 23 Jul 2018 22:37:17 +0000 (22:37 +0000)]
[DWARF v5] Refactor range lists dumping by using a more generic way of handling tables of lists.
The intent is to use it for location list tables as well. Change is almost NFC with the exception
of the spelling of some strings used during dumping (all lowercase now).
Reviewer: JDevlieghere
Differential Revision: https://reviews.llvm.org/D49500
llvm-svn: 337763
Teresa Johnson [Mon, 23 Jul 2018 22:33:57 +0000 (22:33 +0000)]
[LTO] Handle __imp_ (dllimport) symbols consistently with lld
Summary:
Similar to what lld already does for dllimport symbols which are
prefaced with __imp_ (see lld patch r240620), strip off the __imp_
prefix in LTO. Otherwise we can get 2 separate GlobalResolution for
a single symbol, the dllimport declaration, and the definition, which
leads to incorrect LTO handling.
Fixes PR38105.
Reviewers: pcc
Subscribers: mehdi_amini, inglorion, steven_wu, dexonsmith, llvm-commits
Differential Revision: https://reviews.llvm.org/D49138
llvm-svn: 337762
George Karpenkov [Mon, 23 Jul 2018 22:29:35 +0000 (22:29 +0000)]
[ASTMatchers] Add an isMain() matcher
Differential Revision: https://reviews.llvm.org/D49615
llvm-svn: 337761
George Karpenkov [Mon, 23 Jul 2018 22:29:10 +0000 (22:29 +0000)]
[ASTMatchers] [NFC] Regenerate HTML docs.
llvm-svn: 337760
Erik Pilkington [Mon, 23 Jul 2018 22:23:04 +0000 (22:23 +0000)]
[demangler] call terminate() if allocation failed
We really should set *status to memory_alloc_failure, but we need to refactor
the demangler a bit to properly propagate the failure up the stack. Until then,
its better to explicitly terminate then rely on a null dereference crash.
rdar://
31240372
llvm-svn: 337759
Greg Clayton [Mon, 23 Jul 2018 22:22:46 +0000 (22:22 +0000)]
Fix Xcode project for unit tests.
llvm-svn: 337758
Martin Storsjo [Mon, 23 Jul 2018 22:15:25 +0000 (22:15 +0000)]
[MC] Add a separate flag for skipping comdat constant sections for MinGW. NFC.
This actually has nothing to do with the associative comdat sections
that aren't supported by GNU binutils ld.
Clarify the comments from SVN r335918 and use a separate flag for it.
Differential Revision: https://reviews.llvm.org/D49645
llvm-svn: 337757
Martin Storsjo [Mon, 23 Jul 2018 22:15:19 +0000 (22:15 +0000)]
[COFF] Fix assembly output of comdat sections without an attached symbol
Since SVN r335286, the .xdata sections are produced without an attached
symbol, which requires using a different syntax when printing assembly
output.
Instead of the usual syntax of '.section <name>,"dr",discard,<symbol>',
use '.section <name>,"dr"' + '.linkonce discard' (which is what GCC
uses for all assembly output).
This fixes PR38254.
Differential Revision: https://reviews.llvm.org/D49651
llvm-svn: 337756
Martin Storsjo [Mon, 23 Jul 2018 22:15:14 +0000 (22:15 +0000)]
[AArch64] Use MCAsmInfoMicrosoft and MCAsmInfoGNUCOFF as base classes
This matches the structure used on X86 and ARM. This requires
a little bit of duplication of the parts that are equal in both
AArch64 COFF variants though.
Before SVN r335286, these classes didn't add anything that MCAsmInfoCOFF
didn't, but now they do.
This makes AArch64 match X86 in how comdat is used for float constants
for MinGW.
Differential Revision: https://reviews.llvm.org/D49637
llvm-svn: 337755
Martin Storsjo [Mon, 23 Jul 2018 22:09:23 +0000 (22:09 +0000)]
Implement a GCC compatible SEH unwinding personality, __gxx_personality_seh0
This allows handling SEH based exceptions, with unwind functions
provided by libgcc.
Differential Revision: https://reviews.llvm.org/D49638
llvm-svn: 337754
Vedant Kumar [Mon, 23 Jul 2018 21:59:06 +0000 (21:59 +0000)]
[utils] Fix the llvm::Optional data formatter
The llvm::Optional data formatter needs to look through the `Storage`
container if it's present.
Before:
220 if (Op && Op->getOp() != dwarf::DW_OP_LLVM_fragment)
-> 221 HasComplexExpression = true;
222
223 // If the register can only be described by a complex expression (i.e.,
224 // multiple subregisters) it doesn't safely compose with another complex
Target 0: (llc) stopped.
(lldb) p Op
(llvm::Optional<llvm::DIExpression::ExprOperand>) $0 = None
After:
(lldb) p Op
(llvm::Optional<llvm::DIExpression::ExprOperand>) $0 =
(llvm::DIExpression::ExprOperand) storage = {
Op = 0x000000010603d460
}
llvm-svn: 337752
Vedant Kumar [Mon, 23 Jul 2018 21:59:04 +0000 (21:59 +0000)]
[SelectionDAG] Reduce DanglingDebugInfo memory traffic, NFC
This avoids approx. 2 x 10^5 DenseMap insertions in both non-debug and
debug -O2 builds of the sqlite3 amalgamation.
llvm-svn: 337751
Teresa Johnson [Mon, 23 Jul 2018 21:58:19 +0000 (21:58 +0000)]
[ThinLTO] Ensure the TargetLibraryInfo is constructed early enough
Summary:
Without this change, the WholeProgramDevirt pass, which requires the
TargetLibraryInfo, will construct one from the default triple.
Fixes PR38139.
Reviewers: pcc
Subscribers: mehdi_amini, inglorion, steven_wu, dexonsmith, llvm-commits
Differential Revision: https://reviews.llvm.org/D49278
llvm-svn: 337750
Eric Fiselier [Mon, 23 Jul 2018 21:52:29 +0000 (21:52 +0000)]
Revert "Use possibly cached directory entry values when performing recursive directory iteration."
This reverts commit
04ce4aef00d3ee508327f6cf7bf1b1d200ab6238.
llvm-svn: 337749
George Burgess IV [Mon, 23 Jul 2018 21:49:36 +0000 (21:49 +0000)]
[DebugCounters] Keep track of total counts
This patch makes debug counters keep track of the total number of times
we've called `shouldExecute` for each counter, so it's easier to build
automated tooling on top of these.
A patch to print these counts is coming soon.
Patch by Zhizhou Yang!
Differential Revision: https://reviews.llvm.org/D49560
llvm-svn: 337748
Fangrui Song [Mon, 23 Jul 2018 21:33:51 +0000 (21:33 +0000)]
[gdb] Fix SmallVector pretty printer after r337514
llvm-svn: 337747
Reid Kleckner [Mon, 23 Jul 2018 21:29:43 +0000 (21:29 +0000)]
[clang-cl] Expose -fblocks and -fno-builtin as driver flags
Users have requested them.
Helps with PR36427.
llvm-svn: 337746
Matthew Voss [Mon, 23 Jul 2018 21:22:02 +0000 (21:22 +0000)]
Reapply "[XRay] Remove scheduling dependency in fork_basic_logging.cc"
Summary:
Continuation of https://reviews.llvm.org/D49501
Second part of the test has an scheduling order when there shouldn't be.
Reviewers: dberris, ormris
Reviewed By: dberris, ormris
Subscribers: TWeaver
Differential Revision: https://reviews.llvm.org/D49559
llvm-svn: 337745
Richard Smith [Mon, 23 Jul 2018 21:21:24 +0000 (21:21 +0000)]
Do not try to perform lifetime-extension through conditional
expressions.
CodeGen can't cope with that yet. Instead, produce a "not supported"
warning for now and don't extend lifetime.
llvm-svn: 337744
Richard Smith [Mon, 23 Jul 2018 21:21:22 +0000 (21:21 +0000)]
Fold -Wreturn-stack-address into general initialization lifetime
checking.
llvm-svn: 337743
Manoj Gupta [Mon, 23 Jul 2018 21:20:00 +0000 (21:20 +0000)]
ConstantFolding: Avoid a crash.
Summary:
Check if the parent basic block and caller exists
before calling CS.getCaller when constant folding
strip.invariant.group instrinsic.
This avoids a crash when the function containing the intrinsic
is being inlined. The instruction is checked for any simplifiction
but has not yet been added to a basic block.
Reviewers: Prazek, rsmith, efriedma
Reviewed By: efriedma
Subscribers: eraman, llvm-commits
Differential Revision: https://reviews.llvm.org/D49690
llvm-svn: 337742
Raphael Isemann [Mon, 23 Jul 2018 21:14:52 +0000 (21:14 +0000)]
[cmake] Remove unused ${LLDB_PLUGINS} dependency from our Objective-C++ CMake config
Summary:
LLDB_PLUGINS doesn't exist as a variable, so this line doesn't add any dependencies and is
just confusing. It seems this slipped in from the gdb-remote CMake I was using as a CMake template.
The gdb-remote CMake itself is using a local LLDB_PLUGINS variable, so that code is fine.
Reviewers: davide
Reviewed By: davide
Subscribers: davide, mgorny, lldb-commits
Differential Revision: https://reviews.llvm.org/D49695
llvm-svn: 337741