platform/upstream/llvm.git
7 years agochange what branches Appveyor builds
Eric Fiselier [Wed, 19 Apr 2017 23:27:48 +0000 (23:27 +0000)]
change what branches Appveyor builds

llvm-svn: 300788

7 years ago[GlobalOpt] Simplify attribute code stripping nest, NFC
Reid Kleckner [Wed, 19 Apr 2017 23:26:44 +0000 (23:26 +0000)]
[GlobalOpt] Simplify attribute code stripping nest, NFC

llvm-svn: 300787

7 years agoAdd appveyor.yml config for a future Windows bot.
Eric Fiselier [Wed, 19 Apr 2017 23:26:21 +0000 (23:26 +0000)]
Add appveyor.yml config for a future Windows bot.

I'm currently trying to get a libc++ Windows builder working on appveyor.
This patch adds the configuration file needed to build libc++ on Appveyor.
Details of where the buildbot can be found will come later

llvm-svn: 300786

7 years agoFix !N and !-N commands and add a test case.
Jim Ingham [Wed, 19 Apr 2017 23:21:04 +0000 (23:21 +0000)]
Fix !N and !-N commands and add a test case.

<rdar://problem/31713267>

llvm-svn: 300785

7 years agoSimplify test for sret attribute in instcombine
Reid Kleckner [Wed, 19 Apr 2017 23:17:47 +0000 (23:17 +0000)]
Simplify test for sret attribute in instcombine

This change is correct because the verifier requires that at most one
argument be marked 'sret'.

NFC, removes a use of AttributeList slot APIs.

llvm-svn: 300784

7 years agoTemporarily revert r299221 to fix nondeterminism in ThinLTO builder.
Galina Kistanova [Wed, 19 Apr 2017 23:16:14 +0000 (23:16 +0000)]
Temporarily revert r299221 to fix nondeterminism in ThinLTO builder.

llvm-svn: 300783

7 years agoRefresh the statepoint docs a bit
Philip Reames [Wed, 19 Apr 2017 23:16:13 +0000 (23:16 +0000)]
Refresh the statepoint docs a bit

The documentation had gotten a bit stale.  The revised one are by no means perfect, but I tried to remove the obvious incorrect or misleading statements.

llvm-svn: 300782

7 years agoX86FrameLowering: Fix getFrameIndexReference() for 'fixed' objects
Matthias Braun [Wed, 19 Apr 2017 23:10:43 +0000 (23:10 +0000)]
X86FrameLowering: Fix getFrameIndexReference() for 'fixed' objects

Debug information is calculated with getFrameIndexReference() which was
missing some logic for the fixed object cases (= parameters on the stack).

rdar://24557797

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

llvm-svn: 300781

7 years ago[sanitizer-coverage] remove more unused code
Kostya Serebryany [Wed, 19 Apr 2017 23:05:53 +0000 (23:05 +0000)]
[sanitizer-coverage] remove more unused code

llvm-svn: 300780

7 years ago[Object] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Wed, 19 Apr 2017 23:02:10 +0000 (23:02 +0000)]
[Object] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 300779

7 years ago[sanitizer-coverage] remove some more stale code
Kostya Serebryany [Wed, 19 Apr 2017 22:42:11 +0000 (22:42 +0000)]
[sanitizer-coverage] remove some more stale code

llvm-svn: 300778

7 years agoRemove two unused variables (-Werror).
Evgeniy Stepanov [Wed, 19 Apr 2017 22:27:23 +0000 (22:27 +0000)]
Remove two unused variables (-Werror).

llvm-svn: 300777

7 years ago[sanitizer-coverage] trim down the docs
Kostya Serebryany [Wed, 19 Apr 2017 22:25:30 +0000 (22:25 +0000)]
[sanitizer-coverage] trim down the docs

llvm-svn: 300776

7 years ago[sanitizer-coverage] remove run-time support for -fsanitize-coverage=indirect-calls
Kostya Serebryany [Wed, 19 Apr 2017 22:24:03 +0000 (22:24 +0000)]
[sanitizer-coverage] remove run-time support for -fsanitize-coverage=indirect-calls

llvm-svn: 300775

7 years ago[APInt] Cast more calls to add/sub/mul overflow functions to void. I missed the unitt...
Craig Topper [Wed, 19 Apr 2017 22:11:05 +0000 (22:11 +0000)]
[APInt] Cast more calls to add/sub/mul overflow functions to void. I missed the unittests in r300758.

llvm-svn: 300773

7 years ago[DAG] add splat vector support for 'or' in SimplifyDemandedBits
Sanjay Patel [Wed, 19 Apr 2017 22:00:00 +0000 (22:00 +0000)]
[DAG] add splat vector support for 'or' in SimplifyDemandedBits

I've changed one of the tests to not fold away, but we didn't and still don't do the transform
that the comment claims we do (and I don't know why we'd want to do that).

Follow-up to:
https://reviews.llvm.org/rL300725
https://reviews.llvm.org/rL300763

