platform/upstream/llvm.git
7 years ago[InstCombine] make icmp-mul fold more efficient
Sanjay Patel [Thu, 25 May 2017 14:13:57 +0000 (14:13 +0000)]
[InstCombine] make icmp-mul fold more efficient

There's probably a lot more like this (see also comments in D33338 about responsibility),
but I suspect we don't usually get a visible manifestation.

Given the recent interest in improving InstCombine efficiency, another potential micro-opt
that could be repeated several times in this function: morph the existing icmp pred/operands
instead of creating a new instruction.

llvm-svn: 303860

7 years ago[AMDGPU] add intrinsic for s_getpc
Tim Corringham [Thu, 25 May 2017 14:04:14 +0000 (14:04 +0000)]
[AMDGPU] add intrinsic for s_getpc

Summary: The s_getpc instruction is exposed as intrinsic llvm.amdgcn.s.getpc.

Reviewers: arsenm

Reviewed By: arsenm

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye

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

llvm-svn: 303859

7 years ago[X86] Adding vpopcntd and vpopcntq instructions
Oren Ben Simhon [Thu, 25 May 2017 13:45:23 +0000 (13:45 +0000)]
[X86] Adding vpopcntd and vpopcntq instructions

AVX512_VPOPCNTDQ is a new feature set that was published by Intel.
The patch represents the LLVM side of the addition of two new intrinsic based instructions (vpopcntd and vpopcntq).

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

llvm-svn: 303858

7 years ago[X86] Adding avx512_vpopcntdq feature set and its intrinsics
Oren Ben Simhon [Thu, 25 May 2017 13:44:11 +0000 (13:44 +0000)]
[X86] Adding avx512_vpopcntdq feature set and its intrinsics

AVX512_VPOPCNTDQ is a new feature set that was published by Intel.
The patch represents the Clang side of the addition of six intrinsics for two new machine instructions (vpopcntd and vpopcntq).
It also includes the addition of the new feature set.

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

llvm-svn: 303857

7 years agoMake for_each_n only avaliable on C++17
Marshall Clow [Thu, 25 May 2017 13:40:57 +0000 (13:40 +0000)]
Make for_each_n only avaliable on C++17

llvm-svn: 303856

7 years ago[GVNSink] Pacify MSVC
James Molloy [Thu, 25 May 2017 13:14:10 +0000 (13:14 +0000)]
[GVNSink] Pacify MSVC

Don't convert an unsigned to a pointer for a sentinel, use a size_t instead.

llvm-svn: 303855

7 years agoRevert "Fix FDE indexing while scan debug_info section."
Pavel Labath [Thu, 25 May 2017 13:13:12 +0000 (13:13 +0000)]
Revert "Fix FDE indexing while scan debug_info section."

This reverts commit r303847 as it introduces a number of regressions.
Investigation has showed that we are parsing the CIE entries in the
debug_frame section incorrectly -- we are parsing them the same way as
eh_frame, but the entries in debug_frame have a couple of extra entries
which have not been taken into account.

llvm-svn: 303854

7 years ago[GVNSink] Don't define operator<< in NDEBUG
James Molloy [Thu, 25 May 2017 13:11:18 +0000 (13:11 +0000)]
[GVNSink] Don't define operator<< in NDEBUG

Without debug macros enabled, the raw_ostream operator<< overload
is unused.

llvm-svn: 303852

7 years ago[CodeGen] Pessimize aliasing for member unions (and may-alias) objects
Krzysztof Parzyszek [Thu, 25 May 2017 12:55:47 +0000 (12:55 +0000)]
[CodeGen] Pessimize aliasing for member unions (and may-alias) objects

Use the TBAA info of the omnipotent char for these objects.

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

llvm-svn: 303851

7 years ago[GVNSink] GVNSink pass
James Molloy [Thu, 25 May 2017 12:51:11 +0000 (12:51 +0000)]
[GVNSink] GVNSink pass

This patch provides an initial prototype for a pass that sinks instructions based on GVN information, similar to GVNHoist. It is not yet ready for commiting but I've uploaded it to gather some initial thoughts.

This pass attempts to sink instructions into successors, reducing static
instruction count and enabling if-conversion.
We use a variant of global value numbering to decide what can be sunk.
Consider:

[ %a1 = add i32 %b, 1  ]   [ %c1 = add i32 %d, 1  ]
[ %a2 = xor i32 %a1, 1 ]   [ %c2 = xor i32 %c1, 1 ]
                 \           /
           [ %e = phi i32 %a2, %c2 ]
           [ add i32 %e, 4         ]

GVN would number %a1 and %c1 differently because they compute different
results - the VN of an instruction is a function of its opcode and the
transitive closure of its operands. This is the key property for hoisting
and CSE.

What we want when sinking however is for a numbering that is a function of
the *uses* of an instruction, which allows us to answer the question "if I
replace %a1 with %c1, will it contribute in an equivalent way to all
successive instructions?". The (new) PostValueTable class in GVN provides this
mapping.

This pass has some shown really impressive improvements especially for codesize already on internal benchmarks, so I have high hopes it can replace all the sinking logic in SimplifyCFG.

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

llvm-svn: 303850

7 years ago(no commit message)
Florian Gross [Thu, 25 May 2017 11:43:06 +0000 (11:43 +0000)]
(no commit message)

llvm-svn: 303849

7 years agoRecommit "RunThreadPlan: Fix halting logic in IgnoreBreakpoints = false"
Pavel Labath [Thu, 25 May 2017 10:50:06 +0000 (10:50 +0000)]
Recommit "RunThreadPlan: Fix halting logic in IgnoreBreakpoints = false"

This is a resubmit of r303732, which was reverted due to a regression.

The original patch caused a regression in TestLoadUnload, which has only showed
up when running the remote test suite. The problem there was that we interrupted
the target just as it has hit the rendezvous breakpoint in the dlopen call. This
meant that the stop reason was set to "breakpoint" even though the event would
not have been broadcast if we had not stopped the process. I fix this by
checking StopInfo->ShouldNotify() before stopping.

