platform/upstream/llvm.git
6 years ago[Reassociate] fix test to be independent of FP undef
Sanjay Patel [Thu, 8 Mar 2018 22:05:27 +0000 (22:05 +0000)]
[Reassociate] fix test to be independent of FP undef

llvm-svn: 327071

6 years ago[Support] Pacify -Wsign-compare in unit test.
Benjamin Kramer [Thu, 8 Mar 2018 21:54:30 +0000 (21:54 +0000)]
[Support] Pacify -Wsign-compare in unit test.

llvm-svn: 327070

6 years ago[TargetLowering] Remove redundant if condition in SimplifySetcc. NFC
Craig Topper [Thu, 8 Mar 2018 21:53:36 +0000 (21:53 +0000)]
[TargetLowering] Remove redundant if condition in SimplifySetcc. NFC

We were checking the condition code a second time when we were already in a block with this same condition code check.

llvm-svn: 327069

6 years ago[asan] Fix bug where suppression of overlapping accesses was ignored on
Dan Liew [Thu, 8 Mar 2018 21:50:22 +0000 (21:50 +0000)]
[asan] Fix bug where suppression of overlapping accesses was ignored on
`strcpy()`, `strncpy()`, `strcat()`, and `strncat()`.

rdar://problem/35576899

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

llvm-svn: 327068

6 years ago[DebugInfo] Move RangeListEntries instead of copying.
Benjamin Kramer [Thu, 8 Mar 2018 21:31:10 +0000 (21:31 +0000)]
[DebugInfo] Move RangeListEntries instead of copying.

This is needed for correctness as RangeListEntry is not copy-assignable,
which std::vector might rely on.

llvm-svn: 327067

6 years ago[AMDGPU] fix test to survive more FP undef constant folding
Sanjay Patel [Thu, 8 Mar 2018 21:30:56 +0000 (21:30 +0000)]
[AMDGPU] fix test to survive more FP undef constant folding

llvm-svn: 327066

6 years ago[NFC] Factor out a helper function for checking if a block has a potential early...
Philip Reames [Thu, 8 Mar 2018 21:25:30 +0000 (21:25 +0000)]
[NFC] Factor out a helper function for checking if a block has a potential early implicit exit.

llvm-svn: 327065

6 years agoLow-hanging fruit optimization in string::__move_assign().
Vedant Kumar [Thu, 8 Mar 2018 21:15:26 +0000 (21:15 +0000)]
Low-hanging fruit optimization in string::__move_assign().

shrink_to_fit() ends up doing a lot work to get information that we
already know since we just called clear(). This change seems concise
enough to be worth the couple extra lines and my benchmarks show that it
is indeed a pretty decent win. It looks like the same thing is going on
twice in __copy_assign_alloc(), but I didn't want to go overboard since
this is my first contribution to llvm/libc++.

Patch by Timothy VanSlyke!

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

llvm-svn: 327064

6 years agoFix compilation failure with MSVC.
Zachary Turner [Thu, 8 Mar 2018 21:07:30 +0000 (21:07 +0000)]
Fix compilation failure with MSVC.

llvm-svn: 327063

