platform/upstream/llvm.git
7 years ago[asan] Add strndup/__strndup interceptors if targeting linux.
Pierre Gousseau [Tue, 2 May 2017 09:01:02 +0000 (09:01 +0000)]
[asan] Add strndup/__strndup interceptors if targeting linux.

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

llvm-svn: 301904

7 years agoRemove unused code related to CPlusPlusLanguage::FindEquivalentNames
Pavel Labath [Tue, 2 May 2017 09:00:52 +0000 (09:00 +0000)]
Remove unused code related to CPlusPlusLanguage::FindEquivalentNames

Summary: It is simply unused, and the header for it is private, so there should be no external dependencies.

Reviewers: #lldb, zturner

Reviewed By: zturner

Subscribers: zturner, tberghammer, jingham, lldb-commits

Differential Revision: https://reviews.llvm.org/D32503
Patch by Scott Smith <scott.smith@purestorage.com>.

llvm-svn: 301903

7 years ago[libclang] Revert rL301328 and add tests for the regressions introduced.
Emilio Cobos Alvarez [Tue, 2 May 2017 08:32:15 +0000 (08:32 +0000)]
[libclang] Revert rL301328 and add tests for the regressions introduced.

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

llvm-svn: 301902

7 years ago[APInt] Move APInt::getSplat out of line.
Craig Topper [Tue, 2 May 2017 06:32:27 +0000 (06:32 +0000)]
[APInt] Move APInt::getSplat out of line.

I think this method is probably too complex to be inlined.

llvm-svn: 301901

7 years ago[APInt] Move the setBit and clearBit methods inline.
Craig Topper [Tue, 2 May 2017 05:49:40 +0000 (05:49 +0000)]
[APInt] Move the setBit and clearBit methods inline.

This makes setBit/clearBit more consistent with setBits which is already inlined.

llvm-svn: 301900

7 years agoRefactor callsite cost computation into a helper function /NFC
Xinliang David Li [Tue, 2 May 2017 05:38:41 +0000 (05:38 +0000)]
Refactor callsite cost computation into a helper function /NFC

Makes code more readable. The function will also be used
by the partial inlining's cost analysis.

llvm-svn: 301899

7 years agoclang/test/Modules/diag-flags.cpp: Appease targeting *-win32 with explicit triple...
NAKAMURA Takumi [Tue, 2 May 2017 05:12:55 +0000 (05:12 +0000)]
clang/test/Modules/diag-flags.cpp: Appease targeting *-win32 with explicit triple. Fixes r301846.

MicrosoftRecordLayoutBuilder doesn't have ability of -Wpadded.

FIXME: Would other diag be available here?
llvm-svn: 301898

7 years agoELF: Set symbol binding to STB_GLOBAL when undefining symbols during LTO.
Peter Collingbourne [Tue, 2 May 2017 05:07:41 +0000 (05:07 +0000)]
ELF: Set symbol binding to STB_GLOBAL when undefining symbols during LTO.

If there is a bug in the LTO implementation that causes it to fail to provide
an expected symbol definition, the linker should report an undefined symbol
error. Unfortunately, we were failing to do so if the symbol definition
was weak, as the undefine() function was turning the definition into a weak
undefined symbol, which resolves to zero if the symbol remains undefined. This
patch causes us to set the binding to STB_GLOBAL when we undefine a symbol.

I can't see a good way to test this. The behaviour should only be observable
if there is a bug in the LTO implementation.

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

llvm-svn: 301897

7 years agoUpdate commetns.
Rui Ueyama [Tue, 2 May 2017 02:58:04 +0000 (02:58 +0000)]
Update commetns.

llvm-svn: 301896

7 years agoMake getArchiveMembers function a non-member function.
Rui Ueyama [Tue, 2 May 2017 02:57:45 +0000 (02:57 +0000)]
Make getArchiveMembers function a non-member function.

It didn't have to be a member function of Driver. This patch makes
that function a file-scoped non-member function.

llvm-svn: 301895

7 years ago[PartialInlining] Hook up inline cost analysis
Xinliang David Li [Tue, 2 May 2017 02:44:14 +0000 (02:44 +0000)]
[PartialInlining] Hook up inline cost analysis

Differential Revision: http://reviews.llvm.org/D32666

llvm-svn: 301894

7 years ago[AVR] Save/restore the frame pointer for all functions
Dylan McKay [Tue, 2 May 2017 01:57:48 +0000 (01:57 +0000)]
[AVR] Save/restore the frame pointer for all functions

A recent commit I made made it so that we only did this for signal or
interrupt handlers. This broke normal functions.

llvm-svn: 301893

7 years ago[PowerPC] Emit VMX loads/stores for aligned ops to avoid adding swaps on LE
Nemanja Ivanovic [Tue, 2 May 2017 01:47:34 +0000 (01:47 +0000)]
[PowerPC] Emit VMX loads/stores for aligned ops to avoid adding swaps on LE

Fixes PR30730.
This is a re-commit of a pulled commit. The commit was pulled because some
software projects contained uses of Altivec vectors that violated alignment
requirements. Known issues have now been fixed.

Committing on behalf of Lei Huang.

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

