OSDN Git Service

android-x86/external-llvm.git
7 years ago[IR] Add Type::isIntOrIntVectorTy(unsigned) similar to the existing isIntegerTy(unsig...
Craig Topper [Sun, 9 Jul 2017 07:04:03 +0000 (07:04 +0000)]
[IR] Add Type::isIntOrIntVectorTy(unsigned) similar to the existing isIntegerTy(unsigned), but also works for vectors.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307492 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[IR] Make use of Type::isPtrOrPtrVectorTy/isIntOrIntVectorTy/isFPOrFPVectorTy to...
Craig Topper [Sun, 9 Jul 2017 07:04:00 +0000 (07:04 +0000)]
[IR] Make use of Type::isPtrOrPtrVectorTy/isIntOrIntVectorTy/isFPOrFPVectorTy to shorten code. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307491 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ADT] Add a default constructor and a bool conversion to function_ref.
Chandler Carruth [Sun, 9 Jul 2017 06:12:56 +0000 (06:12 +0000)]
[ADT] Add a default constructor and a bool conversion to function_ref.

The internal representation has a natural way to handle this and it
seems nicer than having to wrap this in an optional (with its own
separate flag).

This also matches how std::function works.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307490 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[FastISel] fix a fallback diagnostic.
Igor Breger [Sun, 9 Jul 2017 05:55:20 +0000 (05:55 +0000)]
[FastISel] fix a fallback diagnostic.

Summary: FastISel was marked as failed in case instruction selection succeeded.

Reviewers: qcolombet, zvi, rovka, ab

Reviewed By: zvi

Subscribers: javed.absar, ab, qcolombet, bogner, llvm-commits

Differential Revision: https://reviews.llvm.org/D34438

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307489 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agofix trivial typos; NFC
Hiroshi Inoue [Sun, 9 Jul 2017 05:54:44 +0000 (05:54 +0000)]
fix trivial typos; NFC

sucessor -> successor

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307488 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[PM] Finish implementing and fix a chain of bugs uncovered by testing
Chandler Carruth [Sun, 9 Jul 2017 03:59:31 +0000 (03:59 +0000)]
[PM] Finish implementing and fix a chain of bugs uncovered by testing
the invalidation propagation logic from an SCC to a Function.

I wrote the infrastructure to test this but didn't actually use it in
the unit test where it was designed to be used. =[ My bad. Once
I actually added it to the test case I discovered that it also hadn't
been properly implemented, so I've implemented it. The logic in the FAM
proxy for an SCC pass to propagate invalidation follows the same ideas
as the FAM proxy for a Module pass, but the implementation is a bit
different to reflect the fact that it is forwarding just for an SCC.

However, implementing this correctly uncovered a surprising "bug" (it
was conservatively correct but relatively very expensive) in how we
handle invalidation when splitting one SCC into multiple SCCs. We did an
eager invalidation when in reality we should be deferring invaliadtion
for the *current* SCC to the CGSCC pass manager and just invaliating the
newly constructed SCCs. Otherwise we end up invalidating too much too
soon. This was exposed by the inliner test case that I've updated. Now,
we invalidate *just* the split off '(test1_f)' SCC when doing the CG
update, and then the inliner finishes and invalidates the '(test1_g,
test1_h)' SCC's analyses. The first few attempts at fixing this hit
still more bugs, but all of those are covered by existing tests. For
example, the inliner should also preserve the FAM proxy to avoid
unnecesasry invalidation, and this is safe because the CG update
routines it uses handle any necessary adjustments to the FAM proxy.

Finally, the unittests for the CGSCC pass manager needed a bunch of
updates where we weren't correctly preserving the FAM proxy because it
hadn't been fully implemented and failing to preserve it didn't matter.

