135158 Commits

Author SHA1 Message Date
Ahmed Bougacha
3ce051383c [CodeGen] Simplify reg bank/class union is+get into dyn_cast. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275443 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 17:29:46 +00:00
Saleem Abdulrasool
4d45f1ed0d X86: handle external tail calls in Windows JIT
If there was a tail call, we would incorrectly handle the relocation.  It would
end up indexing into the array with an incorrect section id.  The symbol was
external to the module, so the Section ID was UNDEFINED (-1).  We would then
index the SmallVector with this ID, triggering an assertion.  Use the Value
rather than the section load address in this case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275442 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 17:27:06 +00:00
Justin Lebar
3eef3988f6 [CodeGen] s/constexpr/LLVM_CONSTEXPR/ in MachineMemOperand.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275441 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 17:16:40 +00:00
Sanjay Patel
e53b5c23a2 auto-generate checks
Note: I removed the checks after each jump because that's noise, but we apparently 
need branches rather than returning i1 to see the bt codegen in some cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275439 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 17:07:55 +00:00
Justin Lebar
f66cee6be5 [CodeGen] Refactor MachineMemOperand's Flags enum.
Summary:
- Give it a shorter name (because we're going to refer to it often from
  SelectionDAG and friends).

- Split the flags and alignment into separate variables.

- Specialize FlagsEnumTraits for it, so we can do bitwise ops on it
  without losing type information.

- Make some enum values constants in MachineMemOperand instead.
  MOMaxBits should not be a valid Flag.

- Simplify some of the bitwise ops for dealing with Flags.

Reviewers: chandlerc

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275438 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 17:07:44 +00:00
Tim Northover
5591e3d51d ARM: fix vmov.i64 immediate validity check
Typo meant we were only checking the low byte (repeatedly).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275437 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 17:04:34 +00:00
Tom Stellard
6e4b75df4f GlobalsAA: Functions with the argmemonly attribute won't read arbitrary globals
Summary:
In preparation for changing GlobalsAA to stop assuming that intrinsics
can't read arbitrary globals, we need to make sure GlobalsAA is querying
function attributes rather than relying on this assumption.

This patch was inspired by: http://reviews.llvm.org/D20206

Reviewers: jmolloy, hfinkel

Subscribers: eli.friedman, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275433 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 15:50:27 +00:00
Nico Weber
3d6b13fb1d Don't optimize movs to pushes in -O0 builds.
https://reviews.llvm.org/D22362


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275431 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 15:40:22 +00:00
Nico Weber
b19f420c44 Delete some trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275429 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 15:07:44 +00:00
Ahmed Bougacha
6a16f1b7e6 [X86] Decode MPX BND registers.
We were able to assemble, but not disassemble.

Note that fixupRMValue was truncating EA_REG_BND0-3 because we hit
the uint8_t max.  The control registers were already squarely above
it, but I don't think they ever go in .r/m, only in .reg.

I also did notice an extra REX.W in our encoding, but I think that's
fine.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275427 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 14:53:21 +00:00
Ahmed Bougacha
1ac61e2861 [X86] Don't mark addressing mode operands as "outs". NFC-ish.
Nothing in-tree can tell the difference, but it's incorrect: the
addressing mode registers aren't what's defined.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275426 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 14:53:17 +00:00
Ahmed Bougacha
27cc0cc039 [TableGen] Autobrief-ize Record. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275425 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 14:53:14 +00:00
Ahmed Bougacha
cf03606efc [TableGen] Cleanup Record comments. NFC.
LLVM doesn't use exceptions anymore.
Also remove the implementation comments. Some of them diverged.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275424 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 14:53:11 +00:00
Ahmed Bougacha
8b8511816c [GlobalISel] Fix #include ordering/spacing. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275423 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 14:52:55 +00:00
Sam Kolton
1c8103698f [AMDGPU] Assembler: fix row_bcast parsing
Summary: This change fix bug 28538

Reviewers: tstellarAMD, vpykhtin

Subscribers: arsenm, kzhuravl

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275422 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 14:50:35 +00:00
Nico Weber
e76c5af435 Revert r275411, it cause PR28552.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275421 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 14:49:35 +00:00
Nico Weber
037f8a7c73 Revert r275401, it caused PR28551.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275420 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 14:41:25 +00:00
Matthew Simpson
bc38653ff6 [LV] Avoid unnecessary IV scalar-to-vector-to-scalar conversions
This patch prevents increases in the number of instructions, pre-instcombine,
due to induction variable scalarization. An increase in instructions can lead
to an increase in the compile-time required to simplify the induction
variables. We now maintain a new map for scalarized induction variables to
prevent us from converting between the scalar and vector forms.