I also add a new test for the handling of conditional breakpoints in
expressions, which I noticed to be broken (pr33164)

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

llvm-svn: 303848

7 years agoFix FDE indexing while scan debug_info section.
Hafiz Abid Qadeer [Thu, 25 May 2017 10:21:29 +0000 (10:21 +0000)]
Fix FDE indexing while scan debug_info section.

There are some differences between eh_frame and debug_frame formats that
are not considered by DWARFCallFrameInfo::GetFDEIndex. An FDE entry
contains CIE_pointer in debug_frame in same place as cie_id in eh_frame.
As described in dwarf standard (section 6.4.1), CIE_pointer is an
"offset into the .debug_frame section". So, variable cie_offset should
be equal cie_id for debug_frame.

FDE entries with zeroth CIE pointer (which is actually placed in cie_id
variable) shouldn't be ignored also.

I have also added a little change which allow to use debug_info section
when eh_frame is absent. This case really can take place on some platforms.

Patch from tatyana-krasnukha.
https://reviews.llvm.org/D33504

llvm-svn: 303847

7 years ago[OpenCL] reserve_id_t cannot be used as argument to kernel function
Egor Churaev [Thu, 25 May 2017 07:18:37 +0000 (07:18 +0000)]
[OpenCL] reserve_id_t cannot be used as argument to kernel function

Reviewers: Anastasia

Reviewed By: Anastasia

Subscribers: yaxunl, cfe-commits, bader

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

llvm-svn: 303846

7 years ago[PM] Teach the PGO instrumentation pasess to run GlobalDCE before
Chandler Carruth [Thu, 25 May 2017 07:15:09 +0000 (07:15 +0000)]
[PM] Teach the PGO instrumentation pasess to run GlobalDCE before
instrumenting code.

This is important in the new pass manager. The old pass manager's
inliner has a small DCE routine embedded within it. The new pass manager
relies on the actual GlobalDCE pass for this.

Without this patch, instrumentation profiling with the new PM results in
massive code bloat in the object files because the instrumentation
itself ends up preventing DCE from working to remove the code.

We should probably change the instrumentation (and/or DCE) so that we
can eliminate dead code even if instrumented, but we shouldn't even
spend the time generating instrumentation for that code so this still
seems like a good patch.

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

llvm-svn: 303845

7 years ago[OpenCL] Added regression test on invalid vector initialization.
Egor Churaev [Thu, 25 May 2017 06:55:02 +0000 (06:55 +0000)]
[OpenCL] Added regression test on invalid vector initialization.

Summary: This patch increases code coverage.

Reviewers: Anastasia

Reviewed By: Anastasia

Subscribers: cfe-commits, bader, yaxunl

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

llvm-svn: 303844

7 years ago[PM/Unswitch] Fix a bug in the domtree update logic for the new unswitch
Chandler Carruth [Thu, 25 May 2017 06:33:36 +0000 (06:33 +0000)]
[PM/Unswitch] Fix a bug in the domtree update logic for the new unswitch
pass.

The original logic only considered direct successors of the hoisted
domtree nodes, but that isn't really enough. If there are other basic
blocks that are completely within the subtree, their successors could
just as easily be impacted by the hoisting.

The more I think about it, the more I think the correct update here is
to hoist every block on the dominance frontier which has an idom in the
chain we hoist across. However, this is subtle enough that I'd
definitely appreciate some more eyes on it.

Sadly, if this is the correct algorithm, it requires computing a (highly
localized) dominance frontier. I've done this in the simplest (IE, least
code) way I could come up with, but that may be too naive. Suggestions
welcome here, dominance update algorithms are not an area I've studied
much, so I don't have strong opinions.

In good news, with this patch, turning on simple unswitch passes the
LLVM test suite for me with asserts enabled.

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

llvm-svn: 303843

7 years ago[compiler-rt] Change default of allow_user_segv_handler to true
Vitaly Buka [Thu, 25 May 2017 06:29:30 +0000 (06:29 +0000)]
[compiler-rt] Change default of allow_user_segv_handler to true

Reviewers: eugenis

Subscribers: srhines, kubamracek, llvm-commits

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

llvm-svn: 303842

7 years ago[MVT] Fix the identation of the start of the MVT class. NFC
Craig Topper [Thu, 25 May 2017 06:15:05 +0000 (06:15 +0000)]
[MVT] Fix the identation of the start of the MVT class. NFC

llvm-svn: 303841

7 years ago[SelectionDAG] Fix off by one in a compare in getOperationAction.
Craig Topper [Thu, 25 May 2017 05:38:40 +0000 (05:38 +0000)]
[SelectionDAG] Fix off by one in a compare in getOperationAction.

If Op is equal to array_lengthof, the lookup would be out of bounds, but we were only checking for greater than. I suspect nothing ever passes in the equal value because its a sentinel to mark the end of the builtin opcodes and not a real opcode.

So really this fix is just so that the code looks right and makes sense.

llvm-svn: 303840

7 years agoDrop newline in docs builder to see if Polly docs are updated
Tobias Grosser [Thu, 25 May 2017 05:38:05 +0000 (05:38 +0000)]
Drop newline in docs builder to see if Polly docs are updated

llvm-svn: 303839

7 years agoRemove <experimental/coroutine> from the module map for now. It doesn't work unless...
Eric Fiselier [Thu, 25 May 2017 05:30:05 +0000 (05:30 +0000)]
Remove <experimental/coroutine> from the module map for now. It doesn't work unless modules are enabled

llvm-svn: 303838

7 years agoDisable the coroutines tests until Clang bumps __cpp_coroutines to reflect recent...
Eric Fiselier [Thu, 25 May 2017 05:11:40 +0000 (05:11 +0000)]
Disable the coroutines tests until Clang bumps __cpp_coroutines to reflect recent changes