llvm-svn: 300772

7 years agoFix typo in Windows test configuration code
Eric Fiselier [Wed, 19 Apr 2017 21:52:08 +0000 (21:52 +0000)]
Fix typo in Windows test configuration code

llvm-svn: 300770

7 years ago[sanitizer-coverage] remove stale code
Kostya Serebryany [Wed, 19 Apr 2017 21:48:09 +0000 (21:48 +0000)]
[sanitizer-coverage] remove stale code

llvm-svn: 300769

7 years ago[libFuzzer] remove -output_csv option. It duplicates the default output and got out...
Kostya Serebryany [Wed, 19 Apr 2017 21:34:58 +0000 (21:34 +0000)]
[libFuzzer] remove -output_csv option. It duplicates the default output and got out of sync

llvm-svn: 300768

7 years ago[sanitizer-coverage] deprecate -fsanitize-coverage=trace-bb
Kostya Serebryany [Wed, 19 Apr 2017 21:31:11 +0000 (21:31 +0000)]
[sanitizer-coverage] deprecate -fsanitize-coverage=trace-bb

llvm-svn: 300767

7 years ago[sanitizer-coverage] remove run-time support for -fsanitize-coverage=trace-bb
Kostya Serebryany [Wed, 19 Apr 2017 21:30:46 +0000 (21:30 +0000)]
[sanitizer-coverage] remove run-time support for -fsanitize-coverage=trace-bb

llvm-svn: 300766

7 years agoFixup style from r300760
Francis Ricci [Wed, 19 Apr 2017 21:25:06 +0000 (21:25 +0000)]
Fixup style from r300760

llvm-svn: 300765

7 years agoCorrrect warn_unused_result attribute
Erich Keane [Wed, 19 Apr 2017 21:24:55 +0000 (21:24 +0000)]
Corrrect warn_unused_result attribute

The original idea was that if the attribute on an operator,
that the return-value unused-ness wouldn't matter. However,
all of the operators except postfix inc/dec return
references! References don't result in this warning
anyway, so those are already excluded.

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

llvm-svn: 300764

7 years ago[DAG] add splat vector support for 'xor' in SimplifyDemandedBits
Sanjay Patel [Wed, 19 Apr 2017 21:23:09 +0000 (21:23 +0000)]
[DAG] add splat vector support for 'xor' in SimplifyDemandedBits

This allows forming more 'not' ops, so we get improvements for ISAs that have and-not.

Follow-up to:
https://reviews.llvm.org/rL300725

llvm-svn: 300763

7 years agoFix assertion failure in codegen on non-template deduction guide.
Richard Smith [Wed, 19 Apr 2017 21:15:45 +0000 (21:15 +0000)]
Fix assertion failure in codegen on non-template deduction guide.

llvm-svn: 300762

7 years agoARMFrameLowering: Reserve emergency spill slot for large arguments
Matthias Braun [Wed, 19 Apr 2017 21:11:44 +0000 (21:11 +0000)]
ARMFrameLowering: Reserve emergency spill slot for large arguments

Re-commit after revert in r300668. Changed getMaxFPOffset() to a
more conservative heuristic instead of trying to be clever and missing
for some exotic calling conventions.

We need to reserve an emergency spill slot in cases with large argument
types that could overflow immediate offsets for FP relative address
calculations.

rdar://31317893

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

llvm-svn: 300761

7 years agoMake sure to scan mmap'd memory regions for root pointers on OS X
Francis Ricci [Wed, 19 Apr 2017 21:11:08 +0000 (21:11 +0000)]
Make sure to scan mmap'd memory regions for root pointers on OS X

Summary:
In the general case, we only need to check for root regions inside
the memory map returned by procmaps. However, on Darwin,
we also need to check inside mmap'd regions, which aren't returned
in the list of modules we get from procmaps.

This patch refactors memory region scanning on darwin to reduce
code duplication with the kernel alloc once page scan.

Reviewers: kubamracek, alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 300760

7 years agoImplement StopTheWorld for Darwin
Francis Ricci [Wed, 19 Apr 2017 21:11:07 +0000 (21:11 +0000)]
Implement StopTheWorld for Darwin

Reviewers: kubamracek, alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 300759

7 years ago[APInt] Cast calls to add/sub/mul overflow methods to void if only their overflow...
Craig Topper [Wed, 19 Apr 2017 21:09:45 +0000 (21:09 +0000)]
[APInt] Cast calls to add/sub/mul overflow methods to void if only their overflow bool out param is used.

This is preparation for a clang change to improve the [[nodiscard]] warning to not be ignored on methods that return a class marked [[nodiscard]] that are defined in the class itself. See D32207.

We should consider adding wrapper methods to APInt that return the overflow flag directly and discard the APInt result. This would eliminate the void casts and the need to create a bool before the call to pass to the out param.

llvm-svn: 300758

7 years ago[InstCombine] Add frem constant folding test (PR3316)
Simon Pilgrim [Wed, 19 Apr 2017 21:09:19 +0000 (21:09 +0000)]
[InstCombine] Add frem constant folding test (PR3316)

