platform/upstream/llvm.git
7 years ago[XRay] [compiler-rt] - Fix standalone and non-deterministic test issue
Keith Wyss [Thu, 20 Apr 2017 05:59:26 +0000 (05:59 +0000)]
[XRay] [compiler-rt] - Fix standalone and non-deterministic test issue

Summary:
The thread order test fails sometimes my machine independently of standalone
build.

From testing both standalone and in-tree build, I see I configured it wrong.

The other hypothesis for an issue is that cold starts can interfere with whether
record unwriting happens. Once this happens more than once, we can naively
FileCheck on the wrong test output, which compounds the issue.

While "rm blah.* || true" will print to stderr if the glob can't expand, this is
mostly harmless and makes sure earlier failing tests don't sabotage us.

Example failure:

---
header:
  version:         1
  type:            1
  constant-tsc:    true
  nonstop-tsc:     true
  cycle-frequency: 3800000000
records:
  - { type: 0, func-id: 1, function: 'f1()', cpu: 9, thread: 21377, kind: function-enter, tsc: 2413745203147228 }
  - { type: 0, func-id: 1, function: 'f1()', cpu: 9, thread: 21377, kind: function-exit, tsc: 2413745203304238 }
...

The CMAKE related change fixes the expectation that COMPILER_RT_STANDALONE_BUILD will be explicitly FALSE instead
of empty string when it is not "TRUE".

Reviewers: dberris

Subscribers: llvm-commits

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

llvm-svn: 300822

7 years ago[SelectionDAG] Fix another place that was passing a large value to APInt::lshrInPlace.
Craig Topper [Thu, 20 Apr 2017 04:55:01 +0000 (04:55 +0000)]
[SelectionDAG] Fix another place that was passing a large value to APInt::lshrInPlace.

llvm-svn: 300821

7 years agoDisable the filesystem library on Windows by default
Eric Fiselier [Thu, 20 Apr 2017 04:24:29 +0000 (04:24 +0000)]
Disable the filesystem library on Windows by default

llvm-svn: 300820

7 years ago[SelectionDAG] Use getActiveBits() and countTrailingZeros() to avoid creating tempora...
Craig Topper [Thu, 20 Apr 2017 04:23:43 +0000 (04:23 +0000)]
[SelectionDAG] Use getActiveBits() and countTrailingZeros() to avoid creating temporary APInts with lshr and trunc. NFCI

llvm-svn: 300819

7 years ago[AVR] Add -mmcu option to the driver
Leslie Zhai [Thu, 20 Apr 2017 04:23:24 +0000 (04:23 +0000)]
[AVR] Add -mmcu option to the driver

A patch by Peter Wu!

Reviewers: jroelofs, xiangzhai

Reviewed By: jroelofs, dylanmckay, xiangzhai

Subscribers: dlj, dylanmckay, cfe-commits

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

llvm-svn: 300818

7 years agoRename the static version of libc++ on Windows.
Eric Fiselier [Thu, 20 Apr 2017 04:19:02 +0000 (04:19 +0000)]
Rename the static version of libc++ on Windows.

Previously both the static version of libc++ and the
import library for the DLL had the same name, 'c++.lib'.

This patch renames the static library on Windows to be `libc++.lib`
so it no longer conflicts. This naming convention is consistent with
other windows libraries.

llvm-svn: 300817

7 years agoRecommit "[APInt] Add back the asserts that check that the APInt shift methods aren...
Craig Topper [Thu, 20 Apr 2017 03:49:18 +0000 (03:49 +0000)]
Recommit "[APInt] Add back the asserts that check that the APInt shift methods aren't called with values larger than BitWidth."

This includes a fix to clamp a right shift of larger than BitWidth in DAG combining.

llvm-svn: 300816

7 years ago[XRay][compiler-rt] Cleanup CFI/CFA annotations on trampolines
Dean Michael Berris [Thu, 20 Apr 2017 03:26:04 +0000 (03:26 +0000)]
[XRay][compiler-rt] Cleanup CFI/CFA annotations on trampolines

Summary:
This is a follow-up to D32202.