llvm-svn: 303837

7 years agoAdd <experimental/coroutine>
Eric Fiselier [Thu, 25 May 2017 04:36:24 +0000 (04:36 +0000)]
Add <experimental/coroutine>

This patch adds the library portions of the coroutines PDTS,
which should now be supported by Clang.

llvm-svn: 303836

7 years agoFix broken links on C++1z status page
Eric Fiselier [Thu, 25 May 2017 04:09:07 +0000 (04:09 +0000)]
Fix broken links on C++1z status page

llvm-svn: 303835

7 years ago[LegacyPM] Make the 'addLoop' method accept a loop to add rather than
Chandler Carruth [Thu, 25 May 2017 03:01:31 +0000 (03:01 +0000)]
[LegacyPM] Make the 'addLoop' method accept a loop to add rather than
having it internally allocate the loop.

This is a much more flexible API and necessary in the new loop unswitch
to reasonably support both new and old PMs in common code. It also just
seems like a cleaner separation of concerns.

NFC, this should just be a pure refactoring.

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

llvm-svn: 303834

7 years agoAdd non-parallel version of for_each_n (+tests) from the Parallelism TS
Marshall Clow [Thu, 25 May 2017 02:29:54 +0000 (02:29 +0000)]
Add non-parallel version of for_each_n (+tests) from the Parallelism TS

llvm-svn: 303833

7 years agoFix the warning when you pass -c to step/next/si/ni.
Jim Ingham [Thu, 25 May 2017 02:24:18 +0000 (02:24 +0000)]
Fix the warning when you pass -c to step/next/si/ni.

During some cleanup the test for whether the thread plan
accepted an iteration count was reversed, so we give a
warning when it will actually work, and don't when it won't.

<rdar://problem/32379280>

llvm-svn: 303832

7 years ago[coroutines] Fix fallthrough diagnostics for coroutines
Eric Fiselier [Thu, 25 May 2017 02:16:53 +0000 (02:16 +0000)]
[coroutines] Fix fallthrough diagnostics for coroutines

Summary:
This patch fixes a number of issues with the analysis warnings emitted when a coroutine may reach the end of the function w/o returning.

* Fix bug where coroutines with `return_value` are incorrectly diagnosed as missing `co_return`'s.
* Rework diagnostic message to no longer say "non-void coroutine", because that implies the coroutine doesn't have a void return type, which it might. In this case a non-void coroutine is one who's promise type does not contain `return_void()`

As a side-effect of this patch, coroutine bodies that contain an invalid coroutine promise objects are marked as invalid.

Reviewers: GorNishanov, rsmith, aaron.ballman, majnemer

Reviewed By: GorNishanov

Subscribers: cfe-commits

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

llvm-svn: 303831

7 years agoFixed nondeterminism in RuleMatcher::emit.
Galina Kistanova [Thu, 25 May 2017 01:51:53 +0000 (01:51 +0000)]
Fixed nondeterminism in RuleMatcher::emit.

llvm-svn: 303829

7 years ago[libFuzzer] Don't replace custom signal handlers.
Vitaly Buka [Thu, 25 May 2017 01:43:13 +0000 (01:43 +0000)]
[libFuzzer] Don't replace custom signal handlers.

Summary:
This allows to keep handlers installed by sanitizers.
In other cases third-party code can replace handlers after libFuzzer
initialization anyway.

Reviewers: kcc

Subscribers: llvm-commits

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

llvm-svn: 303828

7 years agoFix coverage check for full post-dominator basic blocks.
George Karpenkov [Thu, 25 May 2017 01:41:46 +0000 (01:41 +0000)]
Fix coverage check for full post-dominator basic blocks.

Coverage instrumentation which does not instrument full post-dominators
and full-dominators may skip valid paths, as the reasoning for skipping
blocks may become circular.
This patch fixes that, by only skipping
full post-dominators with multiple predecessors, as such predecessors by
definition can not be full-dominators.

llvm-svn: 303827

7 years ago[coroutines] CoroFrame.cpp conform to coding convention (s/repeat/Repeat) (NFC)
Gor Nishanov [Thu, 25 May 2017 01:07:10 +0000 (01:07 +0000)]
[coroutines] CoroFrame.cpp conform to coding convention (s/repeat/Repeat) (NFC)

llvm-svn: 303826

7 years ago[coroutines] Relocate instructions that maybe spilled after coro.begin
Gor Nishanov [Thu, 25 May 2017 00:46:20 +0000 (00:46 +0000)]
[coroutines] Relocate instructions that maybe spilled after coro.begin

Summary:
Frontend generates store instructions after allocas, for example:

```
define i8* @f(i64 %this) "coroutine.presplit"="1" personality i32 0 {
entry:
  %this.addr = alloca i64
  store i64 %this, i64* %this.addr
  ..
  %hdl = call i8* @llvm.coro.begin(token %id, i8* %alloc)

```
Such instructions may require spilling into coro.frame, but, coro-frame address is only available after coro.begin and thus needs to be moved after coro.begin.
The only instructions that should not be moved are the arguments of coro.begin and all of their operands.

Reviewers: GorNishanov, majnemer

Reviewed By: GorNishanov

Subscribers: llvm-commits, EricWF

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

llvm-svn: 303825

7 years agoAdd some constexpr tests for optional's move/copy ctor
Marshall Clow [Thu, 25 May 2017 00:22:33 +0000 (00:22 +0000)]
Add some constexpr tests for optional's move/copy ctor

llvm-svn: 303824

7 years agoCorrect compiler warnings and Debug build of the NetBSD target
Kamil Rytarowski [Wed, 24 May 2017 23:59:50 +0000 (23:59 +0000)]
Correct compiler warnings and Debug build of the NetBSD target

Correct files present only in the NetBSD build.

llvm-svn: 303823

