Craig Topper [Fri, 7 Jul 2017 19:56:18 +0000 (19:56 +0000)]
[APInt] Add a fastpath for the single word case of isOneValue to match isNullValue, isAllOnesValue, etc. NFCI
llvm-svn: 307430
Sanjay Patel [Fri, 7 Jul 2017 19:34:42 +0000 (19:34 +0000)]
[DAGCombiner] use local variable to shorten code; NFCI
llvm-svn: 307429
Quentin Colombet [Fri, 7 Jul 2017 19:25:45 +0000 (19:25 +0000)]
[RegAllocFast] Don't insert kill flags of super-register for partial kill
When reusing a register for a new definition, the fast register allocator
used to insert a kill flag at the previous last use of that register to
inform later passes that this register is free between the redef and the
last use. However, this may be wrong when subregisters are involved.
Indeed, a partially redef would have trigger a kill of the full super
register, potentially wrongly marking all the other subregisters as
free. Given we don't track which lanes are still live, we cannot set the
kill flag in such case.
Note: This bug has been latent for about 7 years (r104056).
llvmg.org/PR33677
llvm-svn: 307428
Quentin Colombet [Fri, 7 Jul 2017 19:25:42 +0000 (19:25 +0000)]
[RegAllocFast] Add the proper initialize method to use the .mir infrastructure
NFC
llvm-svn: 307427
Zachary Turner [Fri, 7 Jul 2017 19:00:06 +0000 (19:00 +0000)]
[llvm-pdbutil] Fix build.
Some platforms require an explicit specialization of std::hash
for PdbRaw_FeaturesSig. Also a test involving case sensitivity
needed to be fixed. For now that particular check just accepts
any path even if they're completely different. Long term we
should output paths in the correct case to match MSVC.
llvm-svn: 307426
Davide Italiano [Fri, 7 Jul 2017 18:54:14 +0000 (18:54 +0000)]
[Local] Update the comment for removeUnreachableBlocks.
It referenced a wrong function name, and didn't mention what the
second argument did. This should be slightly more accurate now.
llvm-svn: 307425
Matthias Braun [Fri, 7 Jul 2017 18:53:24 +0000 (18:53 +0000)]
FuzzerUtilDarwin.cpp: We need to pass modifiable strings to posix_spawn
This fixes a bug where unmodifiable strings where passed to posix_spawn.
This is an attempt to unbreak the greendragon libFuzzer bot.
llvm-svn: 307424
Zachary Turner [Fri, 7 Jul 2017 18:46:14 +0000 (18:46 +0000)]
Use windows path syntax when writing PDB module name.
Without this we would just append whatever the user
wrote on the command line, so if we're in C:\foo
and we run lld-link bar/baz.obj, we would write
C:\foo\bar/baz.obj in various places in the PDB.
MSVC linker does not do this, so we shouldn't either.
This fixes some differences in the diff test, so we
update the test as well.
Differential Revision: https://reviews.llvm.org/D35092
llvm-svn: 307423
Zachary Turner [Fri, 7 Jul 2017 18:45:56 +0000 (18:45 +0000)]
Fix some differences between lld and MSVC generated PDBs.
A couple of things were different about our generated PDBs.
1) We were outputting the wrong Version on the PDB Stream.
The version we were setting was newer than what MSVC is setting.
It's not clear what the implications are, but we change LLD
to use PdbImplVC70, as MSVC does.
2) For the optional debug stream indices in the DBI Stream, we
were outputting 0 to mean "the stream is not present". MSVC
outputs uint16_t(-1), which is the "correct" way to specify
that a stream is not present. So we fix that as well.
3) We were setting the PDB Stream signature to 0. This is supposed
to be the result of calling time(nullptr). Although this leads
to non-deterministic builds, a better way to solve that is by
having a command line option explicitly for generating a
reproducible build, and have the default behavior of lld-link
match the default behavior of link.
To test this, I'm making use of the new and improved `pdb diff`
sub command. To make it suitable for writing tests against, I had
to modify the diff subcommand slightly to print less verbose output.
Previously it would always print | <column> | <value1> | <value2> |
which is quite verbose, and the values are fragile. All we really
want to know is "did we produce the same value as link?" So I added
command line options to print a single character representing the
result status (different, identical, equivalent), and another to
hide the value display. Note that just inspecting the diff output
used to write the test, you can see some things that are obviously
wrong. That is just reflective of the fact that this is the state
of affairs today, not that we're asserting that this is "correct".
We can use this as a starting point to discover differences, fix
them, and update the test.
Differential Revision: https://reviews.llvm.org/D35086
llvm-svn: 307422
Zachary Turner [Fri, 7 Jul 2017 18:45:37 +0000 (18:45 +0000)]
[llvm-pdbutil] Improve diff mode.
We're getting to the point that some MS tools (e.g. DIA) can recognize
our PDBs but others (e.g. link.exe) cannot. I think the way forward is
to improve our tooling to help us find differences more easily. For
example, if we can compile the same program with clang-cl and cl and
have a tool tell us all the places where the PDBs differ, this could
tell us what we're doing wrong. It's tricky though, because there are a
lot of "benign" differences in a PDB. For example, if the string table
in one PDB consists of "foo" followed by "bar" and in the other PDB it
consists of "bar" followed by "foo", this is not necessarily a critical
difference, as long as the uses of these strings also refer to the
correct location. On the other hand, if the second PDB doesn't even
contain the string "foo" at all, this is a critical difference.
diff mode has been in llvm-pdbutil for quite a while, but because of the
above challenge along with some others, it's been hard to make it
useful. I think this patch addresses that. It looks for all the same
things, but it now prints the output in tabular format (carefully
formatted and aligned into tables and fields), and it highlights
critical differences in red, non-critical differences in yellow, and
identical fields in green. This makes it easy to spot the places we
differ, and the general concept of outputting arbitrary fields in
tabular format can be extended to provide analysis into many of the
different types of information that show up in a PDB.
Differential Revision: https://reviews.llvm.org/D35039
llvm-svn: 307421
Craig Topper [Fri, 7 Jul 2017 18:41:09 +0000 (18:41 +0000)]
[X86] Replace 'fallthrough' comments with LLVM_FALLTHROUGH.
llvm-svn: 307420
Craig Topper [Fri, 7 Jul 2017 18:28:45 +0000 (18:28 +0000)]
vim: add 'builtin', 'nobuiltin', 'nonnull', and 'speculatable' to the keyword list.
llvm-svn: 307419
Gor Nishanov [Fri, 7 Jul 2017 18:24:20 +0000 (18:24 +0000)]
[cloning] Do not duplicate types when cloning functions
Summary:
This is an addon to the change rl304488 cloning fixes. (Originally rl304226 reverted rl304228 and reapplied rl304488 https://reviews.llvm.org/D33655)
rl304488 works great when DILocalVariables that comes from the inlined function has a 'unique-ed' type, but,
in the case when the variable type is distinct we will create a second DILocalVariable in the scope of the original function that was inlined.
Consider cloning of the following function:
```
define private void @f() !dbg !5 {
%1 = alloca i32, !dbg !11
call void @llvm.dbg.declare(metadata i32* %1, metadata !14, metadata !12), !dbg !18
ret void, !dbg !18
}
!14 = !DILocalVariable(name: "inlined", scope: !15, file: !6, line: 5, type: !17) ; came from an inlined function
!15 = distinct !DISubprogram(name: "inlined", linkageName: "inlined", scope: null, file: !6, line: 8, type: !7, isLocal: true, isDefinition: true, scopeLine: 9, isOptimized: false, unit: !0, variables: !16)
!16 = !{!14}
!17 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "some_struct", size: 32, align: 32)
```
Without this fix, when function 'f' is cloned, we will create another DILocalVariable for "inlined", due to its type being distinct.
```
define private void @f.1() !dbg !23 {
%1 = alloca i32, !dbg !26
call void @llvm.dbg.declare(metadata i32* %1, metadata !28, metadata !12), !dbg !30
ret void, !dbg !30
}
!14 = !DILocalVariable(name: "inlined", scope: !15, file: !6, line: 5, type: !17)
!15 = distinct !DISubprogram(name: "inlined", linkageName: "inlined", scope: null, file: !6, line: 8, type: !7, isLocal: true, isDefinition: true, scopeLine: 9, isOptimized: false, unit: !0, variables: !16)
!16 = !{!14}
!17 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "some_struct", size: 32, align: 32)
;
!28 = !DILocalVariable(name: "inlined", scope: !15, file: !6, line: 5, type: !29) ; OOPS second DILocalVariable
!29 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "some_struct", size: 32, align: 32)
```
Now we have two DILocalVariable for "inlined" within the same scope. This result in assert in AsmPrinter/DwarfDebug.h:131: void llvm::DbgVariable::addMMIEntry(const llvm::DbgVariable &): Assertion `V.Var == Var && "conflicting variable"' failed.
(Full example: See: https://bugs.llvm.org/show_bug.cgi?id=33492)
In this change we prevent duplication of types so that when a metadata for DILocalVariable is cloned it will get uniqued to the same metadate node as an original variable.
Reviewers: loladiro, dblaikie, aprantl, echristo
Reviewed By: loladiro
Subscribers: EricWF, llvm-commits
Differential Revision: https://reviews.llvm.org/D35106
llvm-svn: 307418
Anna Thomas [Fri, 7 Jul 2017 18:05:28 +0000 (18:05 +0000)]
[LoopUnrollRuntime] NFC: use the precomputed loop exit in ConnectProlog
Minor refactoring to use the preexisting loop exit that's already
calculated. We do not need to recompute the loop exit in ConnectProlog.
Apart from avoiding redundant computation, this is required for
supporting multiple loop exits when Prolog remainder loops are generated.
llvm-svn: 307417
Tony Jiang [Fri, 7 Jul 2017 16:41:55 +0000 (16:41 +0000)]
[PPC CodeGen] Expand the bitreverse.i32 intrinsic.
Differential Revision: https://reviews.llvm.org/D33572
Fix PR: https://bugs.llvm.org/show_bug.cgi?id=33093
llvm-svn: 307413
Davide Italiano [Fri, 7 Jul 2017 16:40:19 +0000 (16:40 +0000)]
[LTO] Add a test for ThinLTO + --defsym.
We also get this right since r307303.
llvm-svn: 307412
Simon Pilgrim [Fri, 7 Jul 2017 16:40:06 +0000 (16:40 +0000)]
Fix some more -Wimplicit-fallthrough warnings. NFCI.
llvm-svn: 307411
Davide Italiano [Fri, 7 Jul 2017 16:33:01 +0000 (16:33 +0000)]
[LTO] Add a test for ThinLTO + --wrap.
We should get this right after r307303.
Differential Revision: https://reviews.llvm.org/D35126
llvm-svn: 307410
Matthew Simpson [Fri, 7 Jul 2017 16:15:05 +0000 (16:15 +0000)]
[ARM] Implement interleaved access bug fix from r306334
r306334 fixed a bug in AArch64 dealing with wide interleaved accesses having
pointer types. The bug also exists in ARM, so this patch copies over the fix.
llvm-svn: 307409
Kuba Mracek [Fri, 7 Jul 2017 15:32:44 +0000 (15:32 +0000)]
Fix-up for r307307: vm_info.max_address is the first non-addressable pointer, so we need to subtract one.
llvm-svn: 307408
Sam Kolton [Fri, 7 Jul 2017 15:21:52 +0000 (15:21 +0000)]
[AMDGPU] Assembler: refactor convert methods (VOP3 and MIMG)
Summary: Simplified converter methods for VOP3 and MIMG.
Reviewers: dp, artem.tamazov
Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, vpykhtin, t-tye
Differential Revision: https://reviews.llvm.org/D35047
llvm-svn: 307407
Rafael Espindola [Fri, 7 Jul 2017 15:20:55 +0000 (15:20 +0000)]
Fix variable names. NFC.
llvm-svn: 307406
Tom Stellard [Fri, 7 Jul 2017 15:20:17 +0000 (15:20 +0000)]
[MachO] Add missing byte-swaps when reading dyld_info
Summary:
This fixes the following tests on big-endian hosts:
lld :: mach-o/dylib-install-names.yaml
lld :: mach-o/force_load-dylib.yaml
lld :: mach-o/lib-search-paths.yaml
lld :: mach-o/upward-dylib-load-command.yaml
Reviewers: lhames, kledzik, ruiu
Reviewed By: ruiu
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D35022
llvm-svn: 307405
Sanjay Patel [Fri, 7 Jul 2017 14:56:20 +0000 (14:56 +0000)]
[x86] add SBB optimization for SETAE (uge) condition code
x86 scalar select-of-constants (Cond ? C1 : C2) combining/lowering is a mess
with missing optimizations. We handle some patterns, but miss logical variants.
To clean that up, we should convert all select-of-constants to logic/math and
enhance the combining for the expected patterns from that. DAGCombiner already
has the foundation to allow the transforms, so we just need to fill in the holes
for x86 math op lowering. Selecting 0 or -1 needs extra attention to produce the
optimal code as shown here.
Attempt to verify that all of these IR forms are logically equivalent:
http://rise4fun.com/Alive/plxs
Earlier steps in this series:
rL306040
rL306072
Differential Revision: https://reviews.llvm.org/D34652
llvm-svn: 307404
Sanjay Patel [Fri, 7 Jul 2017 14:39:26 +0000 (14:39 +0000)]
[DemandedBits] fix formatting; NFC
llvm-svn: 307403
Dmitry Preobrazhensky [Fri, 7 Jul 2017 14:29:06 +0000 (14:29 +0000)]
[AMDGPU][mc][gfx9] Added support of op_sel/op_sel_hi for V_MAD_MIX*
See https://bugs.llvm.org//show_bug.cgi?id=33595
Reviewers: vpykhtin, artem.tamazov, arsenm
Differential Revision: https://reviews.llvm.org/D35021
llvm-svn: 307402
Siddharth Bhat [Fri, 7 Jul 2017 14:02:27 +0000 (14:02 +0000)]
[NFC] [PPCGCodeGeneration] Extend `invariant-load-hoisting-with-variable-upper-bound` test case.
- Check that we have invariant accesses.
- Use `-polly-use-llvm-names` for better names in the test.
- Rename test function to `f` for brevity.
llvm-svn: 307401
Chad Rosier [Fri, 7 Jul 2017 13:55:55 +0000 (13:55 +0000)]
[ValueTracking] Fix the identity case (LHS => RHS) when the LHS is false.
Prior to this commit both of the added test cases were passing. However, in the
latter case (test7) we were doing a lot more work to arrive at the same answer
(i.e., we were using isImpliedCondMatchingOperands() to determine the
implication.).
llvm-svn: 307400
Ed Maste [Fri, 7 Jul 2017 13:45:41 +0000 (13:45 +0000)]
remove duplicate symbol version script entries
GNU ld ignores duplicates, but lld produces a warning.
Differential Revision: https://reviews.llvm.org/D35121
llvm-svn: 307399
Siddharth Bhat [Fri, 7 Jul 2017 13:44:22 +0000 (13:44 +0000)]
[NFC] [PPCGCodeGeneration] Add test for simple invariant load hoisting.
- This already works, but add this to ensure that there is no
regressions when I expand the invariant load hoisting ability of
`PPCGCodeGeneration`.
llvm-svn: 307398
Andrew V. Tischenko [Fri, 7 Jul 2017 13:41:33 +0000 (13:41 +0000)]
NFC: I simply added CHECK-LABEL to prevent false matches in the tests.
llvm-svn: 307397
Simon Pilgrim [Fri, 7 Jul 2017 13:22:47 +0000 (13:22 +0000)]
[Lanai] Fix -Wimplicit-fallthrough warning. NFCI.
llvm-svn: 307396
Simon Pilgrim [Fri, 7 Jul 2017 13:21:43 +0000 (13:21 +0000)]
[Hexagon] Fix some more -Wimplicit-fallthrough warnings. NFCI.
llvm-svn: 307395
Martin Probst [Fri, 7 Jul 2017 13:17:10 +0000 (13:17 +0000)]
clang-format: [JS] do not wrap after "readonly".
Summary:
Breaks after "readonly" trigger automatic semicolon insertion in field
declarations.
Reviewers: krasimir, djasper
Subscribers: klimek
Differential Revision: https://reviews.llvm.org/D35112
llvm-svn: 307394
Simon Pilgrim [Fri, 7 Jul 2017 13:03:28 +0000 (13:03 +0000)]
[AArch64] Fix -Wimplicit-fallthrough warnings. NFCI.
llvm-svn: 307393
Anna Thomas [Fri, 7 Jul 2017 13:02:29 +0000 (13:02 +0000)]
[SafepointIRVerifier] Avoid false positives in GC verifier for compare between pointers
Today the safepoint IR verifier catches some unrelocated uses of base
pointers that are actually valid.
With this change, we narrow down the set of false positives.
Specifically, the verifier knows about compares to null and compares
between 2 unrelocated pointers.
Reviewed by: skatkov
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D35057
llvm-svn: 307392
Pavel Labath [Fri, 7 Jul 2017 11:02:28 +0000 (11:02 +0000)]
Disable TestGoASTContext
it fails with go 1.8 and we don't seem to have a maintainer of that
functionality.
llvm-svn: 307391
Pavel Labath [Fri, 7 Jul 2017 11:02:19 +0000 (11:02 +0000)]
Add a NativeProcessProtocol Factory class
Summary:
This replaces the static functions used for creating
NativeProcessProtocol instances with a factory pattern, and modernizes
the interface of the new class in the process -- I use llvm::Expected
instead of the Status+value combo. I also move some of the common code
(like the Delegate registration into the base class). The new
arrangement has multiple benefits:
- it removes the NativeProcess*** dependency from Process/gdb-remote
(which for example means that liblldb no longer pulls in this code).
- it enables unit testing of the GDBRemoteCommunicationServerLLGS class
(by providing a mock Native Process).
- serves as another example on how to use the llvm::Expected class (I
couldn't get rid of the Initialize-type functions completely here
because of the use of shared_from_this, but that's the next thing on
my list here)
Tests still pass on Linux and I've made sure NetBSD compiles after this.
Reviewers: zturner, eugene, krytarowski
Subscribers: srhines, lldb-commits, mgorny
Differential Revision: https://reviews.llvm.org/D33778
llvm-svn: 307390
Florian Hahn [Fri, 7 Jul 2017 10:43:01 +0000 (10:43 +0000)]
[AArch64] Use 16 bytes as preferred function alignment on Cortex-A57.
Summary:
This change gives a 0.89% speed on execution time, a 0.94% improvement
in benchmark scores and a 0.62% increase in binary size on a Cortex-A57.
These numbers are the geomean results on a wide range of benchmarks from
the test-suite, SPEC2000, SPEC2006 and a range of proprietary suites.
The software optimization guide for the Cortex-A57 recommends 16 byte
branch alignment.
Reviewers: t.p.northover, mcrosier, javed.absar, kristof.beyls, sbaranga
Reviewed By: kristof.beyls
Subscribers: aemerson, rengolin, llvm-commits
Differential Revision: https://reviews.llvm.org/D34954
llvm-svn: 307389
Alex Lorenz [Fri, 7 Jul 2017 10:41:19 +0000 (10:41 +0000)]
Recommit [driver][macOS] Pick the system version for the
deployment target if the SDK is newer than the system
This commit reverts the revert commit r305891. Now the change from r305678
should be correct because `llvm::sys::getProcessTriple` now returns the correct
macOS version of the system after the LLVM change r307372.
Original commit message:
This commit improves the driver by making sure that it picks the system version
for the deployment target when the version of the macOS SDK is newer than the
system version.
rdar://
29449467
Differential Revision: https://reviews.llvm.org/D34175
llvm-svn: 307388
Simon Atanasyan [Fri, 7 Jul 2017 10:35:33 +0000 (10:35 +0000)]
[driver][mips] Pass long-calls feature flag to the MIPS backend
Check the `-mlong-calls` command line option and pass the `long-calls`
feature flag to the backend. Handling of this feature flag in the backend
needs to be implemented by a separate commit.
llvm-svn: 307386
Alex Lorenz [Fri, 7 Jul 2017 10:25:12 +0000 (10:25 +0000)]
[Frontend] Verify that the bitstream is not empty before reading
the serialised diagnostics
Clang should avoid calling report_fatal_error when the file with the serialised
diagnostics is empty. This commit changes Clang's serialised diagnostic reader,
now it reports an appropriate error instead of crashing.
rdar://
31939877
Differential Revision: https://reviews.llvm.org/D35069
llvm-svn: 307384
Daniel Jasper [Fri, 7 Jul 2017 10:23:13 +0000 (10:23 +0000)]
Fix uninitalized memory access introduced in r307350.
Found by MSAN :).
llvm-svn: 307383
Simon Pilgrim [Fri, 7 Jul 2017 10:21:44 +0000 (10:21 +0000)]
[PowerPC] Fix -Wimplicit-fallthrough warnings. NFCI.
llvm-svn: 307382
Simon Pilgrim [Fri, 7 Jul 2017 10:18:57 +0000 (10:18 +0000)]
[AMDGPU] Fix -Wimplicit-fallthrough warnings. NFCI.
llvm-svn: 307381
Florian Hahn [Fri, 7 Jul 2017 10:15:49 +0000 (10:15 +0000)]
[AArch64] Use 16 bytes as preferred function alignment on Cortex-A72.
Summary:
This change gives a 0.34% speed on execution time, a 0.61% improvement
in benchmark scores and a 0.57% increase in binary size on a Cortex-A72.
These numbers are the geomean results on a wide range of benchmarks from
the test-suite, SPEC2000, SPEC2006 and a range of proprietary suites.
The software optimization guide for the Cortex-A72 recommends 16 byte
branch alignment.
Reviewers: t.p.northover, kristof.beyls, rengolin, sbaranga, mcrosier, javed.absar
Reviewed By: kristof.beyls
Subscribers: llvm-commits, aemerson
Differential Revision: https://reviews.llvm.org/D34961
llvm-svn: 307380
Alexander Kornienko [Fri, 7 Jul 2017 10:15:24 +0000 (10:15 +0000)]
[clang-tidy] Fix modernize-use-override incorrect replacement
Summary:
For the following code: `modernize-use-override` generates a replacement with incorrect location.
```
struct IntPair
{
int first, second;
};
struct A
{
virtual void il(IntPair);
};
struct B : A
{
void il(IntPair p = {1, (2 + 3)}) {};
// Generated Fixit: void il(IntPair p = override {1, (2 + 3)}) {};
// Should be: void il(IntPair p = {1, (2 + 3)}) override {};
};
```
This fixes that and adds a unit test.
Reviewers: alexfh, aaron.ballman, hokein
Reviewed By: alexfh
Subscribers: JDevlieghere, xazax.hun, cfe-commits
Tags: #clang-tools-extra
Patch by Victor Gao!
Differential Revision: https://reviews.llvm.org/D35078
llvm-svn: 307379
Simon Pilgrim [Fri, 7 Jul 2017 10:14:46 +0000 (10:14 +0000)]
[Sparc] Fix -Wimplicit-fallthrough warning. NFCI.
llvm-svn: 307378
Alex Lorenz [Fri, 7 Jul 2017 10:08:52 +0000 (10:08 +0000)]
Update the Windows version of updateTripleOSVersion to account for
changes in r307372
llvm-svn: 307377
Simon Pilgrim [Fri, 7 Jul 2017 10:07:09 +0000 (10:07 +0000)]
[SystemZ] Fix -Wimplicit-fallthrough warnings. NFCI.
llvm-svn: 307376
Simon Pilgrim [Fri, 7 Jul 2017 10:05:45 +0000 (10:05 +0000)]
[Arm] Fix -Wimplicit-fallthrough warnings. NFCI.
llvm-svn: 307375
Simon Pilgrim [Fri, 7 Jul 2017 10:04:12 +0000 (10:04 +0000)]
[Hexagon] Fix -Wimplicit-fallthrough warnings. NFCI.
llvm-svn: 307374
Peter Smith [Fri, 7 Jul 2017 10:03:37 +0000 (10:03 +0000)]
[ELF] Add call to assignAddresses() before createThunks() [NFC]
In preparation for the addition of rangeThunks() calculate the addresses
of all the inputSections so that ThunkSections can be inserted at the right
place.
Differential Revision: https://reviews.llvm.org/D34688
llvm-svn: 307373
Alex Lorenz [Fri, 7 Jul 2017 09:53:47 +0000 (09:53 +0000)]
[Support] sys::getProcessTriple should return a macOS triple using
the system's version of macOS
sys::getProcessTriple returns LLVM_HOST_TRIPLE, whose system version might not
be the actual version of the system on which the compiler running. This commit
ensures that, for macOS, sys::getProcessTriple returns a triple with the
system's macOS version.
rdar://
33177551
Differential Revision: https://reviews.llvm.org/D34446
llvm-svn: 307372
Olivier Goffart [Fri, 7 Jul 2017 09:38:59 +0000 (09:38 +0000)]
Fix crash parsing invalid code
The code in the test caused a crash with this backtrace:
RecordLayoutBuilder.cpp:2934: const clang::ASTRecordLayout &clang::ASTContext::getASTRecordLayout(const clang::RecordDecl *) const: Assertion `!D->isInvalidDecl() && "Cannot get layout of invalid decl!"' failed.
[...]
#7 0x00007f63963d845a __assert_fail_base (/usr/lib/libc.so.6+0x2c45a)
#8 0x00007f63963d84d2 (/usr/lib/libc.so.6+0x2c4d2)
#9 0x00007f63937a0631 clang::ASTContext::getASTRecordLayout(clang::RecordDecl const*) const /home/olivier/prog/llvm/tools/clang/lib/AST/RecordLayoutBuilder.cpp:2935:3
#10 0x00007f63937a1ad5 getFieldOffset(clang::ASTContext const&, clang::FieldDecl const*) /home/olivier/prog/llvm/tools/clang/lib/AST/RecordLayoutBuilder.cpp:3057:37
#11 0x00007f6391869f14 clang::Sema::RefersToMemberWithReducedAlignment(clang::Expr*, llvm::function_ref<void (clang::Expr*, clang::RecordDecl*, clang::FieldDecl*, clang::CharUnits)>) /home/olivier/prog/llvm/tools/clang/lib/Sema/SemaChecking.cpp:12139:23
#12 0x00007f639186a2f8 clang::Sema::CheckAddressOfPackedMember(clang::Expr*) /home/olivier/prog/llvm/tools/clang/lib/Sema/SemaChecking.cpp:12190:1
#13 0x00007f6391a7a81c clang::Sema::CheckAddressOfOperand(clang::ActionResult<clang::Expr*, true>&, clang::SourceLocation) /home/olivier/prog/llvm/tools/clang/lib/Sema/SemaExpr.cpp:11111:10
#14 0x00007f6391a7f5d2 clang::Sema::CreateBuiltinUnaryOp(clang::SourceLocation, clang::UnaryOperatorKind, clang::Expr*) /home/olivier/prog/llvm/tools/clang/lib/Sema/SemaExpr.cpp:11932:18
Fixing by bailing out for invalid classes.
Differential Revision: https://reviews.llvm.org/D35108
llvm-svn: 307371
George Rimar [Fri, 7 Jul 2017 09:18:05 +0000 (09:18 +0000)]
[ELF] - Fail the link if something happens on DWARF parsing stage of -gdb-index building
This is relative to PR33173,
Previously if something wrong happened on DWARF parsers side during parsing
object for building gdb index (like was in PR: unsupported relocation)
then LLD continued and finished the link. DWARF parsers sure showed error
message on their side, but that is all.
Patch changes behavior to fail the link in this case and show more
detailed message.
Differential revision: https://reviews.llvm.org/D34814
llvm-svn: 307370
Florian Hahn [Fri, 7 Jul 2017 09:17:53 +0000 (09:17 +0000)]
[AArch64] Add test case for preferred function alignment (NFC).
Reviewers: evandro, joelkevinjones, mcrosier
Reviewed By: joelkevinjones, mcrosier
Subscribers: mcrosier, aemerson, llvm-commits, rengolin, evandro, javed.absar, joelkevinjones, kristof.beyls
Differential Revision: https://reviews.llvm.org/D34951
llvm-svn: 307369
Alex Lorenz [Fri, 7 Jul 2017 09:15:29 +0000 (09:15 +0000)]
[ObjC] Avoid the -Wunguarded-availability warnings for protocol
requirements in protocol/class/category declarations
The unguarded availability warnings in the protocol requirements of a protocol
/class/category declaration can be avoided. This matches the behaviour of
Swift's diagnostics. The warnings for deprecated/unavailable protocols are
preserved.
rdar://
33156429
Differential Revision: https://reviews.llvm.org/D35061
llvm-svn: 307368
Peter Smith [Fri, 7 Jul 2017 09:11:27 +0000 (09:11 +0000)]
[ELF] Extract temporary state used in assignAddresses()
The assignAddresses() function accumulates state in the LinkerScript that
prevents it from being called multiple times. This change moves the state
into a separate structure AddressState that is created at the start of the
function and disposed of at the end.
CurAddressState is used rather than passing a reference to the state as a
parameter to the functions used by assignAddresses(). This is because the
getSymbolValue function needs to be executed in the context of AddressState
but it is stored in ScriptParser when AddressState is not available.
The AddressState is also used in a limited context by processCommands()
Differential Revision: https://reviews.llvm.org/D34345
llvm-svn: 307367
Diana Picus [Fri, 7 Jul 2017 08:53:27 +0000 (08:53 +0000)]
[ARM] GlobalISel: Fixup r307365
Rename member DebugLoc -> DbgLoc (so it doesn't conflict with the class
name).
llvm-svn: 307366
Diana Picus [Fri, 7 Jul 2017 08:39:04 +0000 (08:39 +0000)]
[ARM] GlobalISel: Select hard G_FCMP for s32
We lower to a sequence consisting of:
- MOVi 0 into a register
- VCMPS to do the actual comparison and set the VFP flags
- FMSTAT to move the flags out of the VFP unit
- MOVCCi to either use the "zero register" that we have previously set
with the MOVi, or move 1 into the result register, based on the values
of the flags
As was the case with soft-float, for some predicates (one, ueq) we
actually need two comparisons instead of just one. When that happens, we
generate two VCMPS-FMSTAT-MOVCCi sequences and chain them by means of
using the result of the first MOVCCi as the "zero register" for the
second one. This is a bit overkill, since one comparison followed by
two non-flag-setting conditional moves should be enough. In any case,
the backend manages to CSE one of the comparisons away so it doesn't
matter much.
Note that unlike SelectionDAG and FastISel, we always use VCMPS, and not
VCMPES. This makes the code a lot simpler, and it also seems correct
since the LLVM Lang Ref defines simple true/false returns if the
operands are QNaN's. For SNaN's, even VCMPS throws an Invalid Operand
exception, so they won't be slipping through unnoticed.
Implementation-wise, this introduces a template so we can share the same
code that we use for handling integer comparisons, since the only
differences are in the details (exact opcodes to be used etc). Hopefully
this will be easy to extend to s64 G_FCMP.
llvm-svn: 307365
George Rimar [Fri, 7 Jul 2017 08:29:51 +0000 (08:29 +0000)]
[ELF] - Handle symbols with default version early.
This fixes last testcase provided in PR28414.
In short issue is next: when we had X@@Version symbol in object A,
we did not resolve it to X early. Then when in another object B
we had reference to undefined X, symbol X from archive was fetched.
Since both archive and object A contains another symbol Z, duplicate
symbol definition was triggered as a result.
Correct behavior is to use X@@Version from object A instead and do not fetch
any symbols from archive.
Differential revision: https://reviews.llvm.org/D35059
llvm-svn: 307364
Craig Topper [Fri, 7 Jul 2017 06:22:36 +0000 (06:22 +0000)]
[TableGen] Cleanup capturing of instruction namespace for the fast isel emitter to remove a std::string and duplicated code. NFC
llvm-svn: 307363
Craig Topper [Fri, 7 Jul 2017 06:22:35 +0000 (06:22 +0000)]
[TableGen] Use StringRef instead of std::string for CodeGenInstruction namespace. NFC
llvm-svn: 307362
Craig Topper [Fri, 7 Jul 2017 05:50:45 +0000 (05:50 +0000)]
[TableGen] Add a proper namespace to an Instruction in an AsmMatcher test. This is required after r307358.
llvm-svn: 307361
Zachary Turner [Fri, 7 Jul 2017 05:41:25 +0000 (05:41 +0000)]
Fix lld tests after r307356.
llvm-svn: 307360
Rafael Espindola [Fri, 7 Jul 2017 05:36:53 +0000 (05:36 +0000)]
Reduce code duplication.
By addding a mapNameToDWARFSection we only need to check section names
in one place.
llvm-svn: 307359
Craig Topper [Fri, 7 Jul 2017 05:19:25 +0000 (05:19 +0000)]
[TableGen] Fix some mismatches in the use of Namespace fields versus Target name in some of our emitters.
Some of our emitters were using the name of the Target to reference things that were created by others emitters using Namespace.
Apparently all targets have the same Target name as their instruction and register Namespace field?
Someone on IRC had a target that didn't do this and was getting build errors. This patch is a necessary, but maybe not sufficient fix.
llvm-svn: 307358
Duncan P. N. Exon Smith [Fri, 7 Jul 2017 05:13:36 +0000 (05:13 +0000)]
cmath: Support clang's -fdelayed-template-parsing
r283051 added some functions to cmath (in namespace std) that have the
same name as functions in math.h (in the global namespace). Clang's
limited support for `-fdelayed-template-parsing` chokes on this. Rename
the ones in `cmath` and their uses in `complex` and the test.
rdar://problem/
32848355
llvm-svn: 307357
Zachary Turner [Fri, 7 Jul 2017 05:04:36 +0000 (05:04 +0000)]
[PDB] Teach libpdb to write DBI Stream ECNames.
Based strictly on the name, this seems to have something to do
width edit & continue. The goal of this patch has nothing to do
with supporting edit and continue though. msvc link.exe writes
very basic information into this area even when *not* compiling
with support for E&C, and so the goal here is to bring lld-link
to parity. Since we cannot know what assumptions standard tools
make about the content of PDB files, we need to be as close as
possible.
This ECNames data structure is a standard PDB string hash table.
link.exe puts a single string into this hash table, which is the
full path to the PDB file on disk. It then references this string
from the module descriptor for the compiler generated `* Linker *`
module.
With this patch, lld-link will generate the exact same sequence of
bytes as MSVC link for this subsection for a given object file
input (as reported by `llvm-pdbutil bytes -ec`).
llvm-svn: 307356
Tobias Grosser [Fri, 7 Jul 2017 04:20:55 +0000 (04:20 +0000)]
Make create_ll work with latest LLVM [NFC]
- Instead of running with -O0, we enable the highest optimization level, but
then disable optimizations. This ensures that possibly important metadata
is still emitted.
- Update the code for attribute removal to work with latest LLVM
- Do not cut an arbitrary number of lines from the LL file. It is undocumented
why this was needed at the first place, and such a feature is likely to
break with trivial IR changes that may come in the future.
llvm-svn: 307355
Lang Hames [Fri, 7 Jul 2017 03:22:57 +0000 (03:22 +0000)]
[Orc] Add missing return value (left out in r307350).
llvm-svn: 307354
Tony Tye [Fri, 7 Jul 2017 03:10:01 +0000 (03:10 +0000)]
Correct GFX9 processor names.
Differential Revision: https://reviews.llvm.org/D33736
llvm-svn: 307353
Matthias Braun [Fri, 7 Jul 2017 03:02:18 +0000 (03:02 +0000)]
RegisterScavenging: Fix PR33687
When scavenging for a use in instruction MI, we will reload after
that instruction and hence cannot spill uses/defs of this instruction.
This fixes http://llvm.org/PR33687
llvm-svn: 307352
Matthias Braun [Fri, 7 Jul 2017 03:02:17 +0000 (03:02 +0000)]
LiveRegUnits: Rename accumulateBackward()->accumulate()
Contrary to the stepForward()/stepBackward() method accumulate() doesn't
have a direction as defs, uses and clobbers all have the same effect.
Also improve the documentation comment.
llvm-svn: 307351
Lang Hames [Fri, 7 Jul 2017 02:59:13 +0000 (02:59 +0000)]
[ORC] Errorize the ORC APIs.
This patch updates the ORC layers and utilities to return and propagate
llvm::Errors where appropriate. This is necessary to allow ORC to safely handle
error cases in cross-process and remote JITing.
llvm-svn: 307350
Yaxun Liu [Fri, 7 Jul 2017 02:40:13 +0000 (02:40 +0000)]
[InferAddressSpaces] Fix assertion about null pointer
InferAddressSpaces does not check address space in collectFlatAddressExpressions,
which causes values with non flat address space put into Postorder and causes
assertion in cloneValueWithNewAddressSpace.
This patch fixes assertion in OpenCL 2.0 conformance test generic_address_space
subtest for amdgcn target.
Differential Revision: https://reviews.llvm.org/D34991
llvm-svn: 307349
Sam Clegg [Fri, 7 Jul 2017 02:01:29 +0000 (02:01 +0000)]
[WebAssembly] Support weak defined symbols
Model weakly defined symbols as symbols that are both
exports and imported and marked as weak. Local references
to the symbols refer to the import but the linker can
resolve this to the weak export if not strong symbol
is found at link time.
Differential Revision: https://reviews.llvm.org/D35029
llvm-svn: 307348
Sean Fertile [Fri, 7 Jul 2017 02:00:06 +0000 (02:00 +0000)]
Extend memcpy expansion in Transform/Utils to handle wider operand types.
Adds loop expansions for known-size and unknown-sized memcpy calls, allowing the
target to provide the operand types through TTI callbacks. The default values
for the TTI callbacks use int8 operand types and matches the existing behaviour
if they aren't overridden by the target.
Differential revision: https://reviews.llvm.org/D32536
llvm-svn: 307346
Evgeniy Stepanov [Fri, 7 Jul 2017 01:31:23 +0000 (01:31 +0000)]
Revert r307342, r307343.
Revert "Copy arguments passed by value into explicit allocas for ASan."
Revert "[asan] Add end-to-end tests for overflows of byval arguments."
Build failure on lldb-x86_64-ubuntu-14.04-buildserver.
Test failure on clang-cmake-aarch64-42vma and sanitizer-x86_64-linux-android.
llvm-svn: 307345
Kuba Mracek [Fri, 7 Jul 2017 01:06:20 +0000 (01:06 +0000)]
[cmake] Cache results of find_darwin_sdk_dir
This improves find_darwin_sdk_dir to cache the results of executing xcodebuild to find the SDK. Should significantly reduce the CMake re-configure time.
Differential Revision: https://reviews.llvm.org/D34736
llvm-svn: 307344
Evgeniy Stepanov [Fri, 7 Jul 2017 00:48:38 +0000 (00:48 +0000)]
[asan] Add end-to-end tests for overflows of byval arguments.
Included is one test for passing structs by value and one test for passing C++
objects by value.
Patch by Matt Morehouse.
Differential revision: https://reviews.llvm.org/D34827
llvm-svn: 307343
Evgeniy Stepanov [Fri, 7 Jul 2017 00:48:25 +0000 (00:48 +0000)]
Copy arguments passed by value into explicit allocas for ASan.
ASan determines the stack layout from alloca instructions. Since
arguments marked as "byval" do not have an explicit alloca instruction, ASan
does not produce red zones for them. This commit produces an explicit alloca
instruction and copies the byval argument into the allocated memory so that red
zones are produced.
Patch by Matt Morehouse.
Differential revision: https://reviews.llvm.org/D34789
llvm-svn: 307342
Evgeniy Stepanov [Fri, 7 Jul 2017 00:48:12 +0000 (00:48 +0000)]
Update Cross-DSO CFI documentation.
Reviewers: pcc
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D35094
llvm-svn: 307341
Anna Thomas [Fri, 7 Jul 2017 00:40:37 +0000 (00:40 +0000)]
[SafepointIRVerifier] NFC: Refactor code for identifying exclusive base type
Added a new Enum to identify if the base pointer is exclusively null or
exlusively some constant or not exclusively any constant.
Converted the base pointer identification method from recursive to
iterative form.
llvm-svn: 307340
George Karpenkov [Fri, 7 Jul 2017 00:22:11 +0000 (00:22 +0000)]
[lit] Modify LIT to accept environment variable LIT_FILTER to select tests.
This is especially useful when lit is invoked indirectly by the build
system, and additional arguments can not be easily specified.
Differential Revision: https://reviews.llvm.org/D35091
llvm-svn: 307339
Wei Mi [Fri, 7 Jul 2017 00:11:05 +0000 (00:11 +0000)]
[ConstHoisting] Turn on consthoist-with-block-frequency by default.
Using profile information to guide consthoisting is generally helpful for
performance, so the patch turns it on by default. No compile time or perf
regression were found using spec2000 and spec2006 on x86. Some significant
improvement (>20%) was seen on internal benchmarks.
Differential Revision: https://reviews.llvm.org/D35063
llvm-svn: 307338
Tim Hammerquist [Thu, 6 Jul 2017 23:25:35 +0000 (23:25 +0000)]
Fix Xcode project file for gtest schemes.
<rdar://problem/
33066993>
llvm-svn: 307335
Michael Kuperstein [Thu, 6 Jul 2017 23:24:39 +0000 (23:24 +0000)]
Reverting r307326 because it breaks clang tests.
llvm-svn: 307334
Craig Topper [Thu, 6 Jul 2017 23:18:43 +0000 (23:18 +0000)]
[InstCombine] No need to pass DataLayout to helper functions if we're passing the InstCombiner object. We can just ask it for the DataLayout. NFC
llvm-svn: 307333
Craig Topper [Thu, 6 Jul 2017 23:18:42 +0000 (23:18 +0000)]
[InstCombine] Remove unused arguments from some helper functions. NFC
llvm-svn: 307332
Craig Topper [Thu, 6 Jul 2017 23:18:41 +0000 (23:18 +0000)]
[InstCombine] Change a couple helper functions to only take the IRBuilder as an argument and not the whole InstCombiner object. NFC
llvm-svn: 307331
Kuba Mracek [Thu, 6 Jul 2017 23:09:16 +0000 (23:09 +0000)]
[cmake] Add an option to prefer public SDK in find_darwin_sdk_dir
Adds a CMake option DARWIN_PREFER_PUBLIC_SDK, off by default. When on, this prefers to use the public SDK, even when an internal one is present. With this, it's easy to emulate a build that the public buildbots are doing.
Differential Revision: https://reviews.llvm.org/D35071
llvm-svn: 307330
Sterling Augustine [Thu, 6 Jul 2017 22:47:19 +0000 (22:47 +0000)]
This call-site should have been updated as part of D34304.
Summary: Use an argument adjuster to preserve behavior inadvertantly changed by D34304.
Reviewers: klimek
Differential Revision: https://reviews.llvm.org/D35095
llvm-svn: 307329
Wei Mi [Thu, 6 Jul 2017 22:32:27 +0000 (22:32 +0000)]
[ConstHoisting] choose to hoist when frequency is the same.
The patch is to adjust the strategy of frequency based consthoisting:
Previously when the candidate block has the same frequency with the existing
blocks containing a const, it will not hoist the const to the candidate block.
For that case, now we change the strategy to hoist the const if only existing
blocks have more than one block member. This is helpful for reducing code size.
Differential Revision: https://reviews.llvm.org/D35084
llvm-svn: 307328
Michael Kuperstein [Thu, 6 Jul 2017 22:18:54 +0000 (22:18 +0000)]
[NVPTX] Add lowering of i128 params.
The patch adds support of i128 params lowering. The changes are quite trivial to
support i128 as a "special case" of integer type. With this patch, we lower i128
params the same way as aggregates of size 16 bytes: .param .b8 _ [16].
Currently, NVPTX can't deal with the 128 bit integers:
* in some cases because of failed assertions like
ValVTs.size() == OutVals.size() && "Bad return value decomposition"
* in other cases emitting PTX with .i128 or .u128 types (which are not valid [1])
[1] http://docs.nvidia.com/cuda/parallel-thread-execution/index.html#fundamental-types
Differential Revision: https://reviews.llvm.org/D34555
Patch by: Denys Zariaiev (denys.zariaiev@gmail.com)
llvm-svn: 307326
Lang Hames [Thu, 6 Jul 2017 22:02:49 +0000 (22:02 +0000)]
[ORC] Add missing <memory> include for shared_ptr.
Accidentally left out of r307319.
llvm-svn: 307322
Reid Kleckner [Thu, 6 Jul 2017 21:51:32 +0000 (21:51 +0000)]
[asan] Fix -Winvalid-paste error with clang-cl
We don't need to paste tokens here. String literal concatenation works
just fine here with MSVC and Clang.
llvm-svn: 307321
David L. Jones [Thu, 6 Jul 2017 21:46:47 +0000 (21:46 +0000)]
Change remaining references to lit.util.capture to use subprocess.check_output.
Summary:
The capture() function was removed in r306625. This should fix PGO breakages
reported by Michael Zolotukhin.
Reviewers: mzolotukhin
Subscribers: sanjoy, llvm-commits
Differential Revision: https://reviews.llvm.org/D35088
llvm-svn: 307320
Lang Hames [Thu, 6 Jul 2017 21:33:48 +0000 (21:33 +0000)]
[ORC] Update GlobalMappingLayer::addModuleSet to addModule.
This layer was accidentally left out of r306166.
llvm-svn: 307319