Note that this doesn't yet fix the current crasher due to MemSSA finding
a stale dominator tree, but without this the fix to that crasher doesn't
really make any sense when testing because it relies on the proxy
behavior.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307487 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] Speculatively implement a fix for what might be the root cause of PR337...
Craig Topper [Sun, 9 Jul 2017 03:25:17 +0000 (03:25 +0000)]
[InstCombine] Speculatively implement a fix for what might be the root cause of PR33721 by making sure that we have integer types before doing select C, -1, 0 -> sext C to int

I recently changed m_One and m_AllOnes to use Constant::isOneValue/isAllOnesValue which work on floating point values too. The original implementation looked specifically for ConstantInt scalars and splats. So I'm guessing we are accidentally trying to issue sext/zexts on floating point types now.

Hopefully I figure out how to reproduce the failure from the PR soon.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307486 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AMDGPU] Fix -Wimplicit-fallthrough warning. NFCI.
Simon Pilgrim [Sat, 8 Jul 2017 19:50:03 +0000 (19:50 +0000)]
[AMDGPU] Fix -Wimplicit-fallthrough warning. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307485 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AArch64] Fix -Wimplicit-fallthrough warnings. NFCI.
Simon Pilgrim [Sat, 8 Jul 2017 19:28:24 +0000 (19:28 +0000)]
[AArch64] Fix -Wimplicit-fallthrough warnings. NFCI.

Add breaks - doesn't affect results as both GPR/FPU both check for 32/64 bit sizes. So will still default to GenericOps in the same way.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307484 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ARM] Fix -Wimplicit-fallthrough warning. NFCI.
Simon Pilgrim [Sat, 8 Jul 2017 18:42:04 +0000 (18:42 +0000)]
[ARM] Fix -Wimplicit-fallthrough warning. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307480 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Bash-autocompletion] Auto complete cc1 options if -cc1 is specified
Yuka Takahashi [Sat, 8 Jul 2017 17:48:59 +0000 (17:48 +0000)]
[Bash-autocompletion] Auto complete cc1 options if -cc1 is specified

Summary:
We don't want to autocomplete flags whose Flags class has `NoDriverOption` when argv[1] is not `-cc1`.

Another idea for this implementation is to make --autocomplete a cc1
option and handle it in clang Frontend, by porting --autocomplete
handler from Driver to Frontend, so that we can handle Driver options
and CC1 options in unified manner.

Differential Revision: https://reviews.llvm.org/D34770

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307479 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRe-enable "[IndVars] Canonicalize comparisons between non-negative values and indvars"
Max Kazantsev [Sat, 8 Jul 2017 17:17:30 +0000 (17:17 +0000)]
Re-enable "[IndVars] Canonicalize comparisons between non-negative values and indvars"

The patch was reverted due to a bug. The bug was that if the IV is the 2nd operand of the icmp
instruction, then the "Pred" variable gets swapped and differs from the instruction's predicate.
In this patch we use the original predicate to do the transformation.

Also added a test case that exercises this situation.

Differentian Revision: https://reviews.llvm.org/D35107

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307477 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[LoopVectorize] partly revert r307475
Sanjay Patel [Sat, 8 Jul 2017 16:34:46 +0000 (16:34 +0000)]
[LoopVectorize] partly revert r307475

Bots are failing because of the additional checks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307476 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[LoopVectorize] auto-generate complete checks; NFC
Sanjay Patel [Sat, 8 Jul 2017 16:10:42 +0000 (16:10 +0000)]
[LoopVectorize] auto-generate complete checks; NFC

I'm looking at a cmp transform in InstCombine that would affect these tests,
but it's hard to know if it makes things better or worse without seeing the
full IR. OTOH, maybe these tests shouldn't be running a bunch of transform
passes in the first place?

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307475 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix -Wimplicit-fallthrough warning. NFCI.
Simon Pilgrim [Sat, 8 Jul 2017 15:26:26 +0000 (15:26 +0000)]
Fix -Wimplicit-fallthrough warning. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307473 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[x86] add SBB optimization for SETBE (ule) condition code
Sanjay Patel [Sat, 8 Jul 2017 14:04:48 +0000 (14:04 +0000)]
[x86] add SBB optimization for SETBE (ule) 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. 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
rL307404 (D34652)