llvm-svn: 300757

7 years ago[CodeGen] Use preincrement version of APInt::operator++ instead of postincrement...
Craig Topper [Wed, 19 Apr 2017 21:02:45 +0000 (21:02 +0000)]
[CodeGen] Use preincrement version of APInt::operator++ instead of postincrement to avoid creating and immediately discarding a temporary APInt.

This is preparation for a clang change to improve the [[nodiscard]] warning to not be ignored on methods that return a class marked [[nodiscard]] that are defined in the class itself. See D32207.

llvm-svn: 300756

7 years agoFix a leak in tools/driver/cc1as_main.cpp
Kostya Serebryany [Wed, 19 Apr 2017 20:57:13 +0000 (20:57 +0000)]
Fix a leak in tools/driver/cc1as_main.cpp

Summary: For some reason, the asan bot has recently started reporting this leak even though it existed for ages.

Reviewers: pcc

Reviewed By: pcc

Subscribers: cfe-commits

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

llvm-svn: 300755

7 years agoAMDGPU: Custom lower illegal small select types
Matt Arsenault [Wed, 19 Apr 2017 20:53:07 +0000 (20:53 +0000)]
AMDGPU: Custom lower illegal small select types

Promote them to i32 vectors to avoid unpacking and re-packing
the vectors.

llvm-svn: 300754

7 years agoCode style change as suggested in https://reviews.llvm.org/D32177 (NFC)
Dehao Chen [Wed, 19 Apr 2017 20:52:21 +0000 (20:52 +0000)]
Code style change as suggested in https://reviews.llvm.org/D32177 (NFC)

llvm-svn: 300753

7 years ago[ARM] Remove redundant computeKnownBits helper.
Eli Friedman [Wed, 19 Apr 2017 20:50:57 +0000 (20:50 +0000)]
[ARM] Remove redundant computeKnownBits helper.

Move the BFI logic to computeKnownBitsForTargetNode, and delete
the redundant CMOV logic.

This is intended as a cleanup, but it's probably possible to construct
a case where moving the BFI logic allows more combines.

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

llvm-svn: 300752

7 years ago[GISEL]: Move getConstantVReg to Utils
Aditya Nandakumar [Wed, 19 Apr 2017 20:48:50 +0000 (20:48 +0000)]
[GISEL]: Move getConstantVReg to Utils

NFCI

llvm-svn: 300751

7 years ago[InstCombine] Add frem constant folding test (PR32177)
Simon Pilgrim [Wed, 19 Apr 2017 20:47:58 +0000 (20:47 +0000)]
[InstCombine] Add frem constant folding test (PR32177)

llvm-svn: 300750

7 years ago[ARM] Use TableGen patterns to select vtbl. NFC.
Eli Friedman [Wed, 19 Apr 2017 20:39:39 +0000 (20:39 +0000)]
[ARM] Use TableGen patterns to select vtbl. NFC.

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

llvm-svn: 300749

7 years agoTurn symbolization on for ASan unit test.
Alex Shlyapnikov [Wed, 19 Apr 2017 20:39:09 +0000 (20:39 +0000)]
Turn symbolization on for ASan unit test.

Summary:
On PowerPC and ARM (possibly, need to verify), couple tests involving
pthread_exit fail due to leaks detected by LSan. pthread_exit tries
to perform unwinding that leads to dlopen'ing libgcc_s.so. dlopen
mallocs "libgcc_s.so" string which confuses LSan, it fails to
realize that this allocation happens in dynamic linker and should
be ignored.
Symbolized leak report is required to define a suppression for this
known problem.

Reviewers: eugenis

Subscribers: aemerson, rengolin, kubamracek, llvm-commits

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

Turn symbolization on for PPC and Thumb only to do not slow down other platforms.

llvm-svn: 300748

7 years ago[APInt] Use SignExtend64 instead of reinventing it. NFC
Craig Topper [Wed, 19 Apr 2017 20:32:11 +0000 (20:32 +0000)]
[APInt] Use SignExtend64 instead of reinventing it. NFC

llvm-svn: 300747

7 years ago[SCEV] Make SCEV or modeling more aggressive.
Eli Friedman [Wed, 19 Apr 2017 20:19:58 +0000 (20:19 +0000)]
[SCEV] Make SCEV or modeling more aggressive.

Use haveNoCommonBitsSet to figure out whether an "or" instruction
is equivalent to addition. This handles more cases than just
checking for a constant on the RHS.

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

llvm-svn: 300746

7 years ago[sanitizer-coverage] remove run-time support for the deprecated -fsanitize-coverage...
Kostya Serebryany [Wed, 19 Apr 2017 20:17:41 +0000 (20:17 +0000)]
[sanitizer-coverage] remove run-time support for the deprecated -fsanitize-coverage=8bit-counters

llvm-svn: 300745