7 years ago[PowerPC] Fix a performance bug for PPC::XXSLDWI.
Tony Jiang [Wed, 24 May 2017 23:48:29 +0000 (23:48 +0000)]
[PowerPC] Fix a performance bug for PPC::XXSLDWI.

There are some VectorShuffle Nodes in SDAG which can be selected to XXSLDWI
instruction, this patch recognizes them and does the selection to improve the
PPC performance.

llvm-svn: 303822

7 years agoPrint symbols from COFF import libraries.
Rafael Espindola [Wed, 24 May 2017 23:40:36 +0000 (23:40 +0000)]
Print symbols from COFF import libraries.

This change allows llvm-nm to print symbols found in import libraries,
in part by allowing COFFImportFiles to be casted to SymbolicFiles.

Patch by Dave Lee!

llvm-svn: 303821

7 years ago[CodeGen] Fix some Clang-tidy modernize-use-using and Include What You Use warnings...
Eugene Zelenko [Wed, 24 May 2017 23:10:29 +0000 (23:10 +0000)]
[CodeGen] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 303820

7 years ago[coroutines] Allow rematerialization upto 4 times. Remove incorrect assert
Gor Nishanov [Wed, 24 May 2017 23:01:02 +0000 (23:01 +0000)]
[coroutines] Allow rematerialization upto 4 times. Remove incorrect assert

Reviewers: majnemer

Subscribers: EricWF, llvm-commits

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

llvm-svn: 303819

7 years ago[InstCombine] use m_APInt to allow icmp-mul-mul vector fold
Sanjay Patel [Wed, 24 May 2017 22:58:17 +0000 (22:58 +0000)]
[InstCombine] use m_APInt to allow icmp-mul-mul vector fold

The swapped operands in the first test is a manifestation of an
inefficiency for vectors that doesn't exist for scalars because
the IRBuilder checks for an all-ones mask for scalars, but not
vectors.

llvm-svn: 303818

7 years agoAllow builds to set COMPILER_RT_OS_DIR differently from CMAKE_SYSTEM_NAME
Jonathan Roelofs [Wed, 24 May 2017 22:41:49 +0000 (22:41 +0000)]
Allow builds to set COMPILER_RT_OS_DIR differently from CMAKE_SYSTEM_NAME

llvm-svn: 303817

7 years ago[InstCombine] add tests for icmp eq (mul X, C), (mul Y, C); NFC
Sanjay Patel [Wed, 24 May 2017 22:36:14 +0000 (22:36 +0000)]
[InstCombine] add tests for icmp eq (mul X, C), (mul Y, C); NFC

llvm-svn: 303816

7 years agoReduce indentation. NFC.
Rui Ueyama [Wed, 24 May 2017 22:36:11 +0000 (22:36 +0000)]
Reduce indentation. NFC.

llvm-svn: 303815

7 years agoGarbage collect dllimported symbols.
Rui Ueyama [Wed, 24 May 2017 22:30:06 +0000 (22:30 +0000)]
Garbage collect dllimported symbols.

This is a different implementation than r303225 (which was reverted
in r303270, re-submitted in r303304 and then re-reverted in r303527).

In the previous patch, I tried to add Live bit to each dllimported
symbol. It turned out that it didn't work with "oldnames.lib" which
contains a lot of weak aliases to dllimported symbols.

The way we handle weak aliases is to check if undefined symbols
can be resolved using weak aliases, and if so, memcpy the Defined
symbols to weak Undefined symbols, so that any references to weak
aliases automatically see defined symbols instead of undefined ones.

This memcpy happens before MarkLive kicks in.

That means we may have multiple copies of dllimported symbols. So
turning on one instance's Live bit is not enough.

This patch moves the Live bit to dllimport file. Since multiple
copies of dllsymbols still point to the same file, we can use it as the
central repository to keep track of liveness.

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

llvm-svn: 303814

7 years agoRevert "Sema: allow imaginary constants via GNU extension if UDL overloads not present."
Tim Northover [Wed, 24 May 2017 22:18:35 +0000 (22:18 +0000)]
Revert "Sema: allow imaginary constants via GNU extension if UDL overloads not present."

This reverts commit r303697. It broke libc++ tests that were specifically
checking incompatibility in C++14 mode.

llvm-svn: 303813

7 years agoSimplify MipsRldMapSection::writeTo.
Rafael Espindola [Wed, 24 May 2017 22:04:32 +0000 (22:04 +0000)]
Simplify MipsRldMapSection::writeTo.

It is not clear why a synthetic section wants to use padding defined
in the linker script. The padding is for the space between sections.

It was also missing a test.

llvm-svn: 303812

7 years agoFix negate-overflow.cpp test on Windows after r303440
Hans Wennborg [Wed, 24 May 2017 21:52:40 +0000 (21:52 +0000)]
Fix negate-overflow.cpp test on Windows after r303440

lit would interpret the exit code as failuire.

llvm-svn: 303809

7 years ago[InstCombine] move tests and use FileCheck; NFC
Sanjay Patel [Wed, 24 May 2017 21:48:25 +0000 (21:48 +0000)]
[InstCombine] move tests and use FileCheck; NFC

llvm-svn: 303808

7 years ago[ScopInfo] Tighten compute out introduced in r303404
Tobias Grosser [Wed, 24 May 2017 21:24:04 +0000 (21:24 +0000)]
[ScopInfo] Tighten compute out introduced in r303404

It seems we are still spending too much time on rare inputs, which continue to
timeout the AOSP buildbot. Let's see if a further reduction is sufficient.

llvm-svn: 303807

7 years ago[Demangler] Remove a failing assert introduced in r303718
Erik Pilkington [Wed, 24 May 2017 20:53:13 +0000 (20:53 +0000)]
[Demangler] Remove a failing assert introduced in r303718

llvm-svn: 303806

