Commit Graph

137934 Commits

Author SHA1 Message Date
Michael Kuperstein
2a93bda6e9 [CGP] Be less conservative about tail-duplicating a ret to allow tail calls
CGP tail-duplicates rets into blocks that end with a call that feed the ret.
This puts the call in tail position, potentially allowing the DAG builder to
lower it as a tail call. To avoid tail duplication in cases where we won't
form the tail call, CGP tried to predict whether this is going to be possible,
and avoids doing it when lowering as a tail call will definitely fail.
However, it was being too conservative by always throwing away calls to
functions with a signext/zeroext attribute on the return type.

Instead, we can use the same logic the builder uses to determine whether the
attributes work out.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280894 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-08 00:48:37 +00:00
Justin Lebar
6d2157da81 [AA] Fix typo in comment (s/hase/has).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280893 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-08 00:48:12 +00:00
Dean Michael Berris
0b559dd7d3 [XRay] Remove unused variable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280891 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-08 00:38:22 +00:00
Dean Michael Berris
339ade73a0 [XRay] ARM 32-bit no-Thumb support in LLVM
This is a port of XRay to ARM 32-bit, without Thumb support yet. The XRay instrumentation support is moving up to AsmPrinter.
This is one of 3 commits to different repositories of XRay ARM port. The other 2 are:

1. https://reviews.llvm.org/D23932 (Clang test)
2. https://reviews.llvm.org/D23933 (compiler-rt)

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280888 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-08 00:19:04 +00:00
Piotr Padlewski
1d54212d16 Deleted right file
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280887 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 23:46:52 +00:00
Piotr Padlewski
6037ae7f26 Revert "[thinlto] Deleted unused test file"
This reverts commit a7ad004600.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280886 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 23:46:50 +00:00
Peter Collingbourne
1c13d2b2d2 IR: Remove Value::intersectOptionalDataWith, replace all calls with calls to Instruction::andIRFlags.
The two functions are functionally equivalent.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280884 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 23:39:04 +00:00
Vitaly Buka
f555e2686a Revert "[asan] Avoid lifetime analysis for allocas with can be in ambiguous state"
Fails on Windows.

This reverts commit r280880.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280883 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 23:37:15 +00:00
Piotr Padlewski
a7ad004600 [thinlto] Deleted unused test file
Summary:
This file should be referenced from
thinlto-function-summary-callgraph-pgo.ll file,
but someone forgot to use it there. Everything worked because
we store pgo data about callsite blocks, so there is no need to have
pgo count of @func.

Reviewers: tejohnson, eraman, mehdi_amini

Subscribers: mehdi_amini, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280882 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 23:35:46 +00:00
Vitaly Buka
f8002f1611 [asan] Avoid lifetime analysis for allocas with can be in ambiguous state
Summary:
C allows to jump over variables declaration so lifetime.start can be
avoid before variable usage. To avoid false-positives on such rare cases
we detect them and remove from lifetime analysis.

PR27453
PR28267

Reviewers: eugenis

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280880 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 23:18:23 +00:00
Sanjay Patel
774d87e2ea [InstCombine] use m_APInt to allow icmp (and (sh X, Y), C2), C1 folds for splat constant vectors
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280873 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 22:33:03 +00:00
Justin Lebar
f0bb43fb8e [CUDA] Rework "optimizations" and "publication" section in CompileCudaWithLLVM.rst.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280869 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 21:46:53 +00:00
Justin Lebar
667609507f [CUDA] Clarify that -l and -L only need to be passed when linking, in CompileCudaWithLLVM.rst.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280868 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 21:46:49 +00:00
Justin Lebar
70425af25f [CUDA] Further reformat "invoking clang" section of CompileCudaWithLLVM.rst.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280867 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 21:46:21 +00:00
Hal Finkel
9e7800b23b [SimplifyCFG] Don't try to create metadata-valued PHIs
We can't create metadata-valued PHIs; don't try to do so when sinking.

I created a test case for this using the @llvm.type.test intrinsic, because it
takes a metadata parameter and does not have severe side effects (thus
SimplifyCFG is willing to otherwise sink it).

Previously, running the test case would crash with:

  Invalid use of metadata!
    %.sink = select i1 %flag, metadata <...>, metadata <0x4e45dc0>
  LLVM ERROR: Broken function found, compilation aborted!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280866 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 21:38:22 +00:00
Haicheng Wu
16d3f8855e [LoopUnroll] Correct a debug message. NFC.
Differential Revision: https://reviews.llvm.org/D24299

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280865 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 21:30:16 +00:00
Elena Demikhovsky
22c45e1b0a Shift-left (ISD::SHL) operation crashes on "DAG Legalization" phase.
https://llvm.org/bugs/show_bug.cgi?id=29058.

While node legalization we tried to legalize its operands.
If an operand node is replaced during legalization the user node may be destroyed.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280862 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 20:54:33 +00:00
Sanjay Patel
350a7a4120 [InstCombine] allow icmp (and X, C2), C1 folds for splat constant vectors
This is a revert of r280676 which was a revert of r280637;
ie, this is r280637 again. It was speculatively reverted to
help debug buildbot failures.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280861 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 20:50:44 +00:00
Justin Lebar
5b033da95a [CUDA] Fix typo in link in CompileCudaWithLLVM.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280859 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 20:42:24 +00:00
Justin Lebar
e61b182c68 [CUDA] Move AXPY example into gist.
No need to have a long inline code snippet in this doc.