This patch should resolve compile-time regressions seen after r274627.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275419 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 14:36:06 +00:00
Nico Weber
cccdd2eff6 Teach fast isel calls and rets about stdcall.
stdcall is callee-pop like thiscall, so the thiscall changes already did most
of the work for this.  This change only opts stdcall in and adds tests.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275414 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 13:54:26 +00:00
Simon Pilgrim
0f2cee66f0 [X86][AVX] Added an additional vperm2f128 memory folding test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275413 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 13:40:53 +00:00
Simon Pilgrim
6c0d1b73b9 Remove trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275412 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 13:29:23 +00:00
Simon Pilgrim
3c493e725f [X86][AVX2] Allow VPERMPD/VPERMQ shuffles to call combineShuffle
This improves the situation discussed in D19228 where we were forcing VPERMPD/VPERMQ where VPERM2F128/VPERM2I128 would have been better.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275411 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 13:28:43 +00:00
Daniel Sanders
ce8041577b [mips] SelectionDAGISel subclasses now follow the optimization level.
Summary:
It was recently discovered that, for Mips's SelectionDAGISel subclasses,
all optimization levels caused SelectionDAGISel to behave like -O2.

This change adds the necessary plumbing to initialize the optimization level.

Reviewers: andrew.w.kaylor

Subscribers: andrew.w.kaylor, sdardis, dean, llvm-commits, vradosavljevic, petarj, qcolombet, probinson, dsanders

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275410 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 13:25:22 +00:00
Benjamin Kramer
1ab13082a4 Upgrade all the .arcconfigs to https.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275409 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 13:15:37 +00:00
Aaron Ballman
9e2c1ae466 Speculatively fix the sphinx build, which does not think the original code was valid nasm (http://lab.llvm.org:8011/builders/llvm-sphinx-docs/builds/11854/steps/docs-llvm-html/logs/stdio).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275408 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 13:08:16 +00:00
Simon Pilgrim
1625786e0f [X86][AVX] Add support for narrowing 128-bit+ shuffle mask elements to 64-bits to allow combining
Primarily this is to allow blend with zero instead of having to use vperm2f128, but we can use this in the future to deal with AVX512 cases where we need to keep the original element size to correctly fold masked operations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275406 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 12:58:04 +00:00
Sjoerd Meijer
4fab1d4f07 This converts a signed remainder instruction to unsigned remainder, which
enables the code size optimisation to fold a rem and div into a single
aeabi_uidivmod call. This was not happening before because sdiv was converted
but srem not, and instructions with different signedness are not combined.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275403 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 12:23:48 +00:00
Simon Pilgrim
2bb340ccad [X86][AVX] Add 128-bit wide shuffle tests that should combine to blend-with-zero
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275402 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 12:21:40 +00:00
Sebastian Pop
16129fc15d code hoisting pass based on GVN
This pass hoists duplicated computations in the program. The primary goal of
gvn-hoist is to reduce the size of functions before inline heuristics to reduce
the total cost of function inlining.

Pass written by Sebastian Pop, Aditya Kumar, Xiaoyu Hu, and Brian Rzycki.
Important algorithmic contributions by Daniel Berlin under the form of reviews.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275401 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 12:18:53 +00:00
Simon Pilgrim
2128e74875 [X86][AVX] Add VBROADCASTF128/VBROADCASTI128 shuffle comments support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275400 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 12:07:43 +00:00
Dean Michael Berris
f585634128 Remove extra ';' to appease -Wpedantic
Summary:

Reviewers: dok

Subscribers: llvm-commits

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275399 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 11:46:41 +00:00
Simon Pilgrim
5185c2b895 [X86][AVX] Regenerate broadcast upgrade tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275398 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 11:05:43 +00:00
Simon Pilgrim
b37f656d37 [X86][AVX2] VBROADCASTSSrr/VBROADCASTSSYrr require AVX2 not AVX
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275391 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 10:37:14 +00:00
Sjoerd Meijer
05488db23f This implements a more optimal algorithm for selecting a base constant in
constant hoisting. It not only takes into account the number of uses and the
cost of expressions in which constants appear, but now also the resulting
integer range of the offsets. Thus, the algorithm maximizes the number of uses
within an integer range that will enable more efficient code generation. On
ARM, for example, this will enable code size optimisations because less
negative offsets will be created. Negative offsets/immediates are not supported
by Thumb1 thus preventing more compact instruction encoding.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275382 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 07:44:20 +00:00
David Majnemer
84f3bec422 [InstCombine] Masked loads with undef masks can fold to normal loads
We were able to fold masked loads with an all-ones mask to a normal
load.  However, we couldn't turn a masked load with a mask with mixed
ones and undefs into a normal load.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275380 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 06:58:42 +00:00
David Majnemer
6d67ce109b Simplify llvm.masked.load w/ undef masks
We can always pick the passthru value if the mask is undef: we are
permitted to treat the mask as-if it were filled with zeros.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275379 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 06:58:37 +00:00
Craig Topper
cc0d731f3e [AVX512] Implement EXTLOAD lowering with patterns to select existing VPMOVZX instructions instead of creating CodeGenOnly instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275378 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 06:41:34 +00:00
Eli Friedman
940c90777f [X86] Fix stupid typo in isel lowering.
Apparently someone miscounted the number of zeros in the immediate.
Fixes https://llvm.org/bugs/show_bug.cgi?id=28544 .

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275376 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 05:48:25 +00:00
Matt Arsenault
4d120e9b24 AMDGPU/R600: Delete/rename intrinsics no longer used by mesa
Use the replacement pass to update the tests, and delete old names.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275375 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 05:47:17 +00:00
Matt Arsenault
04e6d2604d AMDGPU/R600: Remove intrinsics with no tests and no users
Mesa removed this path, so nothing is using these anymore.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275372 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 05:23:23 +00:00
Matt Arsenault
759af1e5a2 AMDGPU: Remove unused intrinsics
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275371 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 05:23:19 +00:00
Matt Arsenault
fb5f7807e0 AMDGPU: Fix test not actually testing anything
It wasn't actually running the pass, and since it is
missing the llvm prefix, the eh intrinsic was not
really an IntrinsicInst.

Also add missing test for lifetime markers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275370 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 05:23:15 +00:00
Matt Arsenault
5906ff8492 AMDGPU: Remove dead code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275369 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 05:23:08 +00:00
Dean Michael Berris
cee9af9136 XRay: Add entry and exit sleds
Summary:
In this patch we implement the following parts of XRay:

- Supporting a function attribute named 'function-instrument' which currently only supports 'xray-always'. We should be able to use this attribute for other instrumentation approaches.
- Supporting a function attribute named 'xray-instruction-threshold' used to determine whether a function is instrumented with a minimum number of instructions (IR instruction counts).
- X86-specific nop sleds as described in the white paper.
- A machine function pass that adds the different instrumentation marker instructions at a very late stage.
- A way of identifying which return opcode is considered "normal" for each architecture.

There are some caveats here:

1) We don't handle PATCHABLE_RET in platforms other than x86_64 yet -- this means if IR used PATCHABLE_RET directly instead of a normal ret, instruction lowering for that platform might do the wrong thing. We think this should be handled at instruction selection time to by default be unpacked for platforms where XRay is not availble yet.