7 years agoFix the sanitizer-windows bot.
Rui Ueyama [Wed, 24 May 2017 20:32:23 +0000 (20:32 +0000)]
Fix the sanitizer-windows bot.

Looks like r303801 broke the sanitizer-windows bot. I don't fully
understand what is going on, so I'll partially revert that patch.

llvm-svn: 303805

7 years agoBasic: fix whitespace in file header (NFC)
Saleem Abdulrasool [Wed, 24 May 2017 20:27:09 +0000 (20:27 +0000)]
Basic: fix whitespace in file header (NFC)

llvm-svn: 303804

7 years ago[coroutines] Add support for coroutines with non-scalar parameters
Gor Nishanov [Wed, 24 May 2017 20:09:14 +0000 (20:09 +0000)]
[coroutines] Add support for coroutines with non-scalar parameters

Summary:
Simple types like int are handled by LLVM Coroutines just fine.
But for non-scalar parameters we need to create copies of those parameters in the coroutine frame and make all uses of those parameters to refer to parameter copies.

Reviewers: rsmith, EricWF, GorNishanov

Subscribers: cfe-commits

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

llvm-svn: 303803

7 years ago[DAG] Prevent crashes when merging constant stores with high-bit set. NFC.
Nirav Dave [Wed, 24 May 2017 19:56:39 +0000 (19:56 +0000)]
[DAG] Prevent crashes when merging constant stores with high-bit set. NFC.

llvm-svn: 303802

7 years agoClose the gap between ELF and COFF ICF implementations. NFC.
Rui Ueyama [Wed, 24 May 2017 19:56:29 +0000 (19:56 +0000)]
Close the gap between ELF and COFF ICF implementations. NFC.

We originally wrote the ICF code for COFF and ported it to ELF.
They started diverging since then. This patch closes the gap.

llvm-svn: 303801

7 years ago[AArch64] Prevent nested ADDs from address calc in splitStoreSplat. NFC
Nirav Dave [Wed, 24 May 2017 19:55:49 +0000 (19:55 +0000)]
[AArch64] Prevent nested ADDs from address calc in splitStoreSplat. NFC

In preparation for late-stage store merging.

llvm-svn: 303800

7 years agoFor Microsoft compatibility, set fno_operator_names
Erich Keane [Wed, 24 May 2017 19:31:19 +0000 (19:31 +0000)]
For Microsoft compatibility, set fno_operator_names

There's a Microsoft header in the Windows SDK which won't
compile with clang because it uses an operator name (and)
as a field name. This patch allows that file to compile by
setting the option which disables operator names.
The header which doesn't compile <Query.h> C:/Program Files (x86)/
Windows Kits/10/include/10.0.14393.0/um\Query.h:259:40:
error: expected member name or ';' after declaration specifiers

  /* [case()] */ NODERESTRICTION or;
                   ~~~~~~~~~~~~~~~ ^

                   1 error generated.

Contributed for Melanie Blower

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

llvm-svn: 303798

7 years agoImprove parallelism of ICF.
Rui Ueyama [Wed, 24 May 2017 19:22:34 +0000 (19:22 +0000)]
Improve parallelism of ICF.

This is the only place we use threads for ICF. The intention of this code
was to split an input vector into 256 shards and process them in parallel.
What the code was actually doing was to split an input into 257 shards,
process the first 256 shards in parallel, and the remaining one in serial.

That means this code takes ceil(256/n)+1 instead of ceil(256/n) where n
is the number of available CPU cores. The former converges to 2 while
the latter converges to 1.

This patches fixes the above issue.

llvm-svn: 303797

7 years agoRevert "Revert "Attempt to pacify ASan and UBSan reports in CrashRecovery tests""
Vitaly Buka [Wed, 24 May 2017 19:11:12 +0000 (19:11 +0000)]
Revert "Revert "Attempt to pacify ASan and UBSan reports in CrashRecovery tests""

This dependents on r303729 which was reverted.

This reverts commit r303783.

llvm-svn: 303796

7 years agoRevert "[compiler-rt] Change default of allow_user_segv_handler to true"
Vitaly Buka [Wed, 24 May 2017 19:09:24 +0000 (19:09 +0000)]
Revert "[compiler-rt] Change default of allow_user_segv_handler to true"

Breaks sanitizer-x86_64-linux-fuzzer bot.

This reverts commit r303729.

llvm-svn: 303795

7 years ago[InstCombine] Merge together the SimplifyDemandedUseBits implementations for ZExt...
Craig Topper [Wed, 24 May 2017 18:40:25 +0000 (18:40 +0000)]
[InstCombine] Merge together the SimplifyDemandedUseBits implementations for ZExt and Trunc. NFC

While there avoid resizing the DemandedMask twice. Make a copy into a separate variable instead. This potentially removes an allocation on large bit widths.

With the use of the zextOrTrunc methods on APInt and KnownBits these can be made almost source identical. The only difference is the zero of the upper bits for ZExt. This is similar to how its done in computeKnownBits in ValueTracking.

llvm-svn: 303791

7 years ago[Polly] Add handling of Top Level Regions
Philip Pfaffe [Wed, 24 May 2017 18:39:39 +0000 (18:39 +0000)]
[Polly] Add handling of Top Level Regions

Summary:
My goal is to make the newly added `AllowWholeFunctions` options more usable/powerful.

The changes to ScopBuilder.cpp are exclusively checks to prevent `Region.getExit()` from being dereferenced, since Top Level Regions (TLRs) don't have an exit block.

In ScopDetection's `isValidCFG`, I removed a check that disallowed ReturnInstructions to have return values. This might of course have been intentional, so I would welcome your feedback on this and maybe a small explanation why return values are forbidden. Maybe it can be done but needs more changes elsewhere?

The remaining changes in ScopDetection are simply to consider the AllowWholeFunctions option in more places, i.e. allow TLRs when it is set and once again avoid derefererncing `getExit()` if it doesn't exist.