7 years ago[sanitizer-coverage] deprecate -fsanitize-coverage=8bit-counters
Kostya Serebryany [Wed, 19 Apr 2017 20:15:58 +0000 (20:15 +0000)]
[sanitizer-coverage] deprecate -fsanitize-coverage=8bit-counters

llvm-svn: 300744

7 years ago[libc++] Use _LIBCPP_ABI_MICROSOFT instead of _MSC_VER
Shoaib Meenai [Wed, 19 Apr 2017 20:11:04 +0000 (20:11 +0000)]
[libc++] Use _LIBCPP_ABI_MICROSOFT instead of _MSC_VER

_LIBCPP_ABI_MICROSOFT is more appropriate to use here, since the
conditionals are controlling Microsoft mangling. It wasn't used
originally since it didn't exist at the time.

llvm-svn: 300743

7 years agoUsing address range map to speedup finding inline stack for address.
Dehao Chen [Wed, 19 Apr 2017 20:09:38 +0000 (20:09 +0000)]
Using address range map to speedup finding inline stack for address.

Summary:
In the current implementation, to find inline stack for an address incurs expensive linear search in 2 places:

* linear search for the top-level DIE
* recursive linear traverse the DIE tree to find the path to the leaf DIE

In this patch, a map is built from address to its corresponding leaf DIE. The inline stack is built by traversing from the leaf DIE up to the root DIE. This speeds up batch symbolization by ~10X without noticible memory overhead.

Reviewers: dblaikie

Reviewed By: dblaikie

Subscribers: llvm-commits

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

llvm-svn: 300742

7 years agoParse backend options during thinlto backend compile actions
David Blaikie [Wed, 19 Apr 2017 20:08:21 +0000 (20:08 +0000)]
Parse backend options during thinlto backend compile actions

llvm-svn: 300741

7 years agoUpdate the madd.ll test with utils/update_llc_test_checks.py (NFC)
Dehao Chen [Wed, 19 Apr 2017 20:08:14 +0000 (20:08 +0000)]
Update the madd.ll test with utils/update_llc_test_checks.py (NFC)

llvm-svn: 300740

7 years ago[sanitizer-coverage] deprecate some of the stale coverage variants
Kostya Serebryany [Wed, 19 Apr 2017 19:57:16 +0000 (19:57 +0000)]
[sanitizer-coverage] deprecate some of the stale coverage variants

llvm-svn: 300738

7 years agoPR32710: Disable using PMADDWD for unsigned short.
Dehao Chen [Wed, 19 Apr 2017 19:50:34 +0000 (19:50 +0000)]
PR32710: Disable using PMADDWD for unsigned short.

Summary: PMADDWD can only handle signed short.

Reviewers: mkuper, wmi

Reviewed By: mkuper

Subscribers: andreadb, llvm-commits

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

llvm-svn: 300737

7 years agoAMDGPU: Don't emit amd_kernel_code_t for callable functions
Matt Arsenault [Wed, 19 Apr 2017 19:38:10 +0000 (19:38 +0000)]
AMDGPU: Don't emit amd_kernel_code_t for callable functions

This is inserted directly in the text section. The relocation
for the function ends up resolving to the beginning of the
amd_kernel_code_t header rather than the actual function
entry point.

Also skip some of the comments for initialization
that only makes sense for kernels.

llvm-svn: 300736

7 years ago[tblgen] GCC/MS builtin to target intrisics map.
Aditya Nandakumar [Wed, 19 Apr 2017 19:14:20 +0000 (19:14 +0000)]
[tblgen] GCC/MS builtin to target intrisics map.

Patch by Ettore Speziale

Allow TableGen to generate static functions to perform GCC/MS builtin name to
target specific intrinsic ID mapping.

https://reviews.llvm.org/D31150

llvm-svn: 300735

7 years ago[AMDGPU][mc][tests][NFC] Update bulk ISA tests for Gfx7 and Gfx8
Artem Tamazov [Wed, 19 Apr 2017 19:12:06 +0000 (19:12 +0000)]
[AMDGPU][mc][tests][NFC] Update bulk ISA tests for Gfx7 and Gfx8

Added approx. 1100 gfx7 and 1040 gfx8 test cases.

llvm-svn: 300734

7 years agoAdd CopyDiagnostic to the DiagnosticManager.
Jim Ingham [Wed, 19 Apr 2017 18:56:44 +0000 (18:56 +0000)]
Add CopyDiagnostic to the DiagnosticManager.

From Gregor Milos (gmilos@apple.com), for:

https://reviews.llvm.org/D32078

llvm-svn: 300733

7 years agoStructurizeCFG: Directly invert cmp instructions
Matt Arsenault [Wed, 19 Apr 2017 18:29:07 +0000 (18:29 +0000)]
StructurizeCFG: Directly invert cmp instructions

The most common case for a branch condition is
a single use compare. Directly invert the branch
predicate rather than adding a lot of xor i1 true
which the DAG will have to fold later.

This produces nicer to read structurizer output.

This produces some random changes in codegen
due to the DAG swapping branch conditions itself,
and then does a poor job of dealing with those
inverts.