Also move "flags that control numerical code" underneath the "invoking
clang" section, and reformat things a bit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280857 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 20:37:41 +00:00
Krzysztof Parzyszek
4ecf8b9ba3 [RDF] Fix liveness analysis for phi nodes with shadow uses
Shadow uses need to be analyzed together, since each individual shadow
will only have a partial reaching def. All shadows together may cover
a given register ref, while each individual shadow may not.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280855 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 20:37:05 +00:00
Michael Kuperstein
9c0826c800 Don't reuse a variable name in a nested scope. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280853 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 20:29:49 +00:00
Krzysztof Parzyszek
80708afe43 [RDF] Introduce "undef" flag for ref nodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280851 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 20:10:56 +00:00
Justin Lebar
f1708bca49 [CUDA] Simplify build/install instructions in CompileCudaWithLLVM.rst.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280850 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 20:09:53 +00:00
Justin Lebar
188c78b94e [CUDA] Call it "CUDA", not "CUDA C/C++" in our docs.
CUDA is an extension to C++ -- there is no such thing as "CUDA C".  But
also, the language is much more commonly called "CUDA" than "CUDA C++".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280849 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 20:09:50 +00:00
Justin Lebar
78e95faf4b [CUDA] Expand upon --cuda-gpu-arch flag in CompileCudaWithLLVM doc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280848 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 20:09:46 +00:00
Wei Mi
a804c5a9aa Rename test pr30298.ll to shrink_vmul_sse.ll, to make the name more meaningful, NFC.
Add PR number and comment in pr30298.ll to explain what is testing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280843 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 18:46:15 +00:00
Yaxun Liu
145ae71240 AMDGPU: Remove a useless variable which caused build failure for lld.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280841 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 18:31:11 +00:00
Wei Mi
ebe55c6a3e Don't reduce the width of vector mul if the target doesn't support SSE2.
The patch is to fix PR30298, which is caused by rL272694. The solution is to
bail out if the target has no SSE2.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280837 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 18:22:17 +00:00
Hans Wennborg
9107e64bb5 Add more triple to conditional-tailcall.ll test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280835 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 18:19:31 +00:00
Chad Rosier
371bac0453 Typo. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280834 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 18:15:12 +00:00
Saleem Abdulrasool
c4c2318e72 CodeGen: ensure that libcalls are always AAPCS CC
The original commit was too aggressive about marking LibCalls as AAPCS.  The
libcalls contain libc/libm/libunwind calls which are not AAPCS, but C.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280833 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 17:56:09 +00:00
Hans Wennborg
4a83266436 X86: Fold tail calls into conditional branches where possible (PR26302)
When branching to a block that immediately tail calls, it is possible to fold
the call directly into the branch if the call is direct and there is no stack
adjustment, saving one byte.

Example:

  define void @f(i32 %x, i32 %y) {
  entry:
    %p = icmp eq i32 %x, %y
    br i1 %p, label %bb1, label %bb2
  bb1:
    tail call void @foo()
    ret void
  bb2:
    tail call void @bar()
    ret void
  }

before:

  f:
          movl    4(%esp), %eax
          cmpl    8(%esp), %eax
          jne     .LBB0_2
          jmp     foo
  .LBB0_2:
          jmp     bar

after:

  f:
          movl    4(%esp), %eax
          cmpl    8(%esp), %eax
          jne     bar
  .LBB0_1:
          jmp     foo

I don't expect any significant size savings from this (on a Clang bootstrap I
saw 288 bytes), but it does make the code a little tighter.

This patch only does 32-bit, but 64-bit would work similarly.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280832 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 17:52:14 +00:00
Davide Italiano
fab897dd11 [lib/LTO] Add a way to run a custom pipeline
Differential Revision:  https://reviews.llvm.org/D24095

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280830 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 17:46:16 +00:00
Yaxun Liu
6874fa846b AMDGPU: Add hidden kernel arguments to runtime metadata
OpenCL kernels have hidden kernel arguments for global offset and printf buffer. For consistency, these hidden argument should be included in the runtime metadata. Also updated kernel argument kind metadata.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280829 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 17:44:00 +00:00
Reid Kleckner
eadc14fcd6 [codeview] Add new directives to record inlined call site line info
Summary:
Previously we were trying to represent this with the "contains" list of
the .cv_inline_linetable directive, which was not enough information.
Now we directly represent the chain of inlined call sites, so we know
what location to emit when we encounter a .cv_loc directive of an inner
inlined call site while emitting the line table of an outer function or
inlined call site. Fixes PR29146.

Also fixes PR29147, where we would crash when .cv_loc directives crossed
sections. Now we write down the section of the first .cv_loc directive,
and emit an error if any other .cv_loc directive for that function is in
a different section.