2) The generated section for X86 is different from what is described from the white paper for the sole reason that LLVM allows us to do this neatly. We're taking the opportunity to deviate from the white paper from this perspective to allow us to get richer information from the runtime library.

Reviewers: sanjoy, eugenis, kcc, pcc, echristo, rnk

Subscribers: niravd, majnemer, atrick, rnk, emaste, bmakam, mcrosier, mehdi_amini, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275367 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 04:06:33 +00:00
Davide Italiano
fb51249413 [SCCP] Pass a Value * instead of templating this function. NFC.
Thanks to Eli for the suggestion!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275366 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 03:02:34 +00:00
Chris Lattner
ba1a49d759 clarify a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275364 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 02:52:04 +00:00
Davide Italiano
20837ca4c3 [IPSCCP] Constant fold struct argument/instructions when all the lattice values are constant.
This now should also work with the interprocedural variant of the pass.
Slightly easier now that the yak is shaved.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275363 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 02:51:41 +00:00
Lang Hames
aacf2fbfe4 [Object] Re-apply r275316 now that I have the corresponding LLD patch ready.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275361 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 02:24:01 +00:00
Nico Weber
0e9e4ecaa4 Teach fast isel about thiscall (and callee-pop) calls.
http://reviews.llvm.org/D22315


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275360 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 01:52:51 +00:00
Mehdi Amini
939d9e2b2f [Scalarizer] PR28108: Skip over nullptr rather than crashing on it.
Summary:
In Scalarizer::gather we see if we already have a scattered form of Op,
and in that case use the new form.

In the particular case of PR28108, the found ValueVector SV has size 2,
where the first Value is nullptr, and the second is indeed a proper Value.
The nullptr then caused an assert to blow when we tried to do
cast<Instruction>(SV[I]).

With this patch we check SV[I] before doing the cast, and if it's nullptr
we just skip over it.

I don't know the Scalarizer well enough to know if this is the best fix
or if something should be done else where to prevent the nullptr from
being in the ValueVector at all, but at least this avoids the crash
and looking at the test case output it looks reasonable.

Reviewers: hfinkel, frasercrmck, wala, mehdi_amini

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275359 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 01:31:25 +00:00