Commit Graph

145789 Commits

Author SHA1 Message Date
Diana Picus
568082bafe [ARM] GlobalISel: Add mapping for G_CONSTANT
Like G_FRAME_INDEX, G_CONSTANT has one register operand and one non-register
operand.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296469 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28 12:13:58 +00:00
Diana Picus
e855e8c475 [ARM] GlobalISel: Legalize 32-bit constants
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296468 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28 11:33:46 +00:00
Sanne Wouda
ff6c8c50fe [Assembler] Add test for !srcloc references in assembler diags
Summary:
clang adds !srcloc metadata to inline assembly in LLVM bitcode generated
for inline assembly in C.  The value of this !srcloc is passed to the
diagnostics handler if the inline assembly generates a diagnostic.
clang is able to turn this cookie back to a location in the C source
file.

To test this functionality without a dependency, make llc print the
!srcloc metadata if it is present.  The added test uses this mechanism
to test that the correct !srclocs are passed to the diag handler.

Reviewers: rengolin, rnk, echristo, grosbach, mehdi_amini

Reviewed By: mehdi_amini

Subscribers: mehdi_amini, llvm-commits

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296465 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28 10:34:48 +00:00
NAKAMURA Takumi
aff6eee0bb Reformat a blank line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296464 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28 10:15:25 +00:00
NAKAMURA Takumi
dd9073138b Revert r296442 (and r296443), "Allow externally dlopen-ed libraries to be registered as permanent libraries."
It broke clang/test/Analysis/checker-plugins.c

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296463 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28 10:15:18 +00:00
Diana Picus
77b493ab59 [ARM] GlobalISel: Select G_GEP
At this point, G_GEP is just an add, so we treat it exactly like a G_ADD.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296462 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28 10:14:38 +00:00
Oliver Stannard
c492675c31 [ARM] Diagnose PC-writing instructions in IT blocks
In Thumb2, instructions which write to the PC are UNPREDICTABLE if they are in
an IT block but not the last instruction in the block.

Previously, we only diagnosed this for LDM instructions, this patch extends the
diagnostic to cover all of the relevant instructions.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296459 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28 10:04:36 +00:00
Diana Picus
76b7c3efa9 [ARM] GlobalISel: Add reg bank mapping for G_GEP
This should be the same as the mapping for G_ADD etc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296455 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28 09:35:10 +00:00
Diana Picus
761fac3e9b [ARM] GlobalISel: Legalize G_GEP with 32-bit offsets
At the moment we're only interested in GEPs for putting call parameters on the
stack, so we'll stick to 32-bit offsets.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296452 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28 09:02:42 +00:00
Artyom Skrobov
f14c2c66eb Relate the CHECK: lines to the functions that they're checking [NFC]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296450 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28 08:58:40 +00:00
Vadzim Dambrouski
ca243b9232 Test commit, fix typo, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296447 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28 08:27:43 +00:00
Chandler Carruth
bff5a6eea5 [IR] Add range accessors for the indices of a GEP instruction.
These were noticed as missing in a code review. Add them and the boring
unit test to make sure they compile and DTRT.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296444 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28 08:04:20 +00:00
Vassil Vassilev
925071a16e Fix Win bots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296443 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28 07:26:21 +00:00
Vassil Vassilev
5951ab5b7a Allow externally dlopen-ed libraries to be registered as permanent libraries.
This is also useful in cases when llvm is in a shared library. First we dlopen
the llvm shared library and then we register it as a permanent library in order
to keep the JIT and other services working.

Patch reviewed by Vedant Kumar (D29955)!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296442 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28 07:11:59 +00:00
Sanjoy Das
9868da3b2d [ImplicitNullCheck] Add alias analysis usage
Summary:
With this change ImplicitNullCheck optimization uses alias analysis
and can use load/store memory access for implicit null check if there
are other load/store before but memory accesses do not alias.

Patch by Serguei Katkov!

Reviewers: sanjoy

Reviewed By: sanjoy

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296440 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28 07:04:49 +00:00
Xin Tong
623cc6d136 Empty line. NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296438 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28 05:30:48 +00:00
Xin Tong
c532709d03 [LoopUnswitch] Common pushing LIC's user to worklist.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296432 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28 03:32:41 +00:00
Matthias Braun
73ddbb7dff Revert "Add MIR-level outlining pass"
Revert Machine Outliner for now, as it breaks the asan bot.

This reverts commit r296418.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296426 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28 02:24:30 +00:00
Daniel Berlin
bd74a4c6a2 This script was meant to be committed with the DebugCounter changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296425 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28 02:19:11 +00:00
Lang Hames
97a1c1b90e [docs] Fix a think-o in the Programmer's Manual.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296421 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28 01:35:31 +00:00
Amaury Sechet
26e0beb683 Add test case for usubo combine. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296420 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28 01:16:39 +00:00
Matthias Braun
c043a889f1 Add MIR-level outlining pass
This is a patch for the outliner described in the RFC at:
http://lists.llvm.org/pipermail/llvm-dev/2016-August/104170.html