While the previous change (D32202) did fix the stack alignment issue, we
were still at a weird state in terms of the CFI/CFA directives (as the
offsets were wrong). This change cleans up the SAVE/RESTORE macros for
the trampoline, accounting the stack pointer adjustments with less
instructions and with some clearer math. We note that the offsets will
be different on the exit trampolines, because we don't typically 'call'
into this trampoline and we only ever jump into them (i.e. treated as a
tail call that's patched in at runtime).

Reviewers: eugenis, kpw, pelikan

Subscribers: llvm-commits

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

llvm-svn: 300815

7 years ago[ODRHash] clean up test and add new examples. NFC
Richard Trieu [Thu, 20 Apr 2017 02:53:53 +0000 (02:53 +0000)]
[ODRHash] clean up test and add new examples.  NFC

Use a macro to generate the struct with all decls.  Previously, four identical
changes would be needed to update this test.  This macro reduces that to one
location.  Added two other tests for issues that triggered false positives
during testing.

llvm-svn: 300814

7 years agoRevert r300811 "[APInt] Add back the asserts that check that the APInt shift methods...
Craig Topper [Thu, 20 Apr 2017 02:46:21 +0000 (02:46 +0000)]
Revert r300811 "[APInt] Add back the asserts that check that the APInt shift methods aren't called with values larger than BitWidth."

This is failing a self host debug build.

llvm-svn: 300813

7 years ago[APInt] Implement APInt::intersects without creating a temporary APInt in the multiwo...
Craig Topper [Thu, 20 Apr 2017 02:11:27 +0000 (02:11 +0000)]
[APInt] Implement APInt::intersects without creating a temporary APInt in the multiword case

Summary: This is a simple question we should be able to answer without creating a temporary to hold the AND result. We can also get an early out as soon as we find a word that intersects.

Reviewers: RKSimon, hans, spatel, davide

Reviewed By: hans, davide

Subscribers: llvm-commits

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

llvm-svn: 300812

7 years ago[APInt] Add back the asserts that check that the APInt shift methods aren't called...
Craig Topper [Thu, 20 Apr 2017 02:03:09 +0000 (02:03 +0000)]
[APInt] Add back the asserts that check that the APInt shift methods aren't called with values larger than BitWidth.

The underlying tcShiftRight/tcShiftLeft functions support the larger bit widths but the APInt interface shouldn't rely on that.

llvm-svn: 300811

7 years agoAdd extra logging for when lldb is looking for kernels and kexts.
Jason Molenda [Thu, 20 Apr 2017 02:02:25 +0000 (02:02 +0000)]
Add extra logging for when lldb is looking for kernels and kexts.
<rdar://problem/26863256>

llvm-svn: 300810

7 years agoMake linker errors verbose on Windows
Eric Fiselier [Thu, 20 Apr 2017 01:50:39 +0000 (01:50 +0000)]
Make linker errors verbose on Windows

llvm-svn: 300809

7 years agoFix dllimport on a class template
Eric Fiselier [Thu, 20 Apr 2017 01:45:15 +0000 (01:45 +0000)]
Fix dllimport on a class template

llvm-svn: 300808

7 years agoDo not run frame verification if target does not use frame instructions
Serge Pavlov [Thu, 20 Apr 2017 01:34:04 +0000 (01:34 +0000)]
Do not run frame verification if target does not use frame instructions

llvm-svn: 300807

7 years agoPR32673: Don't wrap parameter packs in SubstTemplateTypeParmPackType nodes when formi...
Richard Smith [Thu, 20 Apr 2017 01:15:31 +0000 (01:15 +0000)]
PR32673: Don't wrap parameter packs in SubstTemplateTypeParmPackType nodes when forming implicit deduction guides.

Doing so thwarts template type deduction. Instead, substitute the pack directly
by picking "slice 0" of the resulting expansion.

llvm-svn: 300805

7 years ago[Sema] Use MSVC inner class behavior on Itanium
Shoaib Meenai [Thu, 20 Apr 2017 01:11:42 +0000 (01:11 +0000)]
[Sema] Use MSVC inner class behavior on Itanium

Windows Itanium aims to use MSVC export and import semantics. Inner
class members shouldn't be exported on a dllexport explicit
instantiation definition of the outer class, and they shouldn't be
imported on a dllimport explicit instantiation declaration of the outer
class (instead a local copy should be emitted). We were doing the first
but not the second, and this mismatch can lead to link errors. Fix the
behavior and add tests for both.

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

llvm-svn: 300804

7 years agoAdd a triple to codegen test.
Richard Smith [Thu, 20 Apr 2017 01:02:29 +0000 (01:02 +0000)]
Add a triple to codegen test.

llvm-svn: 300803

7 years ago[OpenMP] Prepare sema to support combined constructs with omp distribute and omp for
Carlo Bertolli [Thu, 20 Apr 2017 00:39:39 +0000 (00:39 +0000)]
[OpenMP] Prepare sema to support combined constructs with omp distribute and omp for

https://reviews.llvm.org/D32237

This patch prepares sema with additional fields to support all those composite and combined constructs of OpenMP that include pragma 'distribute' and 'for', such as 'distribute parallel for'. It also extends the regression tests for 'distribute parallel for' and adds a new one.

llvm-svn: 300802

7 years agoRevert "[libFuzzer] XFAIL fuzzer-oom.test on Darwin."
Ahmed Bougacha [Thu, 20 Apr 2017 00:16:13 +0000 (00:16 +0000)]
Revert "[libFuzzer] XFAIL fuzzer-oom.test on Darwin."

This reverts commit r300127.

r300759 implemented StopTheWorld for Darwin, so the test passes again.

llvm-svn: 300801

7 years ago[libFuzzer] extend help for -minimize_crash to cover ASAN_OPTIONS=dedup_token_length=3
Kostya Serebryany [Wed, 19 Apr 2017 23:58:05 +0000 (23:58 +0000)]
[libFuzzer] extend help for -minimize_crash to cover ASAN_OPTIONS=dedup_token_length=3

llvm-svn: 300800

7 years ago[APInt] Implement operator==(uint64_t) similar to ugt/ult(uint64_t) to remove one...
Craig Topper [Wed, 19 Apr 2017 23:57:51 +0000 (23:57 +0000)]
[APInt] Implement operator==(uint64_t) similar to ugt/ult(uint64_t) to remove one of the out of line EqualsSlowCase methods.

llvm-svn: 300799

7 years ago[APInt] Don't call getActiveBits() in ult/ugt(uint64_t) if its a single word.
Craig Topper [Wed, 19 Apr 2017 23:55:48 +0000 (23:55 +0000)]
[APInt] Don't call getActiveBits() in ult/ugt(uint64_t) if its a single word.

The compiled code already needs to check single/multi word for the countLeadingZeros call inside of getActiveBits, but it isn't able to optimize out the leadingZeros call in the single word case that can't produce a value larger than 64.

This shrank the opt binary by about 5-6k on my local x86-64 build.

llvm-svn: 300798

7 years agoStatepoint Docs: fix incorrect uses of it's
Sanjoy Das [Wed, 19 Apr 2017 23:55:03 +0000 (23:55 +0000)]
Statepoint Docs: fix incorrect uses of it's

llvm-svn: 300797

7 years ago[APInt] Use ugt(uint64_t) for the compare in getLimitedValue(uint64_t) since the...
Craig Topper [Wed, 19 Apr 2017 23:52:59 +0000 (23:52 +0000)]
[APInt] Use ugt(uint64_t) for the compare in getLimitedValue(uint64_t) since the code is identical to it. NFC

llvm-svn: 300796

7 years ago[DAE] Simplify attribute list creation, NFC
Reid Kleckner [Wed, 19 Apr 2017 23:45:45 +0000 (23:45 +0000)]
[DAE] Simplify attribute list creation, NFC

Removes a use of getSlotAttributes, which I intend to change.

llvm-svn: 300795

7 years agoRevert r300789: There are Windows bot failures.
Kuba Mracek [Wed, 19 Apr 2017 23:44:33 +0000 (23:44 +0000)]
Revert r300789: There are Windows bot failures.

llvm-svn: 300794

7 years agoFix bug that caused DwarfExpression to drop DW_OP_deref from FI locations
Adrian Prantl [Wed, 19 Apr 2017 23:42:25 +0000 (23:42 +0000)]
Fix bug that caused DwarfExpression to drop DW_OP_deref from FI locations
- introduced in r300522 and found via the Swift LLDB testsuite.

The fix is to set the location kind to memory whenever an FrameIndex
location is emitted.

rdar://problem/31707602

llvm-svn: 300793

7 years agoRevert "Fix bug that caused DwarfExpression to drop DW_OP_deref from FI locations"
Adrian Prantl [Wed, 19 Apr 2017 23:42:17 +0000 (23:42 +0000)]
Revert "Fix bug that caused DwarfExpression to drop DW_OP_deref from FI locations"

This reverts commit r300790.

llvm-svn: 300792

7 years agoRevert earlier change. ds permute operations affect lgkm counter.
Kannan Narayanan [Wed, 19 Apr 2017 23:39:19 +0000 (23:39 +0000)]
Revert earlier change. ds permute operations affect lgkm counter.

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

llvm-svn: 300791

7 years agoFix bug that caused DwarfExpression to drop DW_OP_deref from FI locations
Adrian Prantl [Wed, 19 Apr 2017 23:34:14 +0000 (23:34 +0000)]
Fix bug that caused DwarfExpression to drop DW_OP_deref from FI locations
- introduced in r300522 and found via the Swift LLDB testsuite.

The fix is to set the location kind to memory whenever an FrameIndex
location is emitted.

rdar://problem/31707602

llvm-svn: 300790

7 years ago[libFuzzer] Always build libFuzzer
Kuba Mracek [Wed, 19 Apr 2017 23:34:08 +0000 (23:34 +0000)]
[libFuzzer] Always build libFuzzer

There are two reasons why users might want to build libfuzzer:
- To fuzz LLVM itself
- To get the libFuzzer.a archive file, so that they can attach it to their code
This change always builds libfuzzer, and supports the second use case if the specified flag is set.

The point of this patch is to have something that can potentially be shipped with the compiler, and this also ensures that the version of libFuzzer is correct to use with that compiler.

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

llvm-svn: 300789

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