As acknowledged in the earlier review, there's a possibility that some Intel
uarch would prefer to produce an xor to clear the fake register operand with
sbb %eax, %eax. This will likely need to be addressed in a separate pass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307471 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Solaris] get rid of _RESTRICT_KYWD warning during the build
Kamil Rytarowski [Sat, 8 Jul 2017 11:27:56 +0000 (11:27 +0000)]
[Solaris] get rid of _RESTRICT_KYWD warning during the build

Summary:
(re)definition of _RESTRICT_KYWD rightfully causes a warning message during the Solaris build.
This hack is not needed if build compiler is properly configured (.e.g /usr/bin/gcc) so just remove it.

Reviewers: ro, mgorny, krytarowski, joerg

Reviewed By: joerg

Subscribers: quenelle, llvm-commits

Patch by Fedor Sergeev (Oracle).

Differential Revision: https://reviews.llvm.org/D35054

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307469 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] In getHostCPUName, remove some code that changes some AMD CPU names based on...
Craig Topper [Sat, 8 Jul 2017 06:44:36 +0000 (06:44 +0000)]
[X86] In getHostCPUName, remove some code that changes some AMD CPU names based on features not being enabled.

The CPU name is really just used for scheduler and other microarchitectural optimizations. The feature flags should be determined by getHostCPUFeatures which should always be used with getHostCPUName. Trying to alter CPU name strings to control features just isn't practical.

Most of these types of things were removed from Intel CPUs a while ago.

This is part of my plan to bring compiler-rt's cpu_model.c file up to date with the equivalent functionality in libgcc. A lot of the code in that file is copied from Host.cpp and we want to keep them reasonably in sync.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307467 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Correct the BDVER4 model numbers to include 0x70-0x7f.
Craig Topper [Sat, 8 Jul 2017 06:44:35 +0000 (06:44 +0000)]
[X86] Correct the BDVER4 model numbers to include 0x70-0x7f.

According to wikipedia and some other googling suggests these should also be considered as BDVER4.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307466 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Minor formatting fix. NFC
Craig Topper [Sat, 8 Jul 2017 06:44:34 +0000 (06:44 +0000)]
[X86] Minor formatting fix. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307465 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Use 'unsigned' instead of 'unsigned int' for consistency in the X86 portion...
Craig Topper [Sat, 8 Jul 2017 05:16:14 +0000 (05:16 +0000)]
[X86] Use 'unsigned' instead of 'unsigned int' for consistency in the X86 portion of Host.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307463 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Cleanup some CPUID usage in getAvailableFeatures.
Craig Topper [Sat, 8 Jul 2017 05:16:13 +0000 (05:16 +0000)]
[X86] Cleanup some CPUID usage in getAvailableFeatures.

We should make sure leaf 1 is available before accessing it. Same with leaf 0x80000001.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307462 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "Revert "Revert "Revert "Switch external cvtres.exe for llvm's own resource...
Eric Beckmann [Sat, 8 Jul 2017 03:06:10 +0000 (03:06 +0000)]
Revert "Revert "Revert "Revert "Switch external cvtres.exe for llvm's own resource library.""""

This reverts commit 147f45ff24456aea59575fa4ac16c8fa554df46a.