Also fixes issues with discontiguous inlined source locations, like in
this example:

  volatile int unlikely_cond = 0;
  extern void __declspec(noreturn) abort();
  __forceinline void f() {
    if (!unlikely_cond) abort();
  }
  int main() {
    unlikely_cond = 0;
    f();
    unlikely_cond = 0;
  }

Previously our tables gave bad location information for the 'abort'
call, and the debugger wouldn't snow the inlined stack frame for 'f'.
It is important to emit good line tables for this code pattern, because
it comes up whenever an asan bug occurs in an inlined function. The
__asan_report* stubs are generally placed after the normal function
epilogue, leading to discontiguous regions of inlined code.

Reviewers: majnemer, amccarth

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280822 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 16:15:31 +00:00
Chad Rosier
452b6b26eb [LoopInterchange] Improve debug output. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280820 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 16:07:17 +00:00
Chad Rosier
e760d89ddf [LoopInterchange] Improve debug output. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280819 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 15:56:59 +00:00
Justin Lebar
600740bf18 [LSV] Use the original loads' names for the extractelement instructions.
Summary:
LSV replaces multiple adjacent loads with one vectorized load and a
bunch of extractelement instructions.  This patch makes the
extractelement instructions' names match those of the original loads,
for (hopefully) improved readability.

Reviewers: asbirlea, tstellarAMD

Subscribers: arsenm, mzolotukhin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280818 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 15:49:48 +00:00
Sanjay Patel
05601b46da [x86] move combines of 'select of 2 constants' to its own function; NFC
There are missing folds here and possibly folds that could be made generic.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280817 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 15:47:34 +00:00
Simon Pilgrim
0639c00041 Fix typo in test - it should be masking bits0-15 not bit16
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280816 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 15:19:07 +00:00
Andrea Di Biagio
959abb8a67 Regenerate vector bitcast folding tests using update_test_checks.py.
Two tests have been merged together, regenerated and then moved to
a more appropriate directory. No functional change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280814 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 14:50:07 +00:00
Simon Pilgrim
56463ddaa2 [X86][SSE] Added or combine tests for known bits of vectors
Part of the yak shaving for D24253

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280813 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 14:49:50 +00:00
Simon Pilgrim
b362b6eae0 [X86][SSE] Added and+or+zext combine tests for known bits of vectors
Part of the yak shaving for D24253

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280810 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 14:00:52 +00:00
Simon Pilgrim
9313182d93 [X86][SSE] Added and+or combine tests currently failing with vectors
(and (or x, C), D) -> D if (C & D) == D

Part of the yak shaving for D24253

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280809 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 13:40:03 +00:00
Pablo Barrio
ba3ea4d3a9 [ARM] Lower UDIV+UREM to UDIV+MLS (and the same for SREM)
Summary:
This saves a library call to __aeabi_uidivmod. However, the
processor must feature hardware division in order to benefit from
the transformation.

Reviewers: scott-0, jmolloy, compnerd, rengolin

Subscribers: t.p.northover, compnerd, aemerson, rengolin, samparker, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280808 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 12:49:15 +00:00
Andrea Di Biagio
2fdf2bfd1f [InstCombine][SSE4a] Fix assertion failure in the insertq/insertqi combining logic.
This fixes a similar issue to the one already fixed by r280804
(revieved in D24256). Revision 280804 fixed the problem with unsafe dyn_casts
in the extrq/extrqi combining logic. However, it turns out that even the
insertq/insertqi logic was affected by the same problem.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280807 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 12:47:53 +00:00
Andrea Di Biagio
fd11478c26 [InstCombine][SSE4a] Fix assertion failure caused by unsafe dyn_casts on the operands of extrq/extrqi intrinsic calls.
This patch fixes an assertion failure caused by unsafe dynamic casts on the
constant operands of sse4a intrinsic calls to extrq/extrqi

The combine logic that simplifies sse4a extrq/extrqi intrinsic calls currently
checks if the input operands are constants. Internally, that logic relies on
dyn_casts of values returned by calls to method Constant::getAggregateElement.
However, method getAggregateElemet may return nullptr if the constant element
cannot be retrieved. So, all the dyn_casts can potentially fail. This is what
happens for example if a constexpr value is passed in input to an extrq/extrqi
intrinsic call.

This patch fixes the problem by using a dyn_cast_or_null (instead of a simple
dyn_cast) on the result of each call to Constant::getAggregateElement.

Added reproducible test cases to x86-sse4a.ll.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280804 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 12:03:03 +00:00
Renato Golin
17c896a4b9 Revert "[EfficiencySanitizer] Adds shadow memory parameters for 40-bit virtual memory address."
This reverts commit r280796, as it broke the AArch64 bots for no reason.

The tests were passing and we should try to keep them passing, so a proper
review should make that happen.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280802 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 10:54:42 +00:00
Vasileios Kalintiris
c7d75117d4 [mips] Disable the TImode shift libcalls for 32-bit targets.
Summary:
The o32 ABI doesn't not support the TImode helpers. For the time being,
disable just the shift libcalls as they break recursive builds on MIPS.

Reviewers: sdardis

Subscribers: llvm-commits, sdardis

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280798 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07 10:01:18 +00:00