llvm-svn: 300732

7 years ago[GVN] Don't coerce non-integral pointers to integers or vice versa
Sanjoy Das [Wed, 19 Apr 2017 18:21:09 +0000 (18:21 +0000)]
[GVN] Don't coerce non-integral pointers to integers or vice versa

Summary:
See http://llvm.org/docs/LangRef.html#non-integral-pointer-type

The NewGVN test does not fail without these changes (perhaps it does
try to coerce pointers <-> integers to begin with?), but I added the
test case anyway.

Reviewers: dberlin

Subscribers: mcrosier, llvm-commits, Prazek

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

llvm-svn: 300730

7 years ago[Utility/StringLexer] Remove dead code.
Davide Italiano [Wed, 19 Apr 2017 18:18:25 +0000 (18:18 +0000)]
[Utility/StringLexer] Remove dead code.

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

llvm-svn: 300729

7 years agoUpdate comment to match r300252.
Richard Smith [Wed, 19 Apr 2017 18:17:51 +0000 (18:17 +0000)]
Update comment to match r300252.

llvm-svn: 300728

7 years agoTeach RenderScriptRuntime about changed context representation.
David Gross [Wed, 19 Apr 2017 18:14:21 +0000 (18:14 +0000)]
Teach RenderScriptRuntime about changed context representation.

Summary:
The runtime discovers contexts through RenderScriptRuntime::Capture*()
methods.  These methods see the low-level context representation.
However, the runtime calls APIs that require the high-level context
representation.  Therefore, it needs to call yet another API to find
the high-level representation associated with a given low-level
representation.

Subscribers: lldb-commits

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

llvm-svn: 300727

7 years agoARM: TLS calling convention doesn't preserve r9 or r12 on Darwin.
Tim Northover [Wed, 19 Apr 2017 18:07:54 +0000 (18:07 +0000)]
ARM: TLS calling convention doesn't preserve r9 or r12 on Darwin.

llvm-svn: 300726

7 years ago[DAG] add splat vector support for 'and' in SimplifyDemandedBits
Sanjay Patel [Wed, 19 Apr 2017 18:05:06 +0000 (18:05 +0000)]
[DAG] add splat vector support for 'and' in SimplifyDemandedBits

The patch itself is simple: stop discriminating against vectors in visitAnd() and again in
SimplifyDemandedBits().

Some notes for reference:

1. We're not consistent about calls to SimplifyDemandedBits in the various visitXXX functions.
   Sometimes, we check if the RHS is a constant first. Other times (like here), we just dive in.
2. I'd like to break the vector shackles in steps for the sake of risk minimization, but we could
    make similar simultaneous changes in other places if we think that would be better.
3. I don't know what the intent of the changed tests in this patch was supposed to be, but since
   they wiggled in a positive way, I'm just going with that. :)
4. In the rotate tests, note that we can see through non-splat constants. This is a result of D24253.
5. My motivation for being here now is to make D31944 look better, so this is step 1 of N towards
   improving the vector codegen in that patch without writing any actual new code.

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

llvm-svn: 300725

7 years agoIR: Remove some comments that are documenting the obvious. NFC.
Peter Collingbourne [Wed, 19 Apr 2017 18:00:05 +0000 (18:00 +0000)]
IR: Remove some comments that are documenting the obvious. NFC.

llvm-svn: 300724

7 years ago[Coverage] Don't emit mappings for functions in dependent contexts (fixes PR32679)
Vedant Kumar [Wed, 19 Apr 2017 17:58:30 +0000 (17:58 +0000)]
[Coverage] Don't emit mappings for functions in dependent contexts (fixes PR32679)

The coverage implementation marks functions which won't be emitted as
'deferred', so that it can emit empty coverage regions for them later
(once their linkages are known).