Finally, in ScopHelper.cpp I extended `polly::isErrorBlock` to handle regions without exit blocks as well: The original check was if a given BasicBlock dominates all predecessors of the exit block. Therefore I do the same for TLRs by regarding all BasicBlocks terminating with a ReturnInst as predecessors of a "virtual" function exit block.

Patch by: Lukas Boehm

Reviewers: philip.pfaffe, grosser, Meinersbur

Reviewed By: grosser

Subscribers: pollydev, llvm-commits, bollu

Tags: #polly

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

llvm-svn: 303790

7 years agoAddress follow-up feedback for r303712
Argyrios Kyrtzidis [Wed, 24 May 2017 18:35:01 +0000 (18:35 +0000)]
Address follow-up feedback for r303712

llvm-svn: 303789

7 years agoReplace std::call_once with llvm:call_once
Kamil Rytarowski [Wed, 24 May 2017 18:31:48 +0000 (18:31 +0000)]
Replace std::call_once with llvm:call_once

Summary:
This is required on some platforms, as GNU libstdc++ std::call_once is known to be buggy.

This fixes operation of LLD on at least NetBSD and perhaps OpenBSD and Linux PowerPC.

The same change has been introduced to LLVM and LLDB.

Reviewers: ruiu

Reviewed By: ruiu

Subscribers: emaste, #lld

Tags: #lld

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

llvm-svn: 303788

7 years agoSimplify a variable type by using StringRef instead of CachedHashStringRef.
Rui Ueyama [Wed, 24 May 2017 18:22:27 +0000 (18:22 +0000)]
Simplify a variable type by using StringRef instead of CachedHashStringRef.

A variable `ComdatGroup` is not supposed to contain a large number of
items. Even when linking clang, it ends up having only 300K strings.
It doesn't make sense to use CachedHashStringRef for this hash table.
This patch has neutral or slightly positive impact on performance while
reducing code complexity.

llvm-svn: 303787

7 years agoFix one test case faiulre in commit 303766.
Tony Jiang [Wed, 24 May 2017 18:12:11 +0000 (18:12 +0000)]
Fix one test case faiulre in commit 303766.

It is clean when I build boostrap and run make checkall on my machine, I guess
it could be I only build bootstrap with assert, while the buildbots may build
without asserts, which could cause the difference.

llvm-svn: 303786

7 years agoPrevent UBSan report in CrashRecovery tests
Vitaly Buka [Wed, 24 May 2017 18:11:57 +0000 (18:11 +0000)]
Prevent UBSan report in CrashRecovery tests
Reverted by mistake with r303783.

llvm-svn: 303785

7 years agoMove writeTo to OutputSectionCommand.
Rafael Espindola [Wed, 24 May 2017 18:08:04 +0000 (18:08 +0000)]
Move writeTo to OutputSectionCommand.

This reduces how many times we have to map from OutputSection to
OutputSectionCommand. It is a required step to moving
clearOutputSections earlier.

In order to always use writeTo in OutputSectionCommand we have to call
fabricateDefaultCommands for -r links and move section compression
after it.

llvm-svn: 303784

7 years agoRevert "Attempt to pacify ASan and UBSan reports in CrashRecovery tests"
Vitaly Buka [Wed, 24 May 2017 17:58:09 +0000 (17:58 +0000)]
Revert "Attempt to pacify ASan and UBSan reports in CrashRecovery tests"

It's not needed after r303729.

This reverts commit r303311.

llvm-svn: 303783

7 years agoFix a couple of typos in memory intrinsic optimization output (NFC)
Teresa Johnson [Wed, 24 May 2017 17:55:25 +0000 (17:55 +0000)]
Fix a couple of typos in memory intrinsic optimization output (NFC)

s/instrinsic/intrinsic

llvm-svn: 303782

7 years agoMove clearOutputSections earlier. NFC.
Rafael Espindola [Wed, 24 May 2017 17:54:28 +0000 (17:54 +0000)]
Move clearOutputSections earlier. NFC.

llvm-svn: 303781

7 years agoP9: D-form vector load/store. Differential Revision: https://reviews.llvm.org/D33248
Zaara Syeda [Wed, 24 May 2017 17:50:37 +0000 (17:50 +0000)]
P9: D-form vector load/store. Differential Revision: https://reviews.llvm.org/D33248

llvm-svn: 303780

7 years ago[InstCombine] Use less bitwise operations to handle Instruction::SExt in SimplifyDema...
Craig Topper [Wed, 24 May 2017 17:33:30 +0000 (17:33 +0000)]
[InstCombine] Use less bitwise operations to handle Instruction::SExt in SimplifyDemandedUseBits. Other improvements.

The current code created a NewBits mask and used it as a mask several times. One of them just before a call to trunc making it unnecessary. A call to getActiveBits can get us the same information for the case. We also ORed with this mask later when we should have just sign extended the known bits.

We also called trunc on the guaranteed to be zero KnownZeros/Ones masks entering this code. Creating appropriately sized temporary APInts is probably better.

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

llvm-svn: 303779

7 years agoMove machine-cse-physreg.mir to test/CodeGen/Thumb
Krzysztof Parzyszek [Wed, 24 May 2017 17:20:47 +0000 (17:20 +0000)]
Move machine-cse-physreg.mir to test/CodeGen/Thumb

llvm-svn: 303778

7 years agoRewrite badly-formatted switch. NFC.
Rui Ueyama [Wed, 24 May 2017 17:12:53 +0000 (17:12 +0000)]
Rewrite badly-formatted switch. NFC.

llvm-svn: 303777

7 years agoMake key-value types explicit. NFC.
Rui Ueyama [Wed, 24 May 2017 17:12:32 +0000 (17:12 +0000)]
Make key-value types explicit. NFC.

llvm-svn: 303776

7 years agoChange the control flow so that the function is a bit more readable. NFC.
Rui Ueyama [Wed, 24 May 2017 17:12:10 +0000 (17:12 +0000)]
Change the control flow so that the function is a bit more readable. NFC.