The outliner is a code-size reduction pass which works by finding
repeated sequences of instructions in a program, and replacing them with
calls to functions. This is useful to people working in low-memory
environments, where sacrificing performance for space is acceptable.

This adds an interprocedural outliner directly before printing assembly.
For reference on how this would work, this patch also includes X86
target hooks and an X86 test.

The outliner is run like so:

clang -mno-red-zone -mllvm -enable-machine-outliner file.c

Patch by Jessica Paquette<jpaquette@apple.com>!

rdar://29166825

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296418 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28 00:33:32 +00:00
Amaury Sechet
294da8f930 Add test case for computing known bits of substraction operations. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296417 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28 00:15:13 +00:00
Michael Kuperstein
1872f69aec [CGP] Split some critical edges coming out of indirect branches
Splitting critical edges when one of the source edges is an indirectbr
is hard in general (because it requires changing the memory the indirectbr
reads). But if a block only has a single indirectbr predecessor (which is
the common case), we can simulate splitting that edge by splitting
the destination block, and retargeting the *direct* branches.

This is motivated by the use of computed gotos in python 2.7: PyEval_EvalFrame()
ends up using an indirect branch with ~100 successors, and passing a constant to
each of those. Since MachineSink can't break indirect critical edges on demand
(and doing this in MIR doesn't look feasible), this causes us to emit about ~100
defs of registers containing constants, which we in the predecessor block, where
only one of those constants is used in each successor. So, at each computed goto,
we needlessly spill about a 100 constants to stack. The end result is that a
clang-compiled python interpreter can be about ~2.5x slower on a simple python
reduction loop than a gcc-compiled interpreter.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296416 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28 00:11:34 +00:00
Zachary Turner
d9b4aa7542 [PDB] Make streams carry their own endianness.
Before the endianness was specified on each call to read
or write of the StreamReader / StreamWriter, but in practice
it's extremely rare for streams to have data encoded in
multiple different endiannesses, so we should optimize for the
99% use case.

This makes the code cleaner and more general, but otherwise
has NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296415 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28 00:04:07 +00:00
Eugene Zelenko
01609a325b [DebugInfo] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296413 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 23:43:14 +00:00
Michael Kuperstein
3ee59b3779 [SLP] Load sorting should not try to sort things that aren't loads.
We may get a VL where the first element is a load, but the others
aren't. Trying to sort such VLs can only lead to sorrow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296411 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 23:18:11 +00:00
Dan Gohman
4b87fbfe6e [MC] Implement the COFF directives in MCNullStreamer.
This fixes -filetype=null errors introduced in r296403.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296410 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 23:10:18 +00:00
Matt Arsenault
f5567ad95f AMDGPU: Basic folds for fmed3 intrinsic
Constant fold, canonicalize constants to RHS,
reduce to minnum/maxnum when inputs are nan/undef.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296409 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 23:08:49 +00:00
Zachary Turner
d6b8f75da3 Remove some code accidentally left in.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296407 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 22:57:32 +00:00
Petr Hosek
79f9f67f4b [AddressSanitizer] Put shadow at 0 for Fuchsia
The Fuchsia ASan runtime reserves the low part of the address space.

Patch by Roland McGrath

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296405 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 22:49:37 +00:00
Eugene Zelenko
90d9920fc9 [CodeGen] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296404 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 22:45:06 +00:00
Dan Gohman
d5cb2d625b [MC] Factor out non-COFF handling of COFF-specific directives.
Instead of requiring every non-COFF MCObjectStreamer to implement the
COFF hooks just to do an llvm_unreachable to say that they're not
supported, do the llvm_unreachable in the default implementation, as
suggested by rnk in https://reviews.llvm.org/D26722.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296403 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 22:44:37 +00:00
Dan Gohman
6d8f20c219 [WebAssembly] Add some comments and tidy up whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296402 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 22:41:39 +00:00
Matt Arsenault
dd2186aaab AMDGPU: Use v_med3_{f16|i16|u16}
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296401 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 22:40:39 +00:00
Dan Gohman
a746da8ffc [WebAssembly] Split CFG-sorting into its own pass. NFC.
CFG sorting was already an independent algorithm from block/loop insertion;
this change makes it more convenient to debug.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296399 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 22:38:58 +00:00
Hans Wennborg
b03535ccf2 Revert r296366 "[InlineFunction] add nonnull assumptions based on argument attributes"
It causes miscompiles e.g. during self-host of Clang (PR32082).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296398 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 22:33:02 +00:00
Zachary Turner
533bd5a785 Add missing namespace qualifier.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296397 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 22:17:50 +00:00
Matt Arsenault
27f4f2f4bc AMDGPU: Support v2i16/v2f16 packed operations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296396 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 22:15:25 +00:00
Arnold Schwaighofer
e4e218c802 ISel: We need to notify FastIS of the IMPLICIT_DEF we created in createSwiftErrorEntriesInEntryBlock
Otherwise, it will insert instructions before it.

rdar://30536186

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296395 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 22:12:06 +00:00
Zachary Turner
2219387eaf [PDB] Partial resubmit of r296215, which improved PDB Stream Library.
This was reverted because it was breaking some builds, and
because of incorrect error code usage.  Since the CL was
large and contained many different things, I'm resubmitting
it in pieces.

This portion is NFC, and consists of:

1) Renaming classes to follow a consistent naming convention.
2) Fixing the const-ness of the interface methods.
3) Adding detailed doxygen comments.
4) Fixing a few instances of passing `const BinaryStream& X`.  These
   are now passed as `BinaryStreamRef X`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296394 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 22:11:43 +00:00