Functions in dependent contexts are an exception: if there isn't a full
instantiation of a function, it shouldn't be marked 'deferred'. We've
been breaking that rule without much consequence because we just ended
up with useless, extra, empty coverage mappings. With PR32679, this
behavior finally caused a crash, because clang marked a partial template
specialization as 'deferred', causing the MS mangler to choke in its
delayed-template-parsing mode:

  error: cannot mangle this template type parameter type yet
  (http://bugs.llvm.org/show_bug.cgi?id=32679)

Fix this by checking if a decl's context is a dependent context before
marking it 'deferred'.

Based on a patch by Adam Folwarczny!

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

llvm-svn: 300723

7 years ago[Sema][ObjC] Disallow jumping into ObjC fast enumeration loops.
Akira Hatanaka [Wed, 19 Apr 2017 17:54:08 +0000 (17:54 +0000)]
[Sema][ObjC] Disallow jumping into ObjC fast enumeration loops.

rdar://problem/31635406

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

llvm-svn: 300722

7 years ago[MathExtras] Fix undefined behavior (shift by bit width)
Benjamin Kramer [Wed, 19 Apr 2017 17:46:15 +0000 (17:46 +0000)]
[MathExtras] Fix undefined behavior (shift by bit width)

While there add some unit tests for uint64_t. Found by ubsan.

llvm-svn: 300721

7 years agoAMDGPU: Don't align callable functions to 256
Matt Arsenault [Wed, 19 Apr 2017 17:42:39 +0000 (17:42 +0000)]
AMDGPU: Don't align callable functions to 256

llvm-svn: 300720

7 years agoAMDGPU: Change DivergenceAnalysis for function arguments
Matt Arsenault [Wed, 19 Apr 2017 17:42:34 +0000 (17:42 +0000)]
AMDGPU: Change DivergenceAnalysis for function arguments

Stop assuming all functions are kernels.

llvm-svn: 300719

7 years agoPrefer addAttr(Attribute::AttrKind) over the AttributeList overload
Reid Kleckner [Wed, 19 Apr 2017 17:28:52 +0000 (17:28 +0000)]
Prefer addAttr(Attribute::AttrKind) over the AttributeList overload

This should simplify the call sites, which typically want to tweak one
attribute at a time. It should also avoid creating ephemeral
AttributeLists that live forever.

llvm-svn: 300718

7 years ago[InstCombine] Reduce visitLoadInst() code duplication. NFCI.
Davide Italiano [Wed, 19 Apr 2017 17:26:57 +0000 (17:26 +0000)]
[InstCombine] Reduce visitLoadInst() code duplication. NFCI.

llvm-svn: 300717

7 years agoSkip tests that use 'llvm_xray' for standalone builds.
Keith Wyss [Wed, 19 Apr 2017 17:20:47 +0000 (17:20 +0000)]
Skip tests that use 'llvm_xray' for standalone builds.

Summary:
Tests that generate output with compiler-rt and verify it with the llvm_xray
command (built from the llvm tree) are extremely convenient, but compiler-rt
can be built out of tree and llvm_xray is not built for every target.

This change intends to disable tests for out of tree builds, but does nothing
to detect whether llvm_xray can be found elsewhere on the path, is fresh enough,
or is part of a build target for the in tree build.

Tested:
  Tested that this didn't break check-xray. Haven't reproduced bots or standalone
  builds.

Reviewers: dberris, kcc

Subscribers: llvm-commits

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

llvm-svn: 300716

7 years ago[APInt] Move the 'return *this' from the slow cases of assignment operators inline...
Craig Topper [Wed, 19 Apr 2017 17:01:58 +0000 (17:01 +0000)]
[APInt] Move the 'return *this' from the slow cases of assignment operators inline. We should let the compiler see that the fast/slow cases both return *this.

I don't think we chain assignments together very often so this shouldn't matter much.

llvm-svn: 300715

7 years ago[InstSimplify] fold identity shuffles (recursing if needed)
Sanjay Patel [Wed, 19 Apr 2017 16:48:22 +0000 (16:48 +0000)]
[InstSimplify] fold identity shuffles (recursing if needed)

This patch simplifies the examples from D31509 and D31927 (PR30630) and catches
the basic identity shuffle tests that Zvi recently added.

I'm not sure if we have something like this in DAGCombiner, but we should?

It's worth noting that "MaxRecurse / RecursionLimit" is only 3 on entry at the moment.
We might want to bump that up if there are longer shuffle chains like this in the wild.

For now, we're ignoring shuffles that have undef mask elements because it's not
clear how those should be handled.

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

llvm-svn: 300714

7 years agouse 'auto' with 'dyn_cast' and fix formatting; NFC
Sanjay Patel [Wed, 19 Apr 2017 16:22:19 +0000 (16:22 +0000)]
use 'auto' with 'dyn_cast' and fix formatting; NFC

llvm-svn: 300713

7 years agoAdd #pragma clang attribute support to the external_source_symbol attribute
Alex Lorenz [Wed, 19 Apr 2017 15:52:11 +0000 (15:52 +0000)]
Add #pragma clang attribute support to the external_source_symbol attribute

Prior to this commit the external_source_symbol attribute wasn't supported by
#pragma clang attribute for the following two reasons:

- The Named attribute subject hasn't been supported by TableGen.
- There was no way to specify a subject match rule for #pragma clang attribute
 that could operate on a set of attribute subjects (e.g. the ones that derive
 from NamedDecl).

This commit fixes the two issues and thus adds external_source_symbol support to
#pragma clang attribute.

rdar://31169028

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

llvm-svn: 300712

7 years agoAdd an #include for <climits> for CHAR_BIT.
Zachary Turner [Wed, 19 Apr 2017 15:50:43 +0000 (15:50 +0000)]
Add an #include for <climits> for CHAR_BIT.

llvm-svn: 300711

7 years ago[Support] Add some helpers to generate bitmasks.
Zachary Turner [Wed, 19 Apr 2017 15:45:31 +0000 (15:45 +0000)]
[Support] Add some helpers to generate bitmasks.

Frequently you you want a bitmask consisting of a specified
number of 1s, either at the beginning or end of a word.

The naive way to do this is to write

template<typename T>
T leadingBitMask(unsigned N) {
  return (T(1) << N) - 1;
}

but using this function you cannot produce a word with every
bit set to 1 (i.e. leadingBitMask<uint8_t>(8)) because left
shift is undefined when N is greater than or equal to the
number of bits in the word.

This patch provides an efficient, branch-free implementation
that works for all values of N in [0, CHAR_BIT*sizeof(T)]

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

llvm-svn: 300710

7 years agoRemove eol-style:native from MathExtras.h
Zachary Turner [Wed, 19 Apr 2017 15:43:23 +0000 (15:43 +0000)]
Remove eol-style:native from MathExtras.h

llvm-svn: 300709

7 years agoRevert r300697 which causes buildbot failure.
Dehao Chen [Wed, 19 Apr 2017 15:28:58 +0000 (15:28 +0000)]
Revert r300697 which causes buildbot failure.

llvm-svn: 300708

7 years ago[Hexagon] Generate proper offset in opt-addr-mode
Krzysztof Parzyszek [Wed, 19 Apr 2017 15:15:51 +0000 (15:15 +0000)]
[Hexagon] Generate proper offset in opt-addr-mode

Also, make a few changes to allow using the pass in .mir testcases.
Among other things, change the abbreviation from opt-amode to amode-opt,
because otherwise lit would expand the "opt" part to the full path to
the opt binary.

llvm-svn: 300707

7 years ago[Hexagon] Remove RDefMap, use Liveness:getNearestAliasedRef instead
Krzysztof Parzyszek [Wed, 19 Apr 2017 15:14:30 +0000 (15:14 +0000)]
[Hexagon] Remove RDefMap, use Liveness:getNearestAliasedRef instead

llvm-svn: 300706

7 years ago[RDF] Switch NodeList to SmallVector from std::vector
Krzysztof Parzyszek [Wed, 19 Apr 2017 15:12:44 +0000 (15:12 +0000)]
[RDF] Switch NodeList to SmallVector from std::vector

The list has a single element 75+% of the time, reservation of 4 elements
is sufficient in 95% of cases.

llvm-svn: 300705

7 years ago[RDF] Use faster version of findBlock
Krzysztof Parzyszek [Wed, 19 Apr 2017 15:11:23 +0000 (15:11 +0000)]
[RDF] Use faster version of findBlock

llvm-svn: 300704

7 years agoRemove unnecessary condition as suggested by clang-tidy. NFC
Gabor Horvath [Wed, 19 Apr 2017 15:11:10 +0000 (15:11 +0000)]
Remove unnecessary condition as suggested by clang-tidy. NFC

Patch by: Gergely Angeli!

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

llvm-svn: 300703

7 years ago[RDF] Cache register units for reg masks instead of recalculating them
Krzysztof Parzyszek [Wed, 19 Apr 2017 15:10:09 +0000 (15:10 +0000)]
[RDF] Cache register units for reg masks instead of recalculating them

llvm-svn: 300702

7 years ago[Hexagon] Cache reached blocks in bit tracker instead of scanning list
Krzysztof Parzyszek [Wed, 19 Apr 2017 15:08:31 +0000 (15:08 +0000)]
[Hexagon] Cache reached blocks in bit tracker instead of scanning list

llvm-svn: 300701

7 years ago[PowerPC] add test and auto-generate checks; NFC
Sanjay Patel [Wed, 19 Apr 2017 14:58:09 +0000 (14:58 +0000)]
[PowerPC] add test and auto-generate checks; NFC

llvm-svn: 300700

7 years ago[clang-tidy] misc-misplaced-widening-cast: Disable checking of implicit widening...
Gabor Horvath [Wed, 19 Apr 2017 14:55:58 +0000 (14:55 +0000)]
[clang-tidy] misc-misplaced-widening-cast: Disable checking of implicit widening casts by default.

Patch by Ádám Balogh!

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

llvm-svn: 300699

7 years ago[ARM] add test and auto-generate checks; NFC
Sanjay Patel [Wed, 19 Apr 2017 14:55:50 +0000 (14:55 +0000)]
[ARM] add test and auto-generate checks; NFC

llvm-svn: 300698

7 years agoUsing address range map to speedup finding inline stack for address.
Dehao Chen [Wed, 19 Apr 2017 14:50:57 +0000 (14:50 +0000)]
Using address range map to speedup finding inline stack for address.

Summary:
In the current implementation, to find inline stack for an address incurs expensive linear search in 2 places:

* linear search for the top-level DIE
* recursive linear traverse the DIE tree to find the path to the leaf DIE

In this patch, a map is built from address to its corresponding leaf DIE. The inline stack is built by traversing from the leaf DIE up to the root DIE. This speeds up batch symbolization by ~10X without noticible memory overhead.

Reviewers: dblaikie

Reviewed By: dblaikie

Subscribers: llvm-commits

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

llvm-svn: 300697

7 years ago[InstSimplify] Deduce correct type for vector GEP.
Davide Italiano [Wed, 19 Apr 2017 14:23:42 +0000 (14:23 +0000)]
[InstSimplify] Deduce correct type for vector GEP.

InstSimplify returned the wrong type when simplifying a vector GEP
and we ended up crashing when trying to replace all uses with the
new value. Fixes PR32697.

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

llvm-svn: 300693

7 years agoLet ubsan search UBSAN_SYMBOLIZER_PATH for llvm-symbolizer
Nico Weber [Wed, 19 Apr 2017 14:03:40 +0000 (14:03 +0000)]
Let ubsan search UBSAN_SYMBOLIZER_PATH for llvm-symbolizer

https://reviews.llvm.org/D27375

llvm-svn: 300692

7 years agoImplement function to get registers from suspended thread on darwin
Francis Ricci [Wed, 19 Apr 2017 14:00:42 +0000 (14:00 +0000)]
Implement function to get registers from suspended thread on darwin

Reviewers: kubamracek, alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 300691

7 years agoMove valid caller-pc checks out of platform-specific checks
Francis Ricci [Wed, 19 Apr 2017 14:00:35 +0000 (14:00 +0000)]
Move valid caller-pc checks out of platform-specific checks

Summary:
ProcessPlatformSpecificAllocations for linux leak sanitizer iterated over
memory chunks and ran two checks concurrently:
1) Ensured the pc was valid
2) Checked whether it was a linker allocation