llvm-svn: 303775

7 years ago[InstSimplify] Simplify uadd/sadd/umul/smul with overflow intrinsics when the Zero...
Craig Topper [Wed, 24 May 2017 17:05:28 +0000 (17:05 +0000)]
[InstSimplify] Simplify uadd/sadd/umul/smul with overflow intrinsics when the Zero or Undef is on the LHS.

Summary: This code was migrated from InstCombine a few years ago. InstCombine had nearby code that would move Constants to the RHS for these, but InstSimplify doesn't have such code on this path.

Reviewers: spatel, majnemer, davide

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 303774

7 years ago[ValueTracking] Convert most of the calls to computeKnownBits to use the version...
Craig Topper [Wed, 24 May 2017 16:53:07 +0000 (16:53 +0000)]
[ValueTracking] Convert most of the calls to computeKnownBits to use the version that returns the KnownBits object.

This continues the changes started when computeSignBit was replaced with this new version of computeKnowBits.

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

llvm-svn: 303773

7 years ago[ValueTracking] Add OptimizationRemarkEmitter to the other signature for commuteKnown...
Craig Topper [Wed, 24 May 2017 16:53:03 +0000 (16:53 +0000)]
[ValueTracking] Add OptimizationRemarkEmitter to the other signature for commuteKnownBits.

This is needed for an upcoming patch.

llvm-svn: 303772

7 years agoRevert r291254: [AArch64] Reduce vector insert/extract cost for Falkor
Matthew Simpson [Wed, 24 May 2017 16:48:39 +0000 (16:48 +0000)]
Revert r291254: [AArch64] Reduce vector insert/extract cost for Falkor

The default vector insert/extract cost is more profitable on Falkor than the
reduced cost.

llvm-svn: 303771

7 years agoDo not track section types of previous sections, always use PROGBITS for dummy sections.
Dmitry Mikulin [Wed, 24 May 2017 16:48:31 +0000 (16:48 +0000)]
Do not track section types of previous sections, always use PROGBITS for dummy sections.

Fix for PR33029.

llvm-svn: 303770

7 years agoAdd some tips on benchmarking.
Rafael Espindola [Wed, 24 May 2017 16:39:12 +0000 (16:39 +0000)]
Add some tips on benchmarking.

llvm-svn: 303769

7 years ago[OPENMP] Allow value of thread local variables in target regions.
Alexey Bataev [Wed, 24 May 2017 16:00:02 +0000 (16:00 +0000)]
[OPENMP] Allow value of thread local variables in target regions.

If the variable is marked as TLS variable and target device does not
support TLS, the error is emitted for the variable even if it is not
used in target regions. Patch fixes this and allows to use the values of
the TLS variables in target regions.

llvm-svn: 303768

7 years ago[AMDGPU] Prevent too large store merges in AMDGPU Subtargets. NFCI.
Nirav Dave [Wed, 24 May 2017 15:59:09 +0000 (15:59 +0000)]
[AMDGPU] Prevent too large store merges in AMDGPU Subtargets. NFCI.

Various address spaces on the SI and R600 subtargets have stricter
limits on memory access size that other address spaces. Use
canMergeStoresTo predicate to prevent the DAGCombiner from creating
these stores as they will be split up during legalization.

llvm-svn: 303767

7 years ago[PowerPC] Implement vec_xxsldwi builtin.
Tony Jiang [Wed, 24 May 2017 15:54:13 +0000 (15:54 +0000)]
[PowerPC] Implement vec_xxsldwi builtin.

The vec_xxsldwi builtin is missing from altivec.h. This has been requested by
developers working on libvpx for VP9 support for Google.

The patch fixes PR: https://bugs.llvm.org/show_bug.cgi?id=32653
Differential Revision: https://reviews.llvm.org/D33236

llvm-svn: 303766

7 years agoAllow armv{7,7s,7k,7m,7em} builds
Jonathan Roelofs [Wed, 24 May 2017 15:53:24 +0000 (15:53 +0000)]
Allow armv{7,7s,7k,7m,7em} builds

llvm-svn: 303765

7 years ago[coroutines] Make generic lambda coroutines work
Gor Nishanov [Wed, 24 May 2017 15:44:57 +0000 (15:44 +0000)]
[coroutines] Make generic lambda coroutines work

Summary:
1. Coroutine cannot be constexpr (added a check in SemaLambda.cpp not to mark coroutine as constexpr)
2. TransformCoroutineBodyStmt should transform ResultDecl and ReturnStmt

Reviewers: rsmith, GorNishanov

Reviewed By: GorNishanov

Subscribers: EricWF, cfe-commits

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

llvm-svn: 303764

7 years ago[LV] Update type in cost model for scalarization
Matthew Simpson [Wed, 24 May 2017 15:26:15 +0000 (15:26 +0000)]
[LV] Update type in cost model for scalarization

For non-uniform instructions marked for scalarization, we should update
`VectorTy` when computing instruction costs to reflect the scalar type. In
addition to determining instruction costs, this type is also used to signal
that all instructions in the loop will be scalarized. This currently affects
memory instructions and non-pointer induction variables and their updates. (We
also mark GEPs scalar after vectorization, but their cost is computed together
with memory instructions.) For scalarized induction updates, this patch also
scales the scalar cost by the vectorization factor, corresponding to each
induction step.

llvm-svn: 303763

7 years ago[DeLICM] Partial writes for PHIs.
Michael Kruse [Wed, 24 May 2017 15:23:06 +0000 (15:23 +0000)]
[DeLICM] Partial writes for PHIs.

Enable the use for partial writes for PHI write accesses with a switch.
This simply skips the test for whether a PHI write would be partial.

The analog test for partial value writes also protects for partial reads
which we do not support (yet). It is possible to test for partial reads
separately such that we could skip the partial write check as well. In
case this shows up to be useful, I can implement it as well.

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