Matt Arsenault
68c622048b Revert "DAG: Check if extract_vector_elt is legal or custom"
This reverts r295782. This could potentially result in some
legalization loops and I avoided the need for this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296393 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 21:59:07 +00:00
Xin Tong
5784902db5 Empty line. NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296392 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 21:51:48 +00:00
Rong Xu
676fd3131a [PGO] Fix a bug in reading text format value profile.
Summary: Should use the Valuekind read from the profile.

Reviewers: davidxl

Reviewed By: davidxl

Subscribers: llvm-commits, xur

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296391 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 21:42:39 +00:00
Sanjay Patel
2c5b9e376b [ARM] don't transform an add(ext Cond), C to select unless there's a setcc of the condition
The transform in question claims to be doing:

// fold (add (select cc, 0, c), x) -> (select cc, x, (add, x, c))

...starting in PerformADDCombineWithOperands(), but it wasn't actually checking for a setcc node
for the sext/zext patterns.

This is exactly the opposite of a transform I'd like to add to DAGCombiner's foldSelectOfConstants(),
so I was seeing infinite loops with my draft of a patch applied.

The changes in select_const.ll look positive (less instructions). The change in arm-and-tst-peephole.ll
is unrelated. We're changing the input IR in that test to preserve the intent of the test, but that's 
not affected by this code change.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296389 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 21:30:54 +00:00
Lang Hames
530cc1a7c8 [Support][Error] Add a 'cantFail' utility function for known-safe calls to
fallible functions.

Some fallible functions (those returning Error or Expected<T>) may only fail
for a subset of their inputs. For example, a "safe" square root function will
succeed for all finite positive inputs:

  Expected<double> safeSqrt(double d) {
    if (d < 0 && !isnan(d) && !isinf(d))
      return make_error<...>("Cannot sqrt -ve values, nans or infs");
    return sqrt(d);
  }

At a safe callsite for such a function, checking the error return value is
redundant:

  if (auto ValOrErr = safeSqrt(42.0)) {
    // use *ValOrErr.
  } else
    llvm_unreachable("safeSqrt should always succeed for +ve values");

The cantFail function wraps this check and extracts the contained value,
simplifying control flow:

  double Result = cantFail(safeSqrt(42.0));

This function should be used with care: it is a programmatic error to wrap a
call with cantFail if it can in fact fail. For debug builds this will
result in llvm_unreachable being called. For release builds the behavior is
undefined.

Use of this function is likely to be rare in library code, but more common
for tool and unit-test code where inputs and mock functions may be known to be
safe.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296384 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 21:09:47 +00:00
Matt Arsenault
563a987b91 AMDGPU: Add some of the new gfx9 VOP3 instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296382 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 21:04:41 +00:00
Simon Pilgrim
e9bce87a93 [X86][SSE] Attempt to extract vector elements through target shuffles
DAGCombiner already supports peeking thorough shuffles to improve vector element extraction, but legalization often leaves us in situations where we need to extract vector elements after shuffles have already been lowered.

This patch adds support for VECTOR_EXTRACT_ELEMENT/PEXTRW/PEXTRB instructions to attempt to handle target shuffles as well. I've covered some basic scenarios including handling shuffle mask scaling and the implicit zero-extension of PEXTRW/PEXTRB, there is more that could be done here (that I've mentioned in TODOs) but I haven't found many cases where its worth it.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296381 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 21:01:57 +00:00
Matt Arsenault
a4e4156e12 AMDGPU: Support inlineasm for packed instructions
Add packed types as legal so they may be used with inlineasm.
Keep all operations expanded for now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296379 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 20:52:10 +00:00
Alexey Bataev
5c641cd1c6 [SLP] Use different flags in tests for reduction ops and extra args.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296376 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 20:22:44 +00:00