All platforms will need the valid pc check, so it is moved out of the platform-
specific file. To prevent code and logic duplication, the linker allocation
check is moved as well, with the name of the linker supplied by the platform-specific
module. In cases where we don't need to check for linker allocations (ie Darwin),
this name will be a nullptr, and we'll only run the caller pc checks.

Reviewers: kubamracek, alekseyshl, kcc

Subscribers: llvm-commits

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

llvm-svn: 300690

7 years ago[Driver] Unify linking of OpenMP runtime. NFCI.
Jonas Hahnfeld [Wed, 19 Apr 2017 13:55:39 +0000 (13:55 +0000)]
[Driver] Unify linking of OpenMP runtime. NFCI.

While at it, extend test for FreeBSD and check for -lrt iff on Linux.

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

llvm-svn: 300689

7 years ago[DAG] Loop over remaining candidates on successful merge of stores of
Nirav Dave [Wed, 19 Apr 2017 13:52:38 +0000 (13:52 +0000)]
[DAG] Loop over remaining candidates on successful merge of stores of
extracted vectors types. NFCI.

llvm-svn: 300688

7 years ago[ELF] Always use Script::assignAddresses()
Peter Smith [Wed, 19 Apr 2017 12:46:32 +0000 (12:46 +0000)]
[ELF] Always use Script::assignAddresses()