Revert "Revert "Revert "Revert "Replace trivial use of external rc.exe by writing our own .res file.""""

This reverts commit 61a90a67ed54a1f0dfeab457b65abffa129569e4.

The patches were intially reverted because they were causing a failure
on CrWinClangLLD.  Unfortunately, this was done haphazardly and didn't
compile, so the revert was reverted again quickly to fix this.  One that
was done, the revert of the revert was itself reverted.  This allowed me
to finally fix the actual bug in r307452.  This patch re-enables the
code path that had originally been causing the bug, now that it (should)
be fixed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307460 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove a variable that was only used in asserts and had a duplicate copy in something...
Eric Christopher [Sat, 8 Jul 2017 01:03:29 +0000 (01:03 +0000)]
Remove a variable that was only used in asserts and had a duplicate copy in something we did use anyhow.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307457 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd name offset flags, for parity with cvtres.exe.
Eric Beckmann [Fri, 7 Jul 2017 23:23:53 +0000 (23:23 +0000)]
Add name offset flags, for parity with cvtres.exe.

Summary:
The original cvtres.exe sets the high bit when an identifier offset
points to a string.  Even though this is not mentioned in the spec, and
in fact does not seem to cause errors with most cases, for some reason
this causes a failure in Chromium where the new resource file is not
verified as a new version.  This patch sets this high bit flag, and also
adds a test case to check that the output of our library is always
identical to original cvtres.

Reviewers: zturner, ruiu

Subscribers: llvm-commits, hiraditya

Differential Revision: https://reviews.llvm.org/D35099

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307452 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] Make InstCombine's IRBuilder be passed by reference everywhere
Craig Topper [Fri, 7 Jul 2017 23:16:26 +0000 (23:16 +0000)]
[InstCombine] Make InstCombine's IRBuilder be passed by reference everywhere

Previously the InstCombiner class contained a pointer to an IR builder that had been passed to the constructor. Sometimes this would be passed to helper functions as either a pointer or the pointer would be dereferenced to be passed by reference.

This patch makes it a reference everywhere including the InstCombiner class itself so there is more inconsistency. This a large, but mechanical patch. I've done very minimal formatting changes on it despite what clang-format wanted to do.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307451 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[PowerPC] NFC : Common up definitions of isIntS16Immediate and update parameter to...
Lei Huang [Fri, 7 Jul 2017 21:12:35 +0000 (21:12 +0000)]
[PowerPC] NFC : Common up definitions of isIntS16Immediate and update parameter to int16_t

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307442 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoProfData: Fix some unchecked Errors in unit tests
David Blaikie [Fri, 7 Jul 2017 21:02:59 +0000 (21:02 +0000)]
ProfData: Fix some unchecked Errors in unit tests

The 'NoError' function was meant to be used as the input to
ASSERT/EXPECT_TRUE, but it is easy to forget this (it could be annotated
with nodiscard to help this) so many sites that look like they're checked
are not (& silently discard the failure). Only one site actually has an
Error sneaking out this way and I've replaced that one with a
FIXME+consumeError.

The rest of the code has been modified to use the EXPECT_THAT_ERROR
macros Zach introduced a while back. Between the options available this
seems OK/good/something to standardize on - though it's difficult to
build a matcher that could handle checking for a specific llvm::Error
result, so those remain using the custom ErrorEquals (& the nodiscard
added to ensure it is not misused as it was previous to this patch). It
could still be generalized a bit further (even not as far as a matcher,
but at least support multiple kinds of Error, etc) & added to the
general Error utility header.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307440 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoIncrease the import-threshold for crtical functions.
Dehao Chen [Fri, 7 Jul 2017 21:01:00 +0000 (21:01 +0000)]
Increase the import-threshold for crtical functions.

Summary: For interative sample-pgo, if a hot call site is inlined in the profiling binary, we should inline it in before profile annotation in the backend. Before that, the compile phase first collects all GUIDs that needs to be imported and creates virtual "hot" call edge in the summary. However, "hot" is not good enough to guarantee the callsites get inlined. This patch introduces "critical" call edge, and assign much higher importing threshold for those edges.

Reviewers: tejohnson

Reviewed By: tejohnson

Subscribers: sanjoy, mehdi_amini, llvm-commits, eraman

Differential Revision: https://reviews.llvm.org/D35096

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307439 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd sample PGO support to ThinLTO new pass manager.
Dehao Chen [Fri, 7 Jul 2017 20:53:10 +0000 (20:53 +0000)]
Add sample PGO support to ThinLTO new pass manager.

Summary:
For SamplePGO + ThinLTO, because profile annotation is done twice at both PrepareForThinLTO pipeline and backend compiler, the following changes are needed at the PrepareForThinLTO phase to ensure the IR is not changed dramatically. Otherwise the profile annotation will be inaccurate in the backend compiler.

* disable hot-caller heuristic
* disable loop unrolling
* disable indirect call promotion

This will unblock the new PM testing for sample PGO (tools/clang/test/CodeGen/pgo-sample-thinlto-summary.c), which will be covered in another cfe patch.

Reviewers: chandlerc, tejohnson, davidxl

Reviewed By: tejohnson

Subscribers: sanjoy, mehdi_amini, Prazek, inglorion, llvm-commits

Differential Revision: https://reviews.llvm.org/D34895

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307437 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[PDB] More changes to bring lld PDBs to parity with MSVC.
Zachary Turner [Fri, 7 Jul 2017 20:25:39 +0000 (20:25 +0000)]
[PDB] More changes to bring lld PDBs to parity with MSVC.

1) Don't write a /src/headerblock stream.  This appears to be
   written conditionally by MSVC, but it's not clear what the
   condition is.  For now, just remove it since we dont' know
   what it is anyway and the particular pdb we've checked in
   for the test doesn't have one.
2) Write a valid timestamp for the PDB file signature.  This
   leads to non-reproducible builds, but it matches the default
   behavior of link, so it should be out default as well.  If
   we need reproducibility, we should add a separate command
   line option for it that is off by default.
3) Write an empty FPO stream.  MSVC seems to always write an
   FPO stream.  This change makes the stream directory match
   up, although we still need to make the contents of the FPO
   stream match.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307436 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[LoopUnrollRuntime] Support multiple exit blocks unrolling when prolog remainder...
Anna Thomas [Fri, 7 Jul 2017 20:12:32 +0000 (20:12 +0000)]
[LoopUnrollRuntime] Support multiple exit blocks unrolling when prolog remainder generated

With the NFC refactoring in rL307417 (git SHA 987dd01), all the logic
is in place to support multiple exit/exiting blocks when prolog
remainder is generated.
This patch removed the assert that multiple exit blocks unrolling is only
supported when epilog remainder is generated.

Also, added test runs and checks with PROLOG prefix in
runtime-loop-multiple-exits.ll test cases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307435 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[PatternMatch] Implemenet m_SignMask using Constant::isMinSignedValue instead of...
Craig Topper [Fri, 7 Jul 2017 19:56:23 +0000 (19:56 +0000)]
[PatternMatch] Implemenet m_SignMask using Constant::isMinSignedValue instead of doing splat detection and analyzing the resulting APInt.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307433 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[PatternMatch] Implement m_AnyZero using Constant::isZeroValue instead of ORing toget...
Craig Topper [Fri, 7 Jul 2017 19:56:21 +0000 (19:56 +0000)]
[PatternMatch] Implement m_AnyZero using Constant::isZeroValue instead of ORing together isNullValue and isNegativeZeroValue. NFCI

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307432 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[PatternMatch] Implement m_One and m_AllOnes using Constant::isOneValue/isAllOnesValu...
Craig Topper [Fri, 7 Jul 2017 19:56:20 +0000 (19:56 +0000)]
[PatternMatch] Implement m_One and m_AllOnes using Constant::isOneValue/isAllOnesValue instead of doing our own splat detection and checking the resulting APInt.

Should result in less compiled code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307431 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[APInt] Add a fastpath for the single word case of isOneValue to match isNullValue...
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307430 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[DAGCombiner] use local variable to shorten code; NFCI
Sanjay Patel [Fri, 7 Jul 2017 19:34:42 +0000 (19:34 +0000)]
[DAGCombiner] use local variable to shorten code; NFCI

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307429 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[RegAllocFast] Don't insert kill flags of super-register for partial kill
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307428 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[RegAllocFast] Add the proper initialize method to use the .mir infrastructure
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307427 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[llvm-pdbutil] Fix build.
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307426 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Local] Update the comment for removeUnreachableBlocks.
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307425 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFuzzerUtilDarwin.cpp: We need to pass modifiable strings to posix_spawn
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307424 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUse windows path syntax when writing PDB module name.
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307423 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix some differences between lld and MSVC generated PDBs.
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307422 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[llvm-pdbutil] Improve diff mode.
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307421 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agovim: add 'builtin', 'nobuiltin', 'nonnull', and 'speculatable' to the keyword list.
Craig Topper [Fri, 7 Jul 2017 18:28:45 +0000 (18:28 +0000)]
vim: add 'builtin', 'nobuiltin', 'nonnull', and 'speculatable' to the keyword list.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307419 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[cloning] Do not duplicate types when cloning functions
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307418 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[LoopUnrollRuntime] NFC: use the precomputed loop exit in ConnectProlog
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307417 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[PPC CodeGen] Expand the bitreverse.i32 intrinsic.
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307413 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix some more -Wimplicit-fallthrough warnings. NFCI.
Simon Pilgrim [Fri, 7 Jul 2017 16:40:06 +0000 (16:40 +0000)]
Fix some more -Wimplicit-fallthrough warnings. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307411 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ARM] Implement interleaved access bug fix from r306334
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307409 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AMDGPU] Assembler: refactor convert methods (VOP3 and MIMG)
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307407 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix variable names. NFC.
Rafael Espindola [Fri, 7 Jul 2017 15:20:55 +0000 (15:20 +0000)]
Fix variable names. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307406 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[x86] add SBB optimization for SETAE (uge) condition code
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307404 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[DemandedBits] fix formatting; NFC
Sanjay Patel [Fri, 7 Jul 2017 14:39:26 +0000 (14:39 +0000)]
[DemandedBits] fix formatting; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307403 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AMDGPU][mc][gfx9] Added support of op_sel/op_sel_hi for V_MAD_MIX*
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307402 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ValueTracking] Fix the identity case (LHS => RHS) when the LHS is false.
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.).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307400 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoNFC: I simply added CHECK-LABEL to prevent false matches in the tests.
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307397 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Lanai] Fix -Wimplicit-fallthrough warning. NFCI.
Simon Pilgrim [Fri, 7 Jul 2017 13:22:47 +0000 (13:22 +0000)]
[Lanai] Fix -Wimplicit-fallthrough warning. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307396 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Hexagon] Fix some more -Wimplicit-fallthrough warnings. NFCI.
Simon Pilgrim [Fri, 7 Jul 2017 13:21:43 +0000 (13:21 +0000)]
[Hexagon] Fix some more -Wimplicit-fallthrough warnings. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307395 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AArch64] Fix -Wimplicit-fallthrough warnings. NFCI.
Simon Pilgrim [Fri, 7 Jul 2017 13:03:28 +0000 (13:03 +0000)]
[AArch64] Fix -Wimplicit-fallthrough warnings. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307393 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SafepointIRVerifier] Avoid false positives in GC verifier for compare between pointers
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307392 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AArch64] Use 16 bytes as preferred function alignment on Cortex-A57.
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307389 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix uninitalized memory access introduced in r307350.
Daniel Jasper [Fri, 7 Jul 2017 10:23:13 +0000 (10:23 +0000)]
Fix uninitalized memory access introduced in r307350.

Found by MSAN :).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307383 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[PowerPC] Fix -Wimplicit-fallthrough warnings. NFCI.
Simon Pilgrim [Fri, 7 Jul 2017 10:21:44 +0000 (10:21 +0000)]
[PowerPC] Fix -Wimplicit-fallthrough warnings. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307382 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AMDGPU] Fix -Wimplicit-fallthrough warnings. NFCI.
Simon Pilgrim [Fri, 7 Jul 2017 10:18:57 +0000 (10:18 +0000)]
[AMDGPU] Fix -Wimplicit-fallthrough warnings. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307381 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AArch64] Use 16 bytes as preferred function alignment on Cortex-A72.
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307380 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Sparc] Fix -Wimplicit-fallthrough warning. NFCI.
Simon Pilgrim [Fri, 7 Jul 2017 10:14:46 +0000 (10:14 +0000)]
[Sparc] Fix -Wimplicit-fallthrough warning. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307378 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUpdate the Windows version of updateTripleOSVersion to account for
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307377 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SystemZ] Fix -Wimplicit-fallthrough warnings. NFCI.
Simon Pilgrim [Fri, 7 Jul 2017 10:07:09 +0000 (10:07 +0000)]
[SystemZ] Fix -Wimplicit-fallthrough warnings. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307376 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Arm] Fix -Wimplicit-fallthrough warnings. NFCI.
Simon Pilgrim [Fri, 7 Jul 2017 10:05:45 +0000 (10:05 +0000)]
[Arm] Fix -Wimplicit-fallthrough warnings. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307375 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Hexagon] Fix -Wimplicit-fallthrough warnings. NFCI.
Simon Pilgrim [Fri, 7 Jul 2017 10:04:12 +0000 (10:04 +0000)]
[Hexagon] Fix -Wimplicit-fallthrough warnings. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307374 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Support] sys::getProcessTriple should return a macOS triple using
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307372 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AArch64] Add test case for preferred function alignment (NFC).
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307369 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ARM] GlobalISel: Fixup r307365
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).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307366 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ARM] GlobalISel: Select hard G_FCMP for s32
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307365 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[TableGen] Cleanup capturing of instruction namespace for the fast isel emitter to...
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307363 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[TableGen] Use StringRef instead of std::string for CodeGenInstruction namespace...
Craig Topper [Fri, 7 Jul 2017 06:22:35 +0000 (06:22 +0000)]
[TableGen] Use StringRef instead of std::string for CodeGenInstruction namespace. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307362 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[TableGen] Add a proper namespace to an Instruction in an AsmMatcher test. This is...
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307361 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReduce code duplication.
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307359 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[TableGen] Fix some mismatches in the use of Namespace fields versus Target name...
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307358 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[PDB] Teach libpdb to write DBI Stream ECNames.
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`).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307356 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Orc] Add missing return value (left out in r307350).
Lang Hames [Fri, 7 Jul 2017 03:22:57 +0000 (03:22 +0000)]
[Orc] Add missing return value (left out in r307350).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307354 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCorrect GFX9 processor names.
Tony Tye [Fri, 7 Jul 2017 03:10:01 +0000 (03:10 +0000)]
Correct GFX9 processor names.

Differential Revision: https://reviews.llvm.org/D33736

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307353 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRegisterScavenging: Fix PR33687
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307352 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoLiveRegUnits: Rename accumulateBackward()->accumulate()
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307351 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ORC] Errorize the ORC APIs.
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307350 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InferAddressSpaces] Fix assertion about null pointer
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307349 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[WebAssembly] Support weak defined symbols
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307348 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoExtend memcpy expansion in Transform/Utils to handle wider operand types.
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307346 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert r307342, r307343.
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307345 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCopy arguments passed by value into explicit allocas for ASan.
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307342 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SafepointIRVerifier] NFC: Refactor code for identifying exclusive base type
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307340 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[lit] Modify LIT to accept environment variable LIT_FILTER to select tests.
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307339 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ConstHoisting] Turn on consthoist-with-block-frequency by default.
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307338 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReverting r307326 because it breaks clang tests.
Michael Kuperstein [Thu, 6 Jul 2017 23:24:39 +0000 (23:24 +0000)]
Reverting r307326 because it breaks clang tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307334 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] No need to pass DataLayout to helper functions if we're passing the...
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307333 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] Remove unused arguments from some helper functions. NFC
Craig Topper [Thu, 6 Jul 2017 23:18:42 +0000 (23:18 +0000)]
[InstCombine] Remove unused arguments from some helper functions. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307332 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] Change a couple helper functions to only take the IRBuilder as an argum...
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307331 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ConstHoisting] choose to hoist when frequency is the same.
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307328 91177308-0d34-0410-b5e6-96231b3b80d8