llvm-svn: 301892

7 years agoRevert r301785 (and r301787) because they caused PR32864.
Nick Lewycky [Tue, 2 May 2017 01:06:16 +0000 (01:06 +0000)]
Revert r301785 (and r301787) because they caused PR32864.

The fix is that ExprEvaluatorBase::VisitInitListExpr should handle transparent exprs instead of exprs with one element. Fixing that uncovers one testcase failure because the AST for "constexpr _Complex float test2 = {1};" is wrong (the _Complex prvalue should not be const-qualified), and a number of test failures in test/OpenMP where the captured stmt contains an InitListExpr that is in syntactic form.

llvm-svn: 301891

7 years ago[AArch64] armv8-A doesn't have LSE.
Ahmed Bougacha [Tue, 2 May 2017 00:45:01 +0000 (00:45 +0000)]
[AArch64] armv8-A doesn't have LSE.

r288279 mistakenly added it to all arches, but it's only available
from v8.1 onwards.

The testcase is awkward, because (I suspect) of PR32873.

Spotted by inspection.

llvm-svn: 301890

7 years ago[sanitizer-coverage] add a deprecation note for the old sanitizer-coverage; remove...
Kostya Serebryany [Tue, 2 May 2017 00:44:24 +0000 (00:44 +0000)]
[sanitizer-coverage] add a deprecation note for the old sanitizer-coverage; remove a TODO printf

llvm-svn: 301889

7 years ago[sanitizer-coverage] update the SanitizerCoverage docs to reflect the current state
Kostya Serebryany [Tue, 2 May 2017 00:32:57 +0000 (00:32 +0000)]
[sanitizer-coverage] update the SanitizerCoverage docs to reflect the current state

llvm-svn: 301888

7 years ago[AVR] Fix a bug where the frame pointer is clobbered
Dylan McKay [Tue, 2 May 2017 00:11:34 +0000 (00:11 +0000)]
[AVR] Fix a bug where the frame pointer is clobbered

Because it was a callee-saved register, we automatically generated code
to spill and unspill its original value so that it is restored after the
function returns.

The problem is that this code was being generated before the epilogue.
The epilogue itself uses the Y register, which could be prematurely
restored by the CSR restoration process.

This removes R29R28 from the CSR list and changes the prologue/epilogue
code to handle it explicitly.

llvm-svn: 301887

7 years agoRevert r301880
George Burgess IV [Mon, 1 May 2017 23:54:41 +0000 (23:54 +0000)]
Revert r301880

This change caused buildbot failures, apparently because we're not
passing around types that InstSimplify is used to seeing. I'm not overly
familiar with InstSimplify, so I'm reverting this until I can figure out
what exactly is wrong.

llvm-svn: 301885

7 years agoStylistic makeover of DWARFDebugLine before working on it. NFC
Paul Robinson [Mon, 1 May 2017 23:27:55 +0000 (23:27 +0000)]
Stylistic makeover of DWARFDebugLine before working on it. NFC

Rename parameters and locals to CamelCase, doxygenize the header, and
run clang-format on the whole thing.

llvm-svn: 301883

7 years ago[CodeView] Write CodeView line information.
Zachary Turner [Mon, 1 May 2017 23:27:42 +0000 (23:27 +0000)]
[CodeView] Write CodeView line information.

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

llvm-svn: 301882

7 years ago[AVR] Enable the frame pointer for all functions
Dylan McKay [Mon, 1 May 2017 23:16:59 +0000 (23:16 +0000)]
[AVR] Enable the frame pointer for all functions

This is a temporary measure while we figure out a way to get the frame
pointer working correctly.

llvm-svn: 301881

7 years ago[InstSimplify] Handle selects of GEPs with 0 offset
George Burgess IV [Mon, 1 May 2017 23:12:08 +0000 (23:12 +0000)]
[InstSimplify] Handle selects of GEPs with 0 offset