This change fabricates linker script commands for the case where there is
no linker script SECTIONS to control address assignment. This permits us
to have a single Script->assignAddresses() function.

There is a small change in user-visible-behavior with respect to the
handling of .tbss SHT_NOBITS, SHF_TLS as the Script->assignAddresses()
requires setDot() to be called with monotically increasing addresses.
The tls-offset.s test has been updated so that the script and non-script
results match.

This change should make the non-script behavior of lld closer to an
equivalent linker script.

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

llvm-svn: 300687

7 years agoAvoid assert when a non-static member function is qualified with __unaligned
Roger Ferrer Ibanez [Wed, 19 Apr 2017 12:23:28 +0000 (12:23 +0000)]
Avoid assert when a non-static member function is qualified with __unaligned

Under -fms-extensions __unaligned is a type-qualifier that can be applied to a
non-static member function declaration.

This causes an assertion when mangling the name under Itanium, where that
qualifier is not mangled.

This patch justs makes the minimal change to avoid the crash and avoid mangling
__unaligned, as it currently happens with non-member functions.

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

llvm-svn: 300686

7 years agoWrite multiple REQUIRES in one line.
Rui Ueyama [Wed, 19 Apr 2017 12:21:46 +0000 (12:21 +0000)]
Write multiple REQUIRES in one line.

llvm-svn: 300685

7 years ago[AVR] Remove the 'multibyte' asm test
Dylan McKay [Wed, 19 Apr 2017 12:13:45 +0000 (12:13 +0000)]
[AVR] Remove the 'multibyte' asm test

It tests registers which are not actually used on AVR.

llvm-svn: 300684

7 years agoRegenerate test. NFCI.
Simon Pilgrim [Wed, 19 Apr 2017 12:06:40 +0000 (12:06 +0000)]
Regenerate test. NFCI.

llvm-svn: 300683

7 years ago[AVR] Fix the test suite
Dylan McKay [Wed, 19 Apr 2017 12:02:52 +0000 (12:02 +0000)]
[AVR] Fix the test suite

A bunch of tests failed because memory operations have been reordered.

I am unsure which commit changed this behaviour as the AVR build was
failing at that point with an unrelated error.

This commit just reoders some of the CHECK lines in some tests to suit
current llc output.

llvm-svn: 300682