6 years ago[asan] Fix a false positive ODR violation due to LTO ConstantMerge pass [compiler...
Kuba Mracek [Thu, 8 Mar 2018 21:02:52 +0000 (21:02 +0000)]
[asan] Fix a false positive ODR violation due to LTO ConstantMerge pass [compiler-rt part, take 3]

This fixes a false positive ODR violation that is reported by ASan when using LTO. In cases, where two constant globals have the same value, LTO will merge them, which breaks ASan's ODR detection. See the included testcase for an example.

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

llvm-svn: 327062

6 years ago[asan] Fix a false positive ODR violation due to LTO ConstantMerge pass [llvm part...
Kuba Mracek [Thu, 8 Mar 2018 21:02:18 +0000 (21:02 +0000)]
[asan] Fix a false positive ODR violation due to LTO ConstantMerge pass [llvm part, take 3]

This fixes a false positive ODR violation that is reported by ASan when using LTO. In cases, where two constant globals have the same value, LTO will merge them, which breaks ASan's ODR detection.

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

llvm-svn: 327061

6 years agoFix signed-unsigned comparison warning.
Zachary Turner [Thu, 8 Mar 2018 20:57:37 +0000 (20:57 +0000)]
Fix signed-unsigned comparison warning.

llvm-svn: 327060

6 years ago[DWARF v5] Support for verbose dumping of .debug_rnglist entries
Wolfgang Pieb [Thu, 8 Mar 2018 20:52:35 +0000 (20:52 +0000)]
[DWARF v5] Support for verbose dumping of .debug_rnglist entries

Adding verbose dumping to the recent implementation of dumping of v5 range list entries.
We're capturing the entries as is as they come in during extraction, including their file offset,
so we can dump them in more detail.
The offset table entries which are table-relative are shown as is (as in non-verbose mode)
and with the actual file offset they map to.

Reviewers: dblaikie, aprantl, jdevlieghere, jhenderson

Subscribers: llvm-commits

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

llvm-svn: 327059

6 years ago[ConstantFold] fp_binop undef, undef --> undef
Sanjay Patel [Thu, 8 Mar 2018 20:42:49 +0000 (20:42 +0000)]
[ConstantFold] fp_binop undef, undef --> undef

These are uncontroversial and independent of a proposed LangRef edits (D44216).

I tried to fix tests that would fold away:
rL327004
rL327028
rL327030
rL327034

I'm not sure if the Reassociate tests are meaningless yet, but they probably will be
as we add more folds, so if anyone has suggestions or wants to fix those, please do.

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

llvm-svn: 327058

6 years ago[Support] Add WriteThroughMemoryBuffer.
Zachary Turner [Thu, 8 Mar 2018 20:34:47 +0000 (20:34 +0000)]
[Support] Add WriteThroughMemoryBuffer.

This is like MemoryBuffer (read-only) and WritableMemoryBuffer
(writable private), but where the underlying file can be modified
after writing.  This is useful when you want to open a file, make
some targeted edits, and then write it back out.

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

llvm-svn: 327057

6 years ago[llvm-mca] Fix handling of zero-latency instructions.
Andrea Di Biagio [Thu, 8 Mar 2018 20:21:55 +0000 (20:21 +0000)]
[llvm-mca] Fix handling of zero-latency instructions.

This patch fixes a problem found when testing zero latency instructions on
target AArch64 -mcpu=exynos-m3 / -mcpu=exynos-m1.

On Exynos-m3/m1, direct branches are zero-latency instructions that don't consume
any processor resources.  The DispatchUnit marks zero-latency instructions as
"executed", so that no scheduling is required.  The event of instruction
executed is then notified to all the listeners, and the reorder buffer (managed
by the RetireControlUnit) is updated. In particular, the entry associated to the
zero-latency instruction in the reorder buffer is marked as executed.

Before this patch, the DispatchUnit forgot to assign a retire control unit token
(RCUToken) to the zero-latency instruction. As a consequence, the RCUToken was
used uninitialized. This was causing a crash in the RetireControlUnit logic.

Fixes PR36650.

llvm-svn: 327056

6 years agoRevert r327053.
Kuba Mracek [Thu, 8 Mar 2018 20:13:39 +0000 (20:13 +0000)]
Revert r327053.

llvm-svn: 327055

6 years ago[X86][AVX] Pull out variable permute creation from LowerBUILD_VECTORAsVariablePermute...
Simon Pilgrim [Thu, 8 Mar 2018 20:07:06 +0000 (20:07 +0000)]
[X86][AVX] Pull out variable permute creation from LowerBUILD_VECTORAsVariablePermute. NFCI.

This will make it easier to handle more complex cases than basic scaling or index masks.

llvm-svn: 327054

6 years ago[asan] Fix a false positive ODR violation due to LTO ConstantMerge pass [llvm part...
Kuba Mracek [Thu, 8 Mar 2018 20:05:45 +0000 (20:05 +0000)]
[asan] Fix a false positive ODR violation due to LTO ConstantMerge pass [llvm part, take 2]

This fixes a false positive ODR violation that is reported by ASan when using LTO. In cases, where two constant globals have the same value, LTO will merge them, which breaks ASan's ODR detection.

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

llvm-svn: 327053

6 years ago[test] Skip a test when using an out-of-tree debugserver
Vedant Kumar [Thu, 8 Mar 2018 19:46:39 +0000 (19:46 +0000)]
[test] Skip a test when using an out-of-tree debugserver

The test "test_fp_special_purpose_register_read" in TestRegisters.py
fails on Darwin machines configured to use an out-of-tree debugserver.

The error message is: 'register read ftag' returns expected result, got
'ftag = 0x80'. This indicates that the debugserver in use is too old.

This commit introduces a decorator which can be used to skip tests which
rely on having a just-built debugserver. This resolves the issue:

$ ./bin/llvm-dotest -p TestRegisters.py -v
  1 out of 617 test suites processed - TestRegisters.py
  Test Methods:          7
  Success:               6
  Skip:                  1
...

llvm-svn: 327052

6 years agoSpecify that test from r327041 requires asserts
Vlad Tsyrklevich [Thu, 8 Mar 2018 19:46:19 +0000 (19:46 +0000)]
Specify that test from r327041 requires asserts

llvm-svn: 327051

6 years agoFix detection of COFF executable files.
Zachary Turner [Thu, 8 Mar 2018 19:45:20 +0000 (19:45 +0000)]
Fix detection of COFF executable files.

One overload of this function would try to identify a file
by opening it and using the first 32 bytes to identify the magic
of the file.  This didn't work properly when more than 32 bytes
is actually needed for magic detection to succeed.  So now we
have this overload read in the entire file.

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

llvm-svn: 327050

6 years agoResubmit "Write a hash of the executable into the PE timestamp fields."
Zachary Turner [Thu, 8 Mar 2018 19:33:47 +0000 (19:33 +0000)]
Resubmit "Write a hash of the executable into the PE timestamp fields."

This fixes the broken tests that were causing failures.  The tests
before were verifying that the time stamp was 0, but now that we
are actually writing a timestamp, I just removed the match against
the timestamp value.

llvm-svn: 327049

6 years ago[DebugInfo] Add verifier for DICompositeType vector
Matt Davis [Thu, 8 Mar 2018 19:31:37 +0000 (19:31 +0000)]
[DebugInfo] Add verifier for DICompositeType vector

Summary:
This patch adds verification logic for DICompositeType vectors, ensuring that they only have one element, and that element is of type subrange.

This patch complements https://reviews.llvm.org/D44048

Reviewers: aprantl

Reviewed By: aprantl

Subscribers: JDevlieghere, llvm-commits

Tags: #debug-info

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

llvm-svn: 327048

6 years agoFix test failure introduced in r327041
Vlad Tsyrklevich [Thu, 8 Mar 2018 19:20:08 +0000 (19:20 +0000)]
Fix test failure introduced in r327041

The "Assertion: `...' failed" error message format is not identical
across platforms.

llvm-svn: 327047

6 years ago[MemorySSA] Split PtrIntPair as this fails on win/arm.
Alina Sbirlea [Thu, 8 Mar 2018 19:15:00 +0000 (19:15 +0000)]
[MemorySSA] Split PtrIntPair as this fails on win/arm.

Summary: Split PtrIntPair into Instruction and OptionalAlias<Result>. The latter needs 3 bits, which appear unavailable on certain archs.

Subscribers: sanjoy, jlebar, Prazek, llvm-commits, kristof.beyls

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

llvm-svn: 327046

6 years agoamdgcn,popcount: Workaround broken llvm.ctpop intrinsic on some GCN ASICs
Jan Vesely [Thu, 8 Mar 2018 18:58:07 +0000 (18:58 +0000)]
amdgcn,popcount: Workaround broken llvm.ctpop intrinsic on some GCN ASICs

This is only really needed for VI+ ASICs. However, llvm would cast the value to
i32 for older asics anyway. The proper fix is in LLVM-7 (r326535).
Fixes CTS popcount on carrizo.

Reviewer: Aaron Watry <awatry@gmail.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 327044

6 years agointeger/gentype: Add __CLC_VECSIZE macro
Jan Vesely [Thu, 8 Mar 2018 18:58:05 +0000 (18:58 +0000)]
integer/gentype: Add __CLC_VECSIZE macro

Reviewer: Aaron Watry <awatry@gmail.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 327043

6 years agopopcount: Provide function implementation rather than intrinsic redirect
Jan Vesely [Thu, 8 Mar 2018 18:58:00 +0000 (18:58 +0000)]
popcount: Provide function implementation rather than intrinsic redirect

amdgcn will need to override this

Reviewer: Aaron Watry <awatry@gmail.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 327042

6 years ago[ThinLTO] Keep available_externally symbols live
Vlad Tsyrklevich [Thu, 8 Mar 2018 18:48:03 +0000 (18:48 +0000)]
[ThinLTO] Keep available_externally symbols live

Summary:
This change fixes PR36483. The bug was originally introduced by a change
that marked non-prevailing symbols dead. This broke LowerTypeTests
handling of available_externally functions, which are non-prevailing.
LowerTypeTests uses liveness information to avoid emitting thunks for
unused functions.

Marking available_externally functions dead is incorrect, the functions
are used though the function definitions are not. This change keeps them
live, and lets the EliminateAvailableExternally/GlobalDCE passes remove
them later instead.

I've also enabled EliminateAvailableExternally for all optimization
levels, I believe it being disabled for O1 was an oversight.

Reviewers: pcc, tejohnson

Reviewed By: tejohnson

Subscribers: grimar, mehdi_amini, inglorion, eraman, llvm-commits

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

llvm-svn: 327041

6 years ago[OpenMP][libomptarget] Fix union.
Gheorghe-Teodor Bercea [Thu, 8 Mar 2018 18:44:02 +0000 (18:44 +0000)]
[OpenMP][libomptarget] Fix union.

Summary: To make the two parts of the union have the same size, the size of vect needs to be increased by 16 bits.

Reviewers: grokos, carlo.bertolli, caomhin, ABataev

Reviewed By: grokos, ABataev

Subscribers: fedor.sergeev, guansong, openmp-commits

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

llvm-svn: 327040

6 years ago[InstCombine] add min/max tests with not ops; NFC
Sanjay Patel [Thu, 8 Mar 2018 18:34:23 +0000 (18:34 +0000)]
[InstCombine] add min/max tests with not ops; NFC

These are based on:
https://bugs.llvm.org/show_bug.cgi?id=35875
It's not clear if/how instcombine can reduce these,
but we should have the tests here either way to
document current behavior.

llvm-svn: 327039

6 years agoMore revert of r327031
Kuba Mracek [Thu, 8 Mar 2018 18:20:03 +0000 (18:20 +0000)]
More revert of r327031

llvm-svn: 327038

6 years ago[Hexagon] Ignore indexed loads when handling unaligned loads
Krzysztof Parzyszek [Thu, 8 Mar 2018 18:15:13 +0000 (18:15 +0000)]
[Hexagon] Ignore indexed loads when handling unaligned loads

llvm-svn: 327037

6 years ago[Tests] Remove empty test file that causes the test suite to fail
David Zarzycki [Thu, 8 Mar 2018 18:03:15 +0000 (18:03 +0000)]
[Tests] Remove empty test file that causes the test suite to fail

This empty file was "created" by r327033, which attempted to revert
r327029, which introduced the file.

llvm-svn: 327036

6 years agoExpose must/may alias info in MemorySSA.
Alina Sbirlea [Thu, 8 Mar 2018 18:03:14 +0000 (18:03 +0000)]
Expose must/may alias info in MemorySSA.

Summary:
Building MemorySSA gathers alias information for Defs/Uses.
Store and expose this information when optimizing uses (when building MemorySSA),
and when optimizing defs or updating uses (getClobberingMemoryAccess).
Current patch does not propagate alias information through MemoryPhis.

Reviewers: gbiv, dberlin

Subscribers: Prazek, sanjoy, llvm-commits

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

llvm-svn: 327035

6 years ago[AMDGPU] fix test to survive the most basic undef constant folding
Sanjay Patel [Thu, 8 Mar 2018 17:34:25 +0000 (17:34 +0000)]
[AMDGPU] fix test to survive the most basic undef constant folding

This will likely need to be changed again for anything more than:
fmul undef, undef -> undef

llvm-svn: 327034

6 years agoRevert r327029
Kuba Mracek [Thu, 8 Mar 2018 17:32:00 +0000 (17:32 +0000)]
Revert r327029

llvm-svn: 327033

6 years agoRevert r327031
Kuba Mracek [Thu, 8 Mar 2018 17:31:31 +0000 (17:31 +0000)]
Revert r327031

llvm-svn: 327032

6 years ago[asan] Fix a false positive ODR violation due to LTO ConstantMerge pass [compiler...
Kuba Mracek [Thu, 8 Mar 2018 17:24:47 +0000 (17:24 +0000)]
[asan] Fix a false positive ODR violation due to LTO ConstantMerge pass [compiler-rt part]

This fixes a false positive ODR violation that is reported by ASan when using LTO. In cases, where two constant globals have the same value, LTO will merge them, which breaks ASan's ODR detection.

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

llvm-svn: 327031

6 years ago[x86] fix test to be independent of FP undef
Sanjay Patel [Thu, 8 Mar 2018 17:24:30 +0000 (17:24 +0000)]
[x86] fix test to be independent of FP undef

llvm-svn: 327030

6 years ago[asan] Fix a false positive ODR violation due to LTO ConstantMerge pass [llvm part]
Kuba Mracek [Thu, 8 Mar 2018 17:24:06 +0000 (17:24 +0000)]
[asan] Fix a false positive ODR violation due to LTO ConstantMerge pass [llvm part]

This fixes a false positive ODR violation that is reported by ASan when using LTO. In cases, where two constant globals have the same value, LTO will merge them, which breaks ASan's ODR detection.

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

llvm-svn: 327029

6 years ago[StructurizeCFG] fix test to be independent of FP undef
Sanjay Patel [Thu, 8 Mar 2018 17:13:57 +0000 (17:13 +0000)]
[StructurizeCFG] fix test to be independent of FP undef

llvm-svn: 327028

6 years ago[llvm-mca] add override keyword to method ResourcePressureView::printView().
Andrea Di Biagio [Thu, 8 Mar 2018 17:02:28 +0000 (17:02 +0000)]
[llvm-mca] add override keyword to method ResourcePressureView::printView().
NFC.

llvm-svn: 327027

6 years ago[x86] regenerate checks; NFC
Sanjay Patel [Thu, 8 Mar 2018 16:56:49 +0000 (16:56 +0000)]
[x86] regenerate checks; NFC

This test will fail if we fix FP undef constant folding.

llvm-svn: 327026

6 years ago[llvm-mca] HWEventListener is a class, not struct.
Andrea Di Biagio [Thu, 8 Mar 2018 16:34:19 +0000 (16:34 +0000)]
[llvm-mca] HWEventListener is a class, not struct.

This should appease the buildbots.

llvm-svn: 327025

6 years agomerge-request.sh: Update 6.0 metabug for 6.0.1
Tom Stellard [Thu, 8 Mar 2018 16:29:08 +0000 (16:29 +0000)]
merge-request.sh: Update 6.0 metabug for 6.0.1

llvm-svn: 327024

6 years ago[clangd] Early return for #include goto definition.
Haojian Wu [Thu, 8 Mar 2018 16:28:12 +0000 (16:28 +0000)]
[clangd] Early return for #include goto definition.

Summary: This would save cost of walking over the AST, NFC.

Reviewers: ilya-biryukov

Subscribers: klimek, jkorous-apple, cfe-commits, ioeric

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

llvm-svn: 327023

6 years ago[StructurizeCFG] auto-generate full checks; NFC
Sanjay Patel [Thu, 8 Mar 2018 16:25:37 +0000 (16:25 +0000)]
[StructurizeCFG] auto-generate full checks; NFC

Not sure what the intent of this test is, but this will change when we fix FP undef constant folding.

llvm-svn: 327022

6 years ago[Power9] Add more missing instructions to the Power 9 scheduler
Stefan Pintilie [Thu, 8 Mar 2018 16:24:33 +0000 (16:24 +0000)]
[Power9] Add more missing instructions to the Power 9 scheduler

With this patch we should be able to mark the Power 9 model as complete.

llvm-svn: 327021

6 years agoAMDGPU/GlobalISel: Pass subtarget + TM to LegalizerInfo
Matt Arsenault [Thu, 8 Mar 2018 16:24:16 +0000 (16:24 +0000)]
AMDGPU/GlobalISel: Pass subtarget + TM to LegalizerInfo

These are the parameters x86 already uses.

llvm-svn: 327020

6 years ago[clangd] Bump vscode extension version to 0.0.5
Eric Liu [Thu, 8 Mar 2018 16:14:11 +0000 (16:14 +0000)]
[clangd] Bump vscode extension version to 0.0.5

llvm-svn: 327019

6 years ago[llvm-mca] Unify the API for the various views. NFCI
Andrea Di Biagio [Thu, 8 Mar 2018 16:08:43 +0000 (16:08 +0000)]
[llvm-mca] Unify the API for the various views. NFCI

This allows the customization of the performance report.

Users can specify their own custom sequence of views.
Each view contributes a portion of the performance report generated by the
BackendPrinter.

Internally, class BackendPrinter keeps a sequence of views; views are printed
out in sequence when method 'printReport()' is called.

This patch addresses one of the two review comments from Clement in D43951.

llvm-svn: 327018

6 years agoFix std unique pointer pretty-printer for new stl versions
Pavel Labath [Thu, 8 Mar 2018 16:03:09 +0000 (16:03 +0000)]
Fix std unique pointer pretty-printer for new stl versions

Summary: The unique pointer layout was changed in libstdc++ 6.0.23.

Reviewers: labath, clayborg

Reviewed By: labath, clayborg

Subscribers: luporl, lbianc, lldb-commits

Differential Revision: https://reviews.llvm.org/D44015
Patch by Alexandre Yukio Yamashita <alexandre.yamashita@eldorado.org.br>.

llvm-svn: 327017

6 years agoInstall lldb's SB headers (pr36630)
Pavel Labath [Thu, 8 Mar 2018 15:52:46 +0000 (15:52 +0000)]
Install lldb's SB headers (pr36630)

These were removed in r309021 in what looks like an accidentally
committed change. This brings them back.

I also rename the header component to lldb-headers (instead of
lldb_headers) to match the llvm style and add a special
install-lldb-headers target, which installs just the headers.

llvm-svn: 327016

6 years agoFix unused function warning in StatisticTest.cpp
Daniel Sanders [Thu, 8 Mar 2018 15:52:45 +0000 (15:52 +0000)]
Fix unused function warning in StatisticTest.cpp

llvm-svn: 327015

6 years ago[InstCombine] regenerate checks; NFC
Sanjay Patel [Thu, 8 Mar 2018 15:46:38 +0000 (15:46 +0000)]
[InstCombine] regenerate checks; NFC

We may not need any of these tests after rL327012, but leaving
them here for now until that's confirmed.

llvm-svn: 327014

6 years ago[LLDB][PPC64] Fix single step and LldbGdbServer tests
Pavel Labath [Thu, 8 Mar 2018 15:41:13 +0000 (15:41 +0000)]
[LLDB][PPC64] Fix single step and LldbGdbServer tests

Summary:
On PPC64, the tested functions were being entered through their local entry point, while the tests expected the program to stop at the function start address, that, for PPC64, corresponds to the global entry point.

To fix the issue, the test program was modified to call the functions to be tested through function pointers, which, on PPC64, force the calls through the global entry point, while not affecting the test on other platforms.

Reviewers: clayborg, labath

Reviewed By: labath

Subscribers: alexandreyy, lbianc

Differential Revision: https://reviews.llvm.org/D43768
Patch by Leandro Lupori <leandro.lupori@gmail.com>.

llvm-svn: 327013

6 years ago[InstSimplify] add more tests for FP undef; NFC
Sanjay Patel [Thu, 8 Mar 2018 15:39:39 +0000 (15:39 +0000)]
[InstSimplify] add more tests for FP undef; NFC

llvm-svn: 327012

6 years agoDWARFVerifier: Basic verification of .debug_names
Pavel Labath [Thu, 8 Mar 2018 15:34:42 +0000 (15:34 +0000)]
DWARFVerifier: Basic verification of .debug_names

Summary:
This patch adds basic .debug_names verification capabilities to the
DWARF verifier. Right now, it checks that the headers and abbreviation
tables of the individual name indexes can be parsed correctly, it
verifies the buckets table and the cross-checks the CU lists for
consistency. I intend to add further checks in follow-up patches.

Reviewers: JDevlieghere, aprantl, probinson, dblaikie

Subscribers: vleschuk, echristo, clayborg, llvm-commits

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

llvm-svn: 327011

6 years ago[llvm-mca] Emit the 'Instruction Info' table before the resource pressure view.
Andrea Di Biagio [Thu, 8 Mar 2018 15:34:38 +0000 (15:34 +0000)]
[llvm-mca] Emit the 'Instruction Info' table before the resource pressure view.

In future, both the summary information and the 'instruction info' table should
be moved into a separate "Summary" view.

llvm-svn: 327010

6 years ago[clangd:vscode] Resolve symlinks for file paths from clangd.
Eric Liu [Thu, 8 Mar 2018 15:28:42 +0000 (15:28 +0000)]
[clangd:vscode] Resolve symlinks for file paths from clangd.

Summary:
For features like go-to-definition, clangd can point clients to symlink paths
(e.g. in bazel execroot) which might not be desired if the symlink points to a
file in the workspace. Clangd might not be able to build the file, and users
might prefer to edit the file on the real path.

This change converts file paths from clangd to real path (e.g. resolving symlinks).
Long term, we might want to the symlink handling logic to clangd where clangd
can better decide whether symlinks should be resolved according to e.g. compile
commands.

Reviewers: sammccall

Subscribers: klimek, ilya-biryukov, jkorous-apple, cfe-commits

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

llvm-svn: 327009

6 years ago[OPENMP] Emit sizes/init ptrs etc. data for task reductions before
Alexey Bataev [Thu, 8 Mar 2018 15:24:08 +0000 (15:24 +0000)]
[OPENMP] Emit sizes/init ptrs etc. data for task reductions before
using.

We may emit the code in wrong order because of incorrect implementation
of the runtime functions for task reductions. Threadprivate storages may
be initialized after real initialization of the reduction items. Patch
fixes this problem.

llvm-svn: 327008

6 years ago[cmake] Append -Wl,-rpath-link conditionally to GNULD
Michal Gorny [Thu, 8 Mar 2018 15:09:38 +0000 (15:09 +0000)]
[cmake] Append -Wl,-rpath-link conditionally to GNULD

Append -Wl,-rpath-link conditionally to whether GNU ld.bfd is used
rather than the Linux+!gold conditionals. Also move it out of 'else'
branch of *BSD handling. This fixes build failures with ld.bfd
on Gentoo/FreeBSD, and should cause no harm on other systems using
ld.bfd.

This patch improves the original logic by reusing results of linker
detection introduced in r307852.

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

llvm-svn: 327007

6 years ago[ELF] - Fix crash relative to SHF_LINK_ORDER sections.
George Rimar [Thu, 8 Mar 2018 15:06:58 +0000 (15:06 +0000)]
[ELF] - Fix crash relative to SHF_LINK_ORDER sections.

Our code assumes all input sections in an output SHF_LINK_ORDER
section has SHF_LINK_ORDER flag. We do not check that and that can cause a crash.

That happens because we call
std::stable_sort(Sections.begin(), Sections.end(), compareByFilePosition);,
where compareByFilePosition predicate does not expect to see
null when calls getLinkOrderDep.

The same might happen when sections refer to non-regular sections.
Test cases demonstrate the issues, patch fixes them.

Differential revision: https://reviews.llvm.org/D44193

llvm-svn: 327006

6 years agoImplement LWG#2518 - Non-member swap for propagate_const should call member swap
Marshall Clow [Thu, 8 Mar 2018 15:01:50 +0000 (15:01 +0000)]
Implement LWG#2518 - Non-member swap for propagate_const should call member swap

llvm-svn: 327005

6 years ago[InstCombine, NewGVN] remove FP undef from tests
Sanjay Patel [Thu, 8 Mar 2018 14:57:08 +0000 (14:57 +0000)]
[InstCombine, NewGVN] remove FP undef from tests

I'm trying to preserve the intent of these tests by using
non-undef operands; if we fix FP undef folding these tests
will not pass.

llvm-svn: 327004

6 years ago[ELF] - Support "INSERT AFTER" statement.
George Rimar [Thu, 8 Mar 2018 14:54:38 +0000 (14:54 +0000)]
[ELF] - Support "INSERT AFTER" statement.

This implements INSERT AFTER in a following way:

During reading scripts it collects all insert statements.
After we done and read all files it inserts statements into script commands list.

With that:
* Rest of code does know nothing about INSERT.
* Approach is straightforward and have no visible limitations.
* It is also easy to support INSERT BEFORE (was seen in clang code once).
* Should work for PR35877 and similar cases.

Cons:
* It assumes we have "main" scripts that describes sections.

Differential revision: https://reviews.llvm.org/D43468

llvm-svn: 327003

6 years ago[CMake] Add missing test dependency
David Zarzycki [Thu, 8 Mar 2018 14:43:24 +0000 (14:43 +0000)]
[CMake] Add missing test dependency

This makes 'ninja clean ; ninja check-all' work again.

llvm-svn: 327002

6 years ago[COFF] Make the DOS stub a real DOS program
Hans Wennborg [Thu, 8 Mar 2018 14:27:28 +0000 (14:27 +0000)]
[COFF] Make the DOS stub a real DOS program

It only adds a few bytes and is nice for backward compatibility.

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

llvm-svn: 327001

6 years agoUse ellipsis ... to indicate omitted commands
Ed Maste [Thu, 8 Mar 2018 13:52:04 +0000 (13:52 +0000)]
Use ellipsis ... to indicate omitted commands

In an example like "clang -fxray-instrument .." the .. could be confused
with a literal .. (parent directory), which is used in commands like
"cmake -GNinja .."

llvm-svn: 327000

6 years agoAdd llvm-mca.rst to the table of contents in docs/CommandGuide.
Andrea Di Biagio [Thu, 8 Mar 2018 13:43:11 +0000 (13:43 +0000)]
Add llvm-mca.rst to the table of contents in docs/CommandGuide.

This should fix the documentation error reported by builder llvm-sphinx-docs
(build #16407) after r326998.

llvm-svn: 326999

6 years ago[llvm-mca] LLVM Machine Code Analyzer.
Andrea Di Biagio [Thu, 8 Mar 2018 13:05:02 +0000 (13:05 +0000)]
[llvm-mca] LLVM Machine Code Analyzer.

llvm-mca is an LLVM based performance analysis tool that can be used to
statically measure the performance of code, and to help triage potential
problems with target scheduling models.

llvm-mca uses information which is already available in LLVM (e.g. scheduling
models) to statically measure the performance of machine code in a specific cpu.
Performance is measured in terms of throughput as well as processor resource
consumption. The tool currently works for processors with an out-of-order
backend, for which there is a scheduling model available in LLVM.

The main goal of this tool is not just to predict the performance of the code
when run on the target, but also help with diagnosing potential performance
issues.

Given an assembly code sequence, llvm-mca estimates the IPC (instructions per
cycle), as well as hardware resources pressure. The analysis and reporting style
were mostly inspired by the IACA tool from Intel.

This patch is related to the RFC on llvm-dev visible at this link:
http://lists.llvm.org/pipermail/llvm-dev/2018-March/121490.html

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

llvm-svn: 326998

6 years ago[clang-format] Use NestedBlockIndent as a 0 column in formatted raw strings
Krasimir Georgiev [Thu, 8 Mar 2018 11:29:27 +0000 (11:29 +0000)]
[clang-format] Use NestedBlockIndent as a 0 column in formatted raw strings

Summary:
This makes the formatter of raw string literals use NestedBlockIndent for
determining the 0 column of the content inside. This makes the formatting use
less horizonal space and fixes a case where two newlines before and after the
raw string prefix were selected instead of a single newline after it:

Before:
```
aaaa = ffff(
    R"pb(
      key: value)pb");
```

After:
```
aaaa = ffff(R"pb(
    key: value)pb");
```

Reviewers: djasper, sammccall

Reviewed By: sammccall

Subscribers: klimek, cfe-commits

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

llvm-svn: 326996

6 years ago[DWARF] Don't attempt to parse line tables at invalid offsets
James Henderson [Thu, 8 Mar 2018 10:53:34 +0000 (10:53 +0000)]
[DWARF] Don't attempt to parse line tables at invalid offsets

Whilst working on improvements to the error handling of the debug line
parsing code, I noticed that if an invalid offset were to be specified
in a call to getOrParseLineTable(), an entry in the LineTableMap would
still be created, even if the offset was not within the section range.
The immediate parsing attempt afterwards would fail (it would end up
getting a version of 0), and thereafter, any subsequent calls to
getOrParseLineTable or getLineTable would return the default-
constructed, invalid line table. In reality, we shouldn't even attempt
to parse this table, and we should always return a nullptr from these
two functions for this situation.

I have tested this via a unit test, which required some new framework
for unit testing debug line. My plan is to add quite a few more unit
tests for the new error reporting mechanism that will follow shortly,
hence the reason why the supporting code for the tests are written the
way they are - I intend to extend the DwarfGenerator class to support
generating debug line. At that point, I'll make sure that there are a
few positive test cases for this and the parsing code too.

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

Reviewers: JDevlieghere, aprantl
llvm-svn: 326995

6 years ago[dsymutil] Embed toolchain in dSYM bundle
Jonas Devlieghere [Thu, 8 Mar 2018 10:39:12 +0000 (10:39 +0000)]
[dsymutil] Embed toolchain in dSYM bundle

Allow us to embed the (Xcode) toolchain in the dSYM bundle's property
list.

Differential revision: https://reviews.llvm.org/D44151

llvm-svn: 326994

6 years ago[MCSchedule] Always generate processor resource names.
Andrea Di Biagio [Thu, 8 Mar 2018 10:38:45 +0000 (10:38 +0000)]
[MCSchedule] Always generate processor resource names.

With this patch, the tablegen 'SubtargetEmitter' always generates processor
resource names.
The impact of this patch on the code size of other llvm tools is small.  I have
observed an average increase of 0.03% in code size when doing a release build of
LLVM (on windows, using MSVC) with all the default backends.

This change is done in preparation for the upcoming llvm-mca patch.

llvm-svn: 326993

6 years ago[X86] Change X86::PMULDQ/PMULUDQ opcodes to take vXi64 type as input instead of vXi32.
Craig Topper [Thu, 8 Mar 2018 08:02:52 +0000 (08:02 +0000)]
[X86] Change X86::PMULDQ/PMULUDQ opcodes to take vXi64 type as input instead of vXi32.

This instruction can be thought of as reading either the even elements of a vXi32 input or the lower half of each element of a vXi64 input. We currently use the vXi32 interpretation, but vXi64 matches better with its broadcast behavior in EVEX.

I'm looking at moving MULDQ/MULUDQ creation to a DAG combine so we can do it when AVX512DQ is enabled without having to go through Custom lowering. But in some of the test cases we failed to use a broadcast load due to the size difference. This should help with that.

I'm also wondering if we can model these instructions in native IR and remove the intrinsics and I think using a vXi64 type will work better with that.

llvm-svn: 326991

6 years agoPropagate DLLAttr to friend re-declarations of member functions
Stephan Bergmann [Thu, 8 Mar 2018 07:34:40 +0000 (07:34 +0000)]
Propagate DLLAttr to friend re-declarations of member functions

...that have already been constructed (e.g., in inner classes) while parsing the
class definition.  They would otherwise lack any DLLAttr inherited from the
class, which are only set here (called from Sema::CheckCompletedClass) after the
class definition has been parsed completely.

Differential revision: https://reviews.llvm.org/D16632

llvm-svn: 326990

6 years ago[AMDGPU] Update AMDGOUUsage.rst descriptions
Tony Tye [Thu, 8 Mar 2018 05:46:01 +0000 (05:46 +0000)]
[AMDGPU] Update AMDGOUUsage.rst descriptions

- Improve description of XNACK ELF flag.
- Rename all uses of wave to wavefront to be consistent.

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

llvm-svn: 326989

6 years ago[CodeGen] Emit lifetime.ends in both EH and non-EH blocks
George Burgess IV [Thu, 8 Mar 2018 05:32:30 +0000 (05:32 +0000)]
[CodeGen] Emit lifetime.ends in both EH and non-EH blocks

Before this, we'd only emit lifetime.ends for these temps in
non-exceptional paths. This potentially made our stack larger than it
needed to be for any code that follows an EH cleanup. e.g. in

```
struct Foo { char cs[32]; };

void escape(void *);

struct Bar { ~Bar() { char cs[64]; escape(cs); } };

Foo getFoo();

void baz() {
  Bar b;
  getFoo();
}
```

baz() would require 96 bytes of stack, since the temporary from getFoo()
only had a lifetime.end on the non-exceptional path.

This also makes us keep hold of the Value* returned by
EmitLifetimeStart, so we don't have to remake it later.

llvm-svn: 326988

6 years agoBuild LLVMDemangle from build_symbolizer.sh
Eugene Zemtsov [Thu, 8 Mar 2018 04:34:22 +0000 (04:34 +0000)]
Build LLVMDemangle from build_symbolizer.sh

Symbolizer now depends on internal implementation of itaniumDemangle.

llvm-svn: 326987

6 years ago[WebAssembly] Add except_ref as a first-class type
Heejin Ahn [Thu, 8 Mar 2018 04:06:57 +0000 (04:06 +0000)]
[WebAssembly] Add except_ref as a first-class type

Summary:
Add except_ref as a first-class type, according to the [[https://github.com/WebAssembly/exception-handling/blob/master/proposals/Level-1.md | Level 1 exception handling proposal ]].
Companion to D43706.

Reviewers: sbc100

Subscribers: jfb, dschuff, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 326986

6 years ago[WebAssembly] Add except_ref as a first-class type
Heejin Ahn [Thu, 8 Mar 2018 04:05:37 +0000 (04:05 +0000)]
[WebAssembly] Add except_ref as a first-class type

Summary: Add except_ref as a first-class type, according to the [[https://github.com/WebAssembly/exception-handling/blob/master/proposals/Level-1.md | Level 1 exception handling proposal ]].

Reviewers: dschuff

Subscribers: jfb, sbc100, llvm-commits

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

llvm-svn: 326985

6 years ago[WebAssembly] Add IntrNoReturn property to throw/rethrow intrinsics
Heejin Ahn [Thu, 8 Mar 2018 03:47:52 +0000 (03:47 +0000)]
[WebAssembly] Add IntrNoReturn property to throw/rethrow intrinsics

Reviewers: dschuff

Subscribers: jfb, sbc100, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 326984

6 years agoAdd Demangle lib into internalization list
Eugene Zemtsov [Thu, 8 Mar 2018 02:57:54 +0000 (02:57 +0000)]
Add Demangle lib into internalization list

Symbolizer now depends on internal implementation of itaniumDemangle.

llvm-svn: 326983

6 years ago[analyzer] Correctly model iteration through "nil" objects
George Karpenkov [Thu, 8 Mar 2018 02:53:39 +0000 (02:53 +0000)]
[analyzer] Correctly model iteration through "nil" objects

Previously, iteration through nil objects which resulted from
objc-messages being set to nil were modeled incorrectly.

There are a couple of notes about this patch:

In principle, ExprEngineObjC might be left untouched IFF osx.loops
checker is enabled.
I however think that we should not do something
completely incorrect depending on what checkers are left on.
We should evaluate and potentially remove altogether the isConsumedExpr
performance heuristic, as it seems very fragile.

rdar://22205149

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

llvm-svn: 326982

6 years agoSupport resetting STATISTIC() values using llvm::ResetStatistics()
Daniel Sanders [Thu, 8 Mar 2018 02:36:25 +0000 (02:36 +0000)]
Support resetting STATISTIC() values using llvm::ResetStatistics()

Summary:
Most of the time, compiler statistics can be obtained using a process that
performs a single compilation and terminates such as llc. However, this isn't
always the case. JITs for example, perform multiple compilations over their
lifetime and STATISTIC() will record cumulative values across all of them.

Provide tools like this with the facilities needed to measure individual
compilations by allowing them to reset the STATISTIC() values back to zero using
llvm::ResetStatistics(). It's still the tools responsibility to ensure that they
perform compilations in such a way that the results are meaningful to their
intended use.

Reviewers: qcolombet, rtereshin, bogner, aditya_nandakumar

Reviewed By: bogner

Subscribers: llvm-commits

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

llvm-svn: 326981

6 years agoFix an unused variable warning; NFC
George Burgess IV [Thu, 8 Mar 2018 02:15:12 +0000 (02:15 +0000)]
Fix an unused variable warning; NFC

llvm-svn: 326980

6 years ago[Documentation] Fix Release notes problems introduced in r326889. Add highlighting.
Eugene Zelenko [Thu, 8 Mar 2018 01:37:39 +0000 (01:37 +0000)]
[Documentation] Fix Release notes problems introduced in r326889. Add highlighting.

llvm-svn: 326979

6 years agoAdd attributes and fix some keywords in llvm-mode.el
Fangrui Song [Thu, 8 Mar 2018 01:28:45 +0000 (01:28 +0000)]
Add attributes and fix some keywords in llvm-mode.el

Reviewers: rafael, echristo

Reviewed By: echristo

Subscribers: llvm-commits

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

llvm-svn: 326978

6 years agoReturn early. NFC.
Rui Ueyama [Thu, 8 Mar 2018 01:22:30 +0000 (01:22 +0000)]
Return early. NFC.

We don't need to handle an object file having more than one symbol table,
so as soon as we find the first one, we can process it and then return
from the function.

llvm-svn: 326977

6 years ago[WebAssembly] Honor --allow-undefined even for explicit exports
Sam Clegg [Thu, 8 Mar 2018 01:16:05 +0000 (01:16 +0000)]
[WebAssembly] Honor --allow-undefined even for explicit exports

When a symbol is exported via --export=foo but --allow-undefined
is also specified, the symbol is now allowed to be undefined.
Previously we were special casing such symbols.

This combinations of behavior is exactly what emescripten
requires. Although we are trying hard not to allow emscripten
specific features in lld, this one makes sense.

Enforce this behavior by added this case to test/wasm/undefined.ll.

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

llvm-svn: 326976

6 years agoRevert "[LTO] Support filtering by hotness threshold"
Bob Haarman [Thu, 8 Mar 2018 01:13:10 +0000 (01:13 +0000)]
Revert "[LTO] Support filtering by hotness threshold"

This reverts commit 1f3bd185c53beb6aa68446974b7e80837abd6ef0 (r326107)
because it fails
ThinLTO/X86/diagnostic-handler-remarks-with-hotness.ll.

llvm-svn: 326975

6 years agoRevert "[Sema] Make getCurFunction() return null outside function parsing"
Reid Kleckner [Thu, 8 Mar 2018 01:12:22 +0000 (01:12 +0000)]
Revert "[Sema] Make getCurFunction() return null outside function parsing"

This reverts r326965. It seems to have caused repeating test failures in
clang/test/Sema/diagnose_if.c on some buildbots.

I cannot reproduce the problem, and it's not immediately obvious what
the problem is, so let's revert to green.

llvm-svn: 326974

6 years agoWhen substituting previously-checked template arguments into a template
Richard Smith [Thu, 8 Mar 2018 01:07:33 +0000 (01:07 +0000)]
When substituting previously-checked template arguments into a template
template parameter that is an expanded parameter pack, only substitute into the
current slice, not the entire pack.

This reduces the checking of N template template arguments for an expanded
parameter pack containing N parameters from quadratic time to linear time in
the length of the pack. This is important because one (and possibly the only?)
general technique for splitting a template parameter pack in linear time
depends on doing this.

llvm-svn: 326973

6 years agoSimplify LazyobjFile and readElfSymbols.
Rui Ueyama [Thu, 8 Mar 2018 01:05:58 +0000 (01:05 +0000)]
Simplify LazyobjFile and readElfSymbols.

addElfSymbols and readJustSymbolsFile still has duplicate code, but
I didn't come up with a good idea to eliminate them. Since this patch
is an improvement, I'm sending this for review.

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

llvm-svn: 326972

6 years ago[MS] Pass CVRU qualifiers properly in Itanium mangler
Reid Kleckner [Thu, 8 Mar 2018 00:55:09 +0000 (00:55 +0000)]
[MS] Pass CVRU qualifiers properly in Itanium mangler

We already have a mangling for the __unaligned qualifier, we just have
to call Qualifiers::getFromCVRUMask instead of getFromCVRMask.

PR36638

llvm-svn: 326971

6 years agoReland "[DebugInfo] Support DWARF expressions in eh_frame"
Rafael Auler [Thu, 8 Mar 2018 00:46:53 +0000 (00:46 +0000)]
Reland "[DebugInfo] Support DWARF expressions in eh_frame"

Summary:
Original change was D43313 (r326932) and reverted by r326953 because it
broke an LLD test and a windows build. The LLD test was already fixed in
lld commit r326944 (thanks maskray). This is the original change with
the windows build fixed.

llvm-svn: 326970

6 years ago[AArch64] Fix UB about shift amount exceeds data bit-width
Weiming Zhao [Thu, 8 Mar 2018 00:28:25 +0000 (00:28 +0000)]
[AArch64] Fix UB about shift amount exceeds data bit-width

Summary:
Fixes an UB caught by sanitizer. The shift amount might be larger than 32 so the operand should be 1ULL.
In this patch,  we replace the original expression with  existing API with uint64_t type.

Reviewers: eli.friedman, rengolin

Reviewed By: rengolin

Subscribers: rengolin, javed.absar, llvm-commits, kristof.beyls

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

llvm-svn: 326969