In particular (since it wouldn't fit nicely in the summary):
(select (icmp eq V 0) P (getelementptr P V)) -> (getelementptr P V)

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

llvm-svn: 301880

7 years ago[X86] Reduce code for setting operations actions by merging into loops across multipl...
Simon Pilgrim [Mon, 1 May 2017 23:09:01 +0000 (23:09 +0000)]
[X86] Reduce code for setting operations actions by merging into loops across multiple types/ops. NFCI.

llvm-svn: 301879

7 years agoEmpty Space. NFC
Xin Tong [Mon, 1 May 2017 23:08:19 +0000 (23:08 +0000)]
Empty Space. NFC

llvm-svn: 301878

7 years ago[IR] Garbage collect unused variants. NFCI.
Davide Italiano [Mon, 1 May 2017 23:04:33 +0000 (23:04 +0000)]
[IR] Garbage collect unused variants. NFCI.

llvm-svn: 301877

7 years agoFix a pessimising move warning.
Peter Collingbourne [Mon, 1 May 2017 22:48:10 +0000 (22:48 +0000)]
Fix a pessimising move warning.

llvm-svn: 301852

7 years agoMachineFrameInfo: Track whether MaxCallFrameSize is computed yet; NFC
Matthias Braun [Mon, 1 May 2017 22:32:25 +0000 (22:32 +0000)]
MachineFrameInfo: Track whether MaxCallFrameSize is computed yet; NFC

This tracks whether MaxCallFrameSize is computed yet. Ideally we would
assert and fail when the value is queried before it is computed, however
this fails various targets that need to be fixed first.

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

llvm-svn: 301851

7 years agollvm-link: Add BitReader to deps corresponding to r301832.
NAKAMURA Takumi [Mon, 1 May 2017 22:31:43 +0000 (22:31 +0000)]
llvm-link: Add BitReader to deps corresponding to r301832.

llvm-svn: 301850

7 years ago[NewGVN] Don't derive incorrect implications.
Davide Italiano [Mon, 1 May 2017 22:26:28 +0000 (22:26 +0000)]
[NewGVN] Don't derive incorrect implications.

In the testcase attached,  we believe %tmp1 implies %tmp4.
where:
  br i1 %tmp1, label %bb2, label %bb7
  br i1 %tmp4, label %bb5, label %bb7

because Wwhile looking at PredicateInfo stuffs we end up calling
isImpliedTrueByMatchingCmp() with the arguments backwards.

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

llvm-svn: 301849

7 years ago[InstCombine] check one-use before applying DeMorgan nor/nand folds
Sanjay Patel [Mon, 1 May 2017 22:25:42 +0000 (22:25 +0000)]
[InstCombine] check one-use before applying DeMorgan nor/nand folds

If we have ~(~X & Y), it only makes sense to transform it to (X | ~Y) when we do not need
the intermediate (~X & Y) value. In that case, we would need an extra instruction to
generate ~Y + 'or' (as shown in the test changes).

It's ok if we have multiple uses of ~X or Y, however. In those cases, we may not reduce the
instruction count or critical path, but we might improve throughput because we can generate
~X and ~Y in parallel. Whether that actually makes perf sense or not for a target is something
we can't answer in IR.

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

llvm-svn: 301848

7 years agoNew file missed from r301846.
Richard Smith [Mon, 1 May 2017 22:11:08 +0000 (22:11 +0000)]
New file missed from r301846.

llvm-svn: 301847

7 years agoFix initial diagnostic state setup for an explicit module with no diagnostic pragmas.
Richard Smith [Mon, 1 May 2017 22:10:47 +0000 (22:10 +0000)]
Fix initial diagnostic state setup for an explicit module with no diagnostic pragmas.

If a file has no diagnostic pragmas, we build its diagnostic state lazily, but
in this case we never set up the root state to be the diagnostic state in which
the module was originally built, so the diagnostic flags for files in the
module with no diagnostic pragmas were incorrectly based on the user of the
module rather than the diagnostic state when the module was built.

llvm-svn: 301846

7 years ago[sanitizer-coverage] remove more stale code
Kostya Serebryany [Mon, 1 May 2017 22:07:12 +0000 (22:07 +0000)]
[sanitizer-coverage] remove more stale code

llvm-svn: 301845

7 years agoAdds initial llvm-dwarfdump --verify support with unit tests.
Greg Clayton [Mon, 1 May 2017 22:07:02 +0000 (22:07 +0000)]
Adds initial llvm-dwarfdump --verify support with unit tests.

lldb-dwarfdump gets a new "--verify" option that will verify a single file's DWARF debug info and will print out any errors that it finds. It will return an non-zero exit status if verification fails, and a zero exit status if verification succeeds. Adding the --quiet option will suppress any output the STDOUT or STDERR.

The first part of the verify does the following:

- verifies that all CU relative references (DW_FORM_ref1, DW_FORM_ref2, DW_FORM_ref4, DW_FORM_ref8, DW_FORM_ref_udata) have valid CU offsets
- verifies that all DW_FORM_ref_addr references have valid .debug_info offsets
- verifies that all DW_AT_ranges attributes have valid .debug_ranges offsets
- verifies that all DW_AT_stmt_list attributes have valid .debug_line offsets
- verifies that all DW_FORM_strp attributes have valid .debug_str offsets

Unit tests were added for each of the above cases.

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

llvm-svn: 301844

7 years agoBitcode: Make the summary reader responsible for merging. NFCI.
Peter Collingbourne [Mon, 1 May 2017 22:04:36 +0000 (22:04 +0000)]
Bitcode: Make the summary reader responsible for merging. NFCI.

This is to prepare for an upcoming change which uses pointers instead of
GUIDs to represent references.

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

llvm-svn: 301843

7 years ago[APInt] In operator!, handle single word case by comparing VAL to 0 directly and...
Craig Topper [Mon, 1 May 2017 21:56:05 +0000 (21:56 +0000)]
[APInt] In operator!, handle single word case by comparing VAL to 0 directly and handle multiword case by comparing countLeadingZerosSlowCase() to BitWidth.

We were using operator=(0) which implicitly calls countLeadingZeros but only to compare with 64 to determine if we can compare VAL or pVal[0] to uint64_t. By handling the multiword case with countLeadingZerosSlowCase==BitWidth we can prevent a load of pVal[0] from being inserted inline at each call site. This saves a little bit of code size.

llvm-svn: 301842

7 years ago[AArch64] Move GISel accessor initialization from TargetMachine to Subtarget.
Quentin Colombet [Mon, 1 May 2017 21:53:19 +0000 (21:53 +0000)]
[AArch64] Move GISel accessor initialization from TargetMachine to Subtarget.

NFC

llvm-svn: 301841

7 years agoPut back REQUIRES: system-darwin to fix asan bot.
Richard Smith [Mon, 1 May 2017 21:49:54 +0000 (21:49 +0000)]
Put back REQUIRES: system-darwin to fix asan bot.

These tests do not appear to be Darwin-specific, and this REQUIRES: appears to
be hiding a real bug; this change is just restoring the prior state to get the
buildbots happy again while we investigate. (The system-darwin requirement is
covered by PR32851.)

llvm-svn: 301840

7 years ago[ubsan] Fall back to the fast unwinder when print_stacktrace=1
Vedant Kumar [Mon, 1 May 2017 21:41:01 +0000 (21:41 +0000)]
[ubsan] Fall back to the fast unwinder when print_stacktrace=1

This makes it possible to get stacktrace info when print_stacktrace=1 on
Darwin (where the slow unwinder is not currently supported [1]). This
should not regress any other platforms.

[1] The thread about r300295 has a relatively recent discusion about
this. We should be able to enable the existing slow unwind functionality
for Darwin, but this needs more testing.

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

llvm-svn: 301839

7 years ago[APInt] Fix copy/paste mistake in comment for isNullValue. NFC
Craig Topper [Mon, 1 May 2017 21:16:44 +0000 (21:16 +0000)]
[APInt] Fix copy/paste mistake in comment for isNullValue. NFC

llvm-svn: 301838

7 years ago[asan] speed up small memcpy (> 32 but <= 64 bytes)
Kostya Serebryany [Mon, 1 May 2017 21:05:29 +0000 (21:05 +0000)]
[asan] speed up small memcpy (> 32 but <= 64 bytes)

llvm-svn: 301837

7 years agoReorder release notes, fix missing link and a grammar issue.
Gabor Horvath [Mon, 1 May 2017 21:02:38 +0000 (21:02 +0000)]
Reorder release notes, fix missing link and a grammar issue.

Patch by Réka Nikolett Kovács!

llvm-svn: 301836

7 years agoIPO: Add missing build dep.
Peter Collingbourne [Mon, 1 May 2017 20:57:20 +0000 (20:57 +0000)]
IPO: Add missing build dep.

llvm-svn: 301835

7 years ago[X86][AVX] Rename LowerVectorBroadcast to lowerBuildVectorAsBroadcast. NFCI.
Simon Pilgrim [Mon, 1 May 2017 20:56:35 +0000 (20:56 +0000)]
[X86][AVX] Rename LowerVectorBroadcast to lowerBuildVectorAsBroadcast. NFCI.

Since the shuffle refactor, this is only used during BUILD_VECTOR lowering.

llvm-svn: 301834

7 years agoAdd comments about how we handle mergeable sections with relocations.
Rui Ueyama [Mon, 1 May 2017 20:49:09 +0000 (20:49 +0000)]
Add comments about how we handle mergeable sections with relocations.

Also factored out code.

llvm-svn: 301833

7 years agoObject: Remove ModuleSummaryIndexObjectFile class.
Peter Collingbourne [Mon, 1 May 2017 20:42:32 +0000 (20:42 +0000)]
Object: Remove ModuleSummaryIndexObjectFile class.

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

llvm-svn: 301832

7 years agoAdd powerpc64 and powerpc64le to build infrastructure.
Sterling Augustine [Mon, 1 May 2017 20:35:02 +0000 (20:35 +0000)]
Add powerpc64 and powerpc64le to build infrastructure.

From Phab D32031.

llvm-svn: 301831

7 years agoFix pr32816.
Rafael Espindola [Mon, 1 May 2017 20:32:39 +0000 (20:32 +0000)]
Fix pr32816.

When using linkerscripts we were trying to sort SHF_LINK_ORDER
sections too early. Instead of always doing two runs of
assignAddresses, record the section order in processCommands.

llvm-svn: 301830

7 years ago[Hexagon] Replace CVI_VM_CUR_LD type with CVI_VM_LD
Krzysztof Parzyszek [Mon, 1 May 2017 20:16:35 +0000 (20:16 +0000)]
[Hexagon] Replace CVI_VM_CUR_LD type with CVI_VM_LD

A .cur instruction can be identified by checking isCVINew() && mayLoad().

Patch by Colin LeMahieu.

llvm-svn: 301829

7 years ago[Hexagon] Improving error reporting for writing to read only registers
Krzysztof Parzyszek [Mon, 1 May 2017 20:10:41 +0000 (20:10 +0000)]
[Hexagon] Improving error reporting for writing to read only registers

Patch by Colin LeMahieu.

llvm-svn: 301828

7 years ago[Hexagon] Give better error messages for solo instruction errors
Krzysztof Parzyszek [Mon, 1 May 2017 20:06:01 +0000 (20:06 +0000)]
[Hexagon] Give better error messages for solo instruction errors

Patch by Colin LeMahieu.

llvm-svn: 301827

7 years ago[sanitizer-coverage] disable coverage_direct=1, will remove the code in a few weeks
Kostya Serebryany [Mon, 1 May 2017 20:01:50 +0000 (20:01 +0000)]
[sanitizer-coverage] disable coverage_direct=1, will remove the code in a few weeks

llvm-svn: 301826

7 years agoSilence unused variable warning. NFC.
Benjamin Kramer [Mon, 1 May 2017 20:00:23 +0000 (20:00 +0000)]
Silence unused variable warning. NFC.

llvm-svn: 301825

7 years ago[sanitizer-coverage] add a deprecation note to coverage_direct=1
Kostya Serebryany [Mon, 1 May 2017 19:52:01 +0000 (19:52 +0000)]
[sanitizer-coverage] add a deprecation note to coverage_direct=1

llvm-svn: 301824

7 years ago[Hexagon] Improve shuffle error reporting
Krzysztof Parzyszek [Mon, 1 May 2017 19:41:43 +0000 (19:41 +0000)]
[Hexagon] Improve shuffle error reporting

Patch by Colin LeMahieu.

llvm-svn: 301823

7 years agoImprove handling of arrays of unknown bound in constant expressions.
Richard Smith [Mon, 1 May 2017 18:49:04 +0000 (18:49 +0000)]
Improve handling of arrays of unknown bound in constant expressions.

Do not spuriously reject constexpr functions that access elements of an array
of unknown bound; this may later become valid once the bound is known. Permit
array-to-pointer decay on such arrays, but disallow pointer arithmetic (since
we do not know whether it will have defined behavior).

The standard is not clear on how this should work, but this seems to be a
decent answer.

Patch by Robert Haberlach!

llvm-svn: 301822

7 years agoChange an unusual directory permission back to a sane value after test.
Rui Ueyama [Mon, 1 May 2017 18:38:37 +0000 (18:38 +0000)]
Change an unusual directory permission back to a sane value after test.

Leaving a directory with a permission 0o100 is inconvenient.
For example, macOS's rm can't remove such directory.

llvm-svn: 301821

7 years agoCleanup previous test commit.
Sterling Augustine [Mon, 1 May 2017 18:04:06 +0000 (18:04 +0000)]
Cleanup previous test commit.

llvm-svn: 301820

7 years agoX86: initialize a few subtarget variables.
Tim Northover [Mon, 1 May 2017 17:50:15 +0000 (17:50 +0000)]
X86: initialize a few subtarget variables.

Otherwise an indeterminate value gets read, causing a bunch of UBSan failures.

llvm-svn: 301819

7 years agoAdd a blank line as a test-commit.
Sterling Augustine [Mon, 1 May 2017 17:43:29 +0000 (17:43 +0000)]
Add a blank line as a test-commit.

Per http://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access

llvm-svn: 301818

7 years agoUse a 2 bit pointer in ValueHandleBase::PrevPair; NFC
Sanjoy Das [Mon, 1 May 2017 17:36:12 +0000 (17:36 +0000)]
Use a 2 bit pointer in ValueHandleBase::PrevPair; NFC

This was an omission in r301813.  I had made the supporting changes to
make this happen, but I forgot to actually update the PrevPair
declaration.

llvm-svn: 301817

7 years agoTake indirect branch into account as well when folding.
Xin Tong [Mon, 1 May 2017 17:15:37 +0000 (17:15 +0000)]
Take indirect branch into account as well when folding.

We may not be able to rewrite indirect branch target, but we also want to take it into
account when folding, i.e. if it and all its successor's predecessors go to the same
destination, we can fold, i.e. no need to thread.

llvm-svn: 301816

7 years agoAdapt to LLVM's rename of WeakVH to WeakTrackingVH; NFC
Sanjoy Das [Mon, 1 May 2017 17:08:00 +0000 (17:08 +0000)]
Adapt to LLVM's rename of WeakVH to WeakTrackingVH; NFC

llvm-svn: 301815

7 years agoUse WeakVH instead of WeakTrackingVH in AliasSetTracker's UnkownInsts
Sanjoy Das [Mon, 1 May 2017 17:07:56 +0000 (17:07 +0000)]
Use WeakVH instead of WeakTrackingVH in AliasSetTracker's UnkownInsts

In cases where an instruction (a call site, say) is RAUW'ed with some
other value (this is possible via the `returned` attribute, for
instance), we want the slot in UnknownInsts to point to the original
Instruction we wanted to track, not the value it got replaced by.

Fixes PR32587.

This relands r301426.

llvm-svn: 301814

7 years agoAdd a new WeakVH value handle; NFC
Sanjoy Das [Mon, 1 May 2017 17:07:54 +0000 (17:07 +0000)]
Add a new WeakVH value handle; NFC

This relands r301425.

llvm-svn: 301813

7 years agoRename WeakVH to WeakTrackingVH; NFC
Sanjoy Das [Mon, 1 May 2017 17:07:49 +0000 (17:07 +0000)]
Rename WeakVH to WeakTrackingVH; NFC

This relands r301424.

llvm-svn: 301812

7 years ago[WebAssembly] Fix use of SDNodeFlags after API change in r301803
Derek Schuff [Mon, 1 May 2017 16:49:39 +0000 (16:49 +0000)]
[WebAssembly] Fix use of SDNodeFlags after API change in r301803

llvm-svn: 301811

7 years ago[PDB/CodeView] Rename some classes.
Zachary Turner [Mon, 1 May 2017 16:46:39 +0000 (16:46 +0000)]
[PDB/CodeView] Rename some classes.

In preparation for introducing writing capabilities for each of
these classes, I would like to adopt a Foo / FooRef naming
convention, where Foo indicates that the class can manipulate and
serialize Foos, and FooRef indicates that it is an immutable view of
an existing Foo.  In other words, Foo is a writer and FooRef is a
reader.  This patch names some existing readers to conform to the
FooRef convention, while offering no functional change.

llvm-svn: 301810

7 years agoEmulate TrackingVH using WeakVH
Sanjoy Das [Mon, 1 May 2017 16:28:58 +0000 (16:28 +0000)]
Emulate TrackingVH using WeakVH

Summary:
This frees up one slot in the HandleBaseKind enum, which I will use
later to add a new kind of value handle.  The size of the
HandleBaseKind enum is important because we store a HandleBaseKind in
the low two bits of a (in the worst case) 4 byte aligned pointer.

Reviewers: davide, chandlerc

Subscribers: mcrosier, llvm-commits

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

llvm-svn: 301809

7 years ago[JumpThread] Add some assertions for expected ConstantInt/BlockAddress
Xin Tong [Mon, 1 May 2017 16:19:59 +0000 (16:19 +0000)]
[JumpThread] Add some assertions for expected ConstantInt/BlockAddress

llvm-svn: 301808

7 years agoRemove unnecessary conditions as suggested by clang-tidy. NFC
Gabor Horvath [Mon, 1 May 2017 16:18:42 +0000 (16:18 +0000)]
Remove unnecessary conditions as suggested by clang-tidy. NFC

Patch by: Gergely Angeli!

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

llvm-svn: 301807

7 years ago[SelectionDAG] Use known ones to provide a better bound for the known zeros for CTTZ...
Craig Topper [Mon, 1 May 2017 16:08:06 +0000 (16:08 +0000)]
[SelectionDAG] Use known ones to provide a better bound for the known zeros for CTTZ/CTLZ operations.

This is the SelectionDAG version of D32521. If know where at least one 1 is located in the input to these intrinsics we can place an upper bound on the number of bits needed to represent the count and thus increase the number of known zeros in the output.

I think we can also refine this further for CTTZ_UNDEF/CTLZ_UNDEF by assuming that the answer will never be BitWidth. I've left this out for now because it caused other test failures across multiple targets. Usually because of turning ADD into OR based on this new information.

I'll fix CTPOP in a future patch.

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

llvm-svn: 301806

7 years agoRelax testcase to fix a PS4 buildbot failure.
Adrian Prantl [Mon, 1 May 2017 15:49:40 +0000 (15:49 +0000)]
Relax testcase to fix a PS4 buildbot failure.

llvm-svn: 301805

7 years ago[JumpThread] Do RAUW in case Cond folds to a constant in the CFG
Xin Tong [Mon, 1 May 2017 15:34:17 +0000 (15:34 +0000)]
[JumpThread] Do RAUW in case Cond folds to a constant in the CFG

Summary: [JumpThread] Do RAUW in case Cond folds to a constant in the CFG

Reviewers: sanjoy

Reviewed By: sanjoy

Subscribers: llvm-commits

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

llvm-svn: 301804

7 years agoGeneralize the specialized flag-carrying SDNodes by moving flags into SDNode.
Amara Emerson [Mon, 1 May 2017 15:17:51 +0000 (15:17 +0000)]
Generalize the specialized flag-carrying SDNodes by moving flags into SDNode.

This removes BinaryWithFlagsSDNode, and flags are now all passed by value.

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

llvm-svn: 301803

7 years ago[InstCombine] add multi-use variants for DeMorgan folds; NFC
Sanjay Patel [Mon, 1 May 2017 14:52:17 +0000 (14:52 +0000)]
[InstCombine] add multi-use variants for DeMorgan folds; NFC

llvm-svn: 301802

7 years ago[InstCombine] use FileCheck and auto-generate checks; NFC
Sanjay Patel [Mon, 1 May 2017 14:20:30 +0000 (14:20 +0000)]
[InstCombine] use FileCheck and auto-generate checks; NFC

llvm-svn: 301801

7 years ago[InstCombine] consolidate more DeMorgan tests; NFC
Sanjay Patel [Mon, 1 May 2017 14:10:59 +0000 (14:10 +0000)]
[InstCombine] consolidate more DeMorgan tests; NFC

llvm-svn: 301800

7 years agoFix test for altmacro
Michael Zuckerman [Mon, 1 May 2017 14:00:54 +0000 (14:00 +0000)]
Fix test for altmacro

llvm-svn: 301799

7 years ago[powerpc] deactivate flakey tests on powerpc64le
Bill Seurer [Mon, 1 May 2017 13:56:04 +0000 (13:56 +0000)]
[powerpc] deactivate flakey tests on powerpc64le

These test cases occassionally fail when run on powerpc64le:

ignore_lib1.cc
ignore_lib5.cc
TestCases/Posix/current_allocated_bytes.cc
rtl/TsanRtlTest/Posix.ThreadLocalAccesses
TestCases/Posix/coverage-fork-direct.cc

The failures cause false problem reports to be sent to developers whose
code had nothing to do with the failures.  Reactivate them when the real
problems are fixed.

This could also be related to the same problems as with the tests
ThreadedOneSizeMallocStressTest, ThreadedMallocStressTest, ManyThreadsTest,
and several others that do not run reliably on powerpc.

llvm-svn: 301798

7 years ago[LLVM][inline-asm] Altmacro absolute expression '%' feature
Michael Zuckerman [Mon, 1 May 2017 13:20:12 +0000 (13:20 +0000)]
[LLVM][inline-asm] Altmacro absolute expression '%' feature

In this patch, I introduce a new alt macro feature.
This feature adds meaning for the % when using it as a prefix to the calling macro arguments.

In the altmacro mode, the percent sign '%' before an absolute expression convert the expression first to a string.
As described in the https://sourceware.org/binutils/docs-2.27/as/Altmacro.html
"Expression results as strings
You can write `%expr' to evaluate the expression expr and use the result as a string."

expression assumptions:

1. '%' can only evaluate an absolute expression.
2. Altmacro '%' must be the first character of the evaluated expression.
3. If no '%' is located before the expression, a regular module operation is expected.
4. The result of Absolute Expressions can be only integer.

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

llvm-svn: 301797

7 years agoThe -coverage-file flag was removed in r280306, and this piece was missed; NFC.
Aaron Ballman [Mon, 1 May 2017 13:05:04 +0000 (13:05 +0000)]
The -coverage-file flag was removed in r280306, and this piece was missed; NFC.

llvm-svn: 301796

7 years agotsan: support linker init flag in __tsan_mutex_destroy
Dmitry Vyukov [Mon, 1 May 2017 10:01:13 +0000 (10:01 +0000)]
tsan: support linker init flag in __tsan_mutex_destroy

For a linker init mutex with lazy flag setup
(no __tsan_mutex_create call), it is possible that
no lock/unlock happened before the destroy call.
Then when destroy runs we still don't know that
it is a linker init mutex and will emulate a memory write.
This in turn can lead to false positives as the mutex
is in fact linker initialized.

Support linker init flag in destroy annotation to resolve this.

llvm-svn: 301795

7 years ago[AVR] Implement non-constant bit rotations
Dylan McKay [Mon, 1 May 2017 09:48:55 +0000 (09:48 +0000)]
[AVR] Implement non-constant bit rotations

This lets us do bit rotations of variable amount.

llvm-svn: 301794

7 years ago[GlobalISel][X86] rename test file. NFC.
Igor Breger [Mon, 1 May 2017 08:11:02 +0000 (08:11 +0000)]
[GlobalISel][X86] rename test file. NFC.

llvm-svn: 301793

7 years ago[GlobalISel][X86] Prioritize Tablegen-erated instruction selection. NFC
Igor Breger [Mon, 1 May 2017 07:06:08 +0000 (07:06 +0000)]
[GlobalISel][X86] Prioritize Tablegen-erated instruction selection. NFC

Summary:
Prioritizes Tablegen-erated instruction selection over C++ instruction selection.
Remove G_ADD/G_SUB C++ selection - implemented by Tablegen.

Reviewers: dsanders, zvi, guyblank

Reviewed By: guyblank

Subscribers: rovka, llvm-commits, kristof.beyls

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

llvm-svn: 301792

7 years ago[X86] Add tests for opportunities to improve known bits for CTTZ and CTLZ.
Craig Topper [Mon, 1 May 2017 06:33:17 +0000 (06:33 +0000)]
[X86] Add tests for opportunities to improve known bits for CTTZ and CTLZ.

llvm-svn: 301791

7 years ago[GlobalISel][X86] G_SEXT/G_ZEXT support.
Igor Breger [Mon, 1 May 2017 06:30:16 +0000 (06:30 +0000)]
[GlobalISel][X86] G_SEXT/G_ZEXT support.

Reviewers: zvi, guyblank

Reviewed By: zvi

Subscribers: rovka, llvm-commits, kristof.beyls

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

llvm-svn: 301790

7 years agoRemove unneeded struct; NFC
Sanjoy Das [Mon, 1 May 2017 06:12:13 +0000 (06:12 +0000)]
Remove unneeded struct; NFC

Summary:
Unless I'm missing something, the DeferredGlobal struct's GV field is
unused, removing which makes the struct itself trivial.

Reviewers: rafael, chandlerc

Subscribers: mcrosier, llvm-commits

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

llvm-svn: 301789

7 years ago[GlobalISel][X86] G_LOAD/G_STORE pointer selection support.
Igor Breger [Mon, 1 May 2017 06:08:32 +0000 (06:08 +0000)]
[GlobalISel][X86] G_LOAD/G_STORE pointer selection support.

Summary: [GlobalISel][X86] G_LOAD/G_STORE pointer selection support.

Reviewers: zvi, guyblank

Reviewed By: zvi, guyblank

Subscribers: dberris, rovka, kristof.beyls, llvm-commits

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

llvm-svn: 301788

7 years agoFix test that was incorrected merged between patches.
Nick Lewycky [Mon, 1 May 2017 02:20:06 +0000 (02:20 +0000)]
Fix test that was incorrected merged between patches.

llvm-svn: 301787

7 years agoFix line endings (dos -> unix) and clang-format while I'm here
David Blaikie [Mon, 1 May 2017 02:11:39 +0000 (02:11 +0000)]
Fix line endings (dos -> unix) and clang-format while I'm here

llvm-svn: 301786

7 years agoHandle expressions with non-literal types like ignored expressions if we are supposed...
Nick Lewycky [Mon, 1 May 2017 02:03:23 +0000 (02:03 +0000)]
Handle expressions with non-literal types like ignored expressions if we are supposed to continue evaluating them.

Also fix a crash casting a derived nullptr to a virtual base.

llvm-svn: 301785

7 years ago[XRay][compiler-rt] Document and update the XRay Logging API
Dean Michael Berris [Mon, 1 May 2017 00:52:57 +0000 (00:52 +0000)]
[XRay][compiler-rt] Document and update the XRay Logging API

Summary:
In this patch we document the requirements for implementations that want
to install handlers for the dynamically-controlled XRay "framework".
This clarifies what the expectations are for implementations that
want to install their handlers using this API (similar to how the FDR
logging implementation does so). It also gives users some guarantees on
semantics for the APIs.

If all goes well, users can decide to use the XRay APIs to control the
tracing/logging at the application level, without having to depend on
implementation details of the installed logging implementation. This
lets users choose the implementation that comes with compiler-rt, or
potentially multiple other implementations that use the same APIs.

We also add one convenience function (__xray_remove_log_impl()) for
explicitly removing the currently installed log implementation.

Reviewers: kpw, pelikan

Subscribers: llvm-commits

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

llvm-svn: 301784

7 years agoutils: Silence -Wpedantic warning
Saleem Abdulrasool [Mon, 1 May 2017 00:26:59 +0000 (00:26 +0000)]
utils: Silence -Wpedantic warning

llvm/tools/clang/utils/TableGen/ClangAttrEmitter.cpp:1673:67: warning: default argument specified for lambda parameter [-Wpedantic]
                    const Record *Constraint = nullptr) {
                                               ^~~~~~~

Found by gcc 5.4.0.

llvm-svn: 301783

7 years ago[AVR] Fix a bug so that we now emit R_AVR_16 fixups with the correct offset
Dylan McKay [Sun, 30 Apr 2017 23:33:52 +0000 (23:33 +0000)]
[AVR] Fix a bug so that we now emit R_AVR_16 fixups with the correct offset

Before this, the LDS/STS instructions would have their opcodes
overwritten while linking.

llvm-svn: 301782

7 years ago[DAGCombiner] shrink/widen a vselect to match its condition operand size (PR14657)
Sanjay Patel [Sun, 30 Apr 2017 22:44:51 +0000 (22:44 +0000)]
[DAGCombiner] shrink/widen a vselect to match its condition operand size (PR14657)

We discussed shrinking/widening of selects in IR in D26556, and I'll try to get back to that
patch eventually. But I'm hoping that this transform is less iffy in the DAG where we can check
legality of the select that we want to produce.

A few things to note:

1. We can't wait until after legalization and do this generically because (at least in the x86
   tests from PR14657), we'll have PACKSS and bitcasts in the pattern.
2. This might benefit more of the SSE codegen if we lifted the legal-or-custom requirement, but
   that requires a closer look to make sure we don't end up worse.
3. There's a 'vblendv' opportunity that we're missing that results in andn/and/or in some cases.
   That should be fixed next.
4. I'm assuming that AVX1 offers the worst of all worlds wrt uneven ISA support with multiple
   legal vector sizes, but if there are other targets like that, we should add more tests.
5. There's a codegen miracle in the multi-BB tests from PR14657 (the gcc auto-vectorization tests):
   despite IR that is terrible for the target, this patch allows us to generate the optimal loop
   code because something post-ISEL is hoisting the splat extends above the vector loops.

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

llvm-svn: 301781

7 years ago[clang-tidy] Fix naming convention in modernize-use-emplace
Jakub Kuderski [Sun, 30 Apr 2017 21:12:56 +0000 (21:12 +0000)]
[clang-tidy] Fix naming convention in modernize-use-emplace

Summary: Conform to the llvm naming convention for local variables in modernize-use-emplace check.

Reviewers: Prazek, JonasToth, alexfh

Reviewed By: Prazek, JonasToth, alexfh

Subscribers: cfe-commits

Tags: #clang-tools-extra

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

llvm-svn: 301780

7 years ago[CMake] Move PollyCore to Polly project folder.
Michael Kruse [Sun, 30 Apr 2017 21:07:05 +0000 (21:07 +0000)]
[CMake] Move PollyCore to Polly project folder.

This keeps the artifacts consistently structured in the "Polly"
folder of Visual Studio solutions.

llvm-svn: 301779