llvm-svn: 303762

7 years agoWarn about uses of `@available` that can't suppress the
Alex Lorenz [Wed, 24 May 2017 15:15:29 +0000 (15:15 +0000)]
Warn about uses of `@available` that can't suppress the
-Wunguarded-availability warnings

rdar://32306520

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

llvm-svn: 303761

7 years ago[PowerPC] Implement vec_xxpermdi builtin.
Tony Jiang [Wed, 24 May 2017 15:13:32 +0000 (15:13 +0000)]
[PowerPC] Implement vec_xxpermdi builtin.

The vec_xxpermdi builtin is missing from altivec.h. This has been requested by
developers working on libvpx for VP9 support for Google.

The patch fixes PR: https://bugs.llvm.org/show_bug.cgi?id=32653
Differential Revision: https://reviews.llvm.org/D33053

llvm-svn: 303760

7 years ago[JSONImporter] misses checks whether the data it imports makes sense.
Michael Kruse [Wed, 24 May 2017 15:09:35 +0000 (15:09 +0000)]
[JSONImporter] misses checks whether the data it imports makes sense.

Without this patch, the JSONImporter did not verify if the data it loads
were correct or not  (Bug llvm.org/PR32543). I add some checks in the
JSONImporter class and some test cases.

Here are the checks (and test cases) I added :

JSONImporter::importContext
- The "context" key does not exist.
- The context was not parsed successfully by ISL.
- The isl_set has the wrong number of parameters.
- The isl_set is not a parameter set.

JSONImporter::importSchedule
- The "statements" key does not exist.
- There is not the right number of statement in the file.
- The "schedule" key does not exist.
- The schedule was not parsed successfully by ISL.

JSONImporter::importAccesses
- The "statements" key does not exist.
- There is not the right number of statement in the file.
- The "accesses" key does not exist.
- There is not the right number of memory accesses in the file.
- The "relation" key does not exist.
- The memory access was not parsed successfully by ISL.

JSONImporter::areArraysEqual
- The "type" key does not exist.
- The "sizes" key does not exist.
- The "name" key does not exist.

JSONImporter::importArrays
/!\ Do not check if there is an key name "arrays" because it is not
considered as an error.
All checks are already in place or implemented in
JSONImporter::areArraysEqual.

Contributed-by: Nicolas Bonfante <nicolas.bonfante@insa-lyon.fr>
Differential Revision: https://reviews.llvm.org/D32739

llvm-svn: 303759

7 years ago[MSP430] Fix PR33050: Don't use ADD16ri to lower FrameIndex.
Vadzim Dambrouski [Wed, 24 May 2017 15:08:30 +0000 (15:08 +0000)]
[MSP430] Fix PR33050: Don't use ADD16ri to lower FrameIndex.

Use ADDframe pseudo instruction instead.
This will fix machine verifier error, and will help to fix PR32146.

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

llvm-svn: 303758

7 years ago[sanitizer] [SystemZ] Update CVE-2016-2143 check for Ubuntu 16.04
Ulrich Weigand [Wed, 24 May 2017 15:06:33 +0000 (15:06 +0000)]
[sanitizer] [SystemZ] Update CVE-2016-2143 check for Ubuntu 16.04

The Ubuntu 16.04 kernel contains a backport of the CVE check
starting with version 4.4.0-13.  Update FixedCVE_2016_2143.

llvm-svn: 303757

7 years agoDriver must return non-zero code on errors in command line
Serge Pavlov [Wed, 24 May 2017 14:57:17 +0000 (14:57 +0000)]
Driver must return non-zero code on errors in command line

This is recommit of r302775, reverted in r302777 due to a fail in
clang-tidy. Original mesage is below.

Now if clang driver is given wrong arguments, in some cases it
continues execution and returns zero code. This change fixes this
behavior.

The fix revealed some errors in clang test set.

File test/Driver/gfortran.f90 added in r118203 checks forwarding
gfortran flags to GCC. Now driver reports error on this file, because
the option -working-directory implemented in clang differs from the
option with the same name implemented in gfortran, in clang the option
requires argument, in gfortran does not.

In the file test/Driver/arm-darwin-builtin.c clang is called with
options -fbuiltin-strcat and -fbuiltin-strcpy. These option were removed
in r191435 and now clang reports error on this test.

File arm-default-build-attributes.s uses option -verify, which is not
supported by driver, it is cc1 option.

Similarly, the file split-debug.h uses options -fmodules-embed-all-files
and -fmodule-format=obj, which are not supported by driver.

Other revealed errors are mainly mistypes.

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

llvm-svn: 303756

7 years ago[InstCombine] add tests to show potential missing folds; NFC
Sanjay Patel [Wed, 24 May 2017 14:56:51 +0000 (14:56 +0000)]
[InstCombine] add tests to show potential missing folds; NFC

As noted in https://bugs.llvm.org/show_bug.cgi?id=33138 and
the comments, there are multiple ways to view this. If we
choose not to solve this in InstCombine, these tests will
serve as documentation of that choice.

llvm-svn: 303755

7 years agoRevert "AMDGPU: Fold CI-specific complex SMRD patterns into existing complex patterns"
Marek Olsak [Wed, 24 May 2017 14:53:50 +0000 (14:53 +0000)]
Revert "AMDGPU: Fold CI-specific complex SMRD patterns into existing complex patterns"

This reverts commit e065977c4b5f68ab845400b256f6a3822b1325fa.

It doesn't work. S_LOAD_DWORD_IMM_ci and friends aren't selected by any of
the patterns, so it was putting 32-bit literals into the 8-bit field.

llvm-svn: 303754

7 years agoGeneralize two diagnostic messages to take function name as parameter.
Tony Jiang [Wed, 24 May 2017 14:45:57 +0000 (14:45 +0000)]
Generalize two diagnostic messages to take function name as parameter.

llvm-svn: 303753