140241 Commits

Author SHA1 Message Date
Teresa Johnson
39970a7476 [ThinLTO] Correctly resolve linkonce when importing aliasee
Summary:
When we have an aliasee that is linkonce, while we can't convert
the non-prevailing copies to available_externally, we still need to
convert the prevailing copy to weak. If a reference to the aliasee
is exported, not converting a copy to weak will result in undefined
references when the linkonce is removed in its original module.

Add a new test and update existing tests.

Reviewers: mehdi_amini

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285512 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-30 05:15:23 +00:00
Craig Topper
0a87051e1f [X86] Don't use loadv2i64 on SSE version of PMULHRSW. Use memopv2i64 instead.
This bug was introduced in r285501.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285510 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-30 00:02:55 +00:00
NAKAMURA Takumi
37111b28b6 NativeFormatting.cpp: Fix build for mingw. Where would writePadding() be?
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285509 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-29 23:14:18 +00:00
Teresa Johnson
8108a04696 [ThinLTO] Rename doPromoteLocalToGlobal to shouldPromoteLocalToGlobal (NFC)
Rename as suggested in code review for D26063.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285508 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-29 21:52:23 +00:00
Teresa Johnson
8c54a79285 [ThinLTO] Use NoPromote flag in summary during promotion
Summary:
Replace the check of whether a GV has a section with the flag check
in the summary. This is in preparation for using the NoPromote flag
to convey other situations when we can't promote (e.g. locals used in
inline asm).

Reviewers: mehdi_amini

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285507 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-29 21:31:48 +00:00
Peter Collingbourne
22037077ec IR: Remove a no longer needed assert.
This assert was checking for a miscompile in a version of GCC that
we no longer support.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285506 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-29 20:57:12 +00:00
Craig Topper
c4589d7751 [X86] Use intrinsics table for VPMULHRSW intrincis so that the legacy intrinsics can select EVEX encoded instructions when available.
This requires a minor rename of the instructions due to the use of different tablegen classes and how the names are concatenated.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285501 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-29 18:41:45 +00:00
Sanjay Patel
14ebdf2999 [ValueTracking] recognize more variants of smin/smax
Try harder to detect obfuscated min/max patterns: the initial pattern was added with D9352 / rL236202. 
There was a bug fix for PR27137 at rL264996, but I think we can do better by folding the corresponding
smax pattern and commuted variants.

The codegen tests demonstrate the effect of ValueTracking on the backend via SelectionDAGBuilder. We
can't expose these differences minimally in IR because we don't have smin/smax intrinsics for IR.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285499 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-29 16:21:19 +00:00
Sanjay Patel
c69fe17c4b [x86] add tests for smin/smax matchSelPattern (D26091)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285498 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-29 16:02:57 +00:00
Sanjay Patel
9978e17243 [InstCombine] re-use bitcasted compare operands in selects (PR28001)
These mixed bitcast patterns show up with SSE/AVX intrinsics because we bitcast function parameters to <2 x i64>.

The bitcasts obfuscate the expected min/max forms as shown in PR28001:
https://llvm.org/bugs/show_bug.cgi?id=28001#c6

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285495 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-29 15:22:04 +00:00
Simon Pilgrim
6722cc3c8a [DAGCombiner] (REAPPLIED) Add vector demanded elements support to computeKnownBits
Currently computeKnownBits returns the common known zero/one bits for all elements of vector data, when we may only be interested in one/some of the elements.

This patch adds a DemandedElts argument that allows us to specify the elements we actually care about. The original computeKnownBits implementation calls with a DemandedElts demanding all elements to match current behaviour. Scalar types set this to 1.

The approach was found to be easier than trying to add a per-element known bits solution, for a similar usefulness given the combines where computeKnownBits is typically used.

I've only added support for a few opcodes so far (the ones that have proven straightforward to test), all others will default to demanding all elements but can be updated in due course.

DemandedElts support could similarly be added to computeKnownBitsForTargetNode in a future commit.

This looked like this had caused compile time regressions on some buildbots (and was reverted in rL285381), but appears to have just been a harmless bystander!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285494 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-29 11:29:39 +00:00
Elena Demikhovsky
2fd63302fe Fixed FMA + FNEG combine.
Masked form of FMA should be omitted in this optimization.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285492 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-29 08:44:46 +00:00
Matt Arsenault
ac5efca3f0 AMDGPU: Use 1/2pi inline imm on VI
I'm guessing at how it is supposed to be printed

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285490 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-29 04:05:06 +00:00
Matthias Braun
d75f7ecb9b AArch64DeadRegisterDefinitionsPass: Cleanup; NFC
- Fix doxygen file comment
- reduce indentation in loop
- Factor out some common subexpressions
- Move independent helper function out of class
- Fix Changed flag (this is not strictly NFC but a bugfix, but the flag
  seems ignored anyway)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285488 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-29 01:03:41 +00:00
Rui Ueyama
33eabd982e Define calculateDbgStreamSize for consistency.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285487 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-29 00:56:44 +00:00
Tim Shen
b7f36bcf55 [APFloat] Remove the redundent function body of uninitialized ctor, which should be done in r285468
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285486 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-29 00:51:41 +00:00
Zachary Turner
b53c2b0d14 Resubmit "Add support for advanced number formatting."
This resubmits r284436 and r284437, which were reverted in
r284462 as they were breaking the AArch64 buildbot.

The breakage on AArch64 turned out to be a miscompile which is
still not fixed, but is actively tracked at llvm.org/pr30748.

This resubmission re-writes the code in a way so as to make the
miscompile not happen.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285483 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-29 00:27:22 +00:00
Rui Ueyama
d5b5d46b95 Do not print out Flags field twice.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285481 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 23:57:37 +00:00
Davide Italiano
c5763946b3 [DAGCombiner] Fix a crash visiting AND nodes.
Instead of asserting that the shift count is != 0 we just bail out
as it's not profitable trying to optimize a node which will be
removed anyway.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285480 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 23:55:32 +00:00
Tom Stellard
b15bbca10c AMDGPU/SI: Don't use non-0 waitcnt values when waiting on Flat instructions
Summary:
Flat instruction can return out of order, so we need always need to wait
for all the outstanding flat operations.

Reviewers: tony-tye, arsenm

Subscribers: kzhuravl, wdng, nhaehnle, llvm-commits, yaxunl

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285479 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 23:53:48 +00:00
Matt Arsenault
0f0ebbd2d9 AMDGPU: Fix instruction flags for s_endpgm
Set isReturn, remove hasSideEffects. Also remove
hasCtrlDep, I'm not really sure what that does.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285476 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 23:00:38 +00:00
Adrian Prantl
214910706d Refactor DW_LNE_* into Dwarf.def
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285475 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 22:57:02 +00:00
Adrian Prantl
64660bf6ba Refactor DW_LNS_* into Dwarf.def
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285474 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 22:56:59 +00:00
Adrian Prantl
832e271e1a Refactor DW_APPLE_PROPERTY_* into Dwarf.def
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285473 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 22:56:56 +00:00
Adrian Prantl
3807607f5e Refactor DW_CFA_* into Dwarf.def
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285472 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 22:56:53 +00:00
Adrian Prantl
73525b920d Remove whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285471 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 22:56:50 +00:00
Adrian Prantl
b292fb2c9b Refactor all DW_FORM_* constants into Dwarf.def
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285470 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 22:56:45 +00:00
Tim Shen
88ccb3e4ac [APFloat] Fix memory bugs revealed by MSan
Reviewers: eugenis, hfinkel, kbarton, iteratee, echristo

Subscribers: mehdi_amini, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285468 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 22:45:33 +00:00
Justin Bogner
342cdd89ce SDAG: Make sure we use an allocatable reg class when we create this vreg
As per the discussion on r280783, if constrainRegClass fails we need
to call getAllocatableClass like we did before that commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285467 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 22:42:54 +00:00
Kostya Serebryany
51fb510623 [libFuzzer] mention one more trophie
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285465 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 22:03:54 +00:00
Justin Lebar
27d02ea698 Add missing lit.local.cfg to llvm/test/Transforms/CodeGenPrepare/NVPTX.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285464 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 21:56:07 +00:00
Matt Arsenault
d6028cdcc7 AMDGPU: Add definitions for scalar store instructions
Also add glc bit to the scalar loads since they exist on VI
and change the caching behavior.

This currently has an assembler bug where the glc bit is incorrectly
accepted on SI/CI which do not have it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285463 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 21:55:15 +00:00
Matt Arsenault
be4e1c4eb0 AMDGPU: Rename glc operand type
While trying to add the glc bit to SMEM instructions on VI
with the new refactoring I ran into some kind of shadowing
problem for the glc operand when using the pseudoinstruction
as a multiclass parameter.

Everywhere that currently uses it defines the operand to have the same
name as its type, i.e. glc:$glc which works. For some reason now it
conflicts, and its up evaluating to the wrong thing. For the
real encoding classes,

let Inst{16} = !if(ps.has_glc, glc, ?); was not being evaluated
and still visible in the Inst initializer in the expanded td file.
In other cases I got a a different error about an illegal operand
where this was using { 0 } initializer from the bits<1> glc initializer
instead of evaluating it as false in the if.

For consistency all of the operand types should probably
be captialized to avoid conflicting with the variable names
unless somebody has a better idea of how to fix this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285462 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 21:55:08 +00:00
Justin Lebar
30c499dfda [NVPTX] Compute 'rem' using the result of 'div', if possible.
Summary:
In isel, transform

  Num % Den

into

  Num - (Num / Den) * Den

if the result of Num / Den is already available.

Reviewers: tra

Subscribers: hfinkel, llvm-commits, jholewinski

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285461 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 21:44:00 +00:00
Justin Lebar
f644e7b00f Don't leave unused divs/rems sitting around in BypassSlowDivision.
Summary:
This "pass" eagerly creates div and rem instructions even when only one
is needed -- it relies on a later pass (machine DCE?) to clean them up.

This is problematic not just from a cleanliness perspective (this pass
is running during CodeGenPrepare, so should leave the IR in a better
state), but it also creates a problem for instruction selection.  If we
always have a div+rem, isel will always select a divrem instruction (if
possible), even when a single div or rem would do.

Specifically, in NVPTX, we want to compute rem from the output of div,
if available.  But if a div is not available, we want to leave the rem
alone.  This transformation is overeager if div is always available.

Because this code runs as part of CodeGenPrepare, it's nontrivial to
write a test for this change.  But this will effectively be tested by
a later patch which adds the aforementioned change to NVPTX isel.

Reviewers: tra

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285460 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 21:43:54 +00:00
Justin Lebar
9488f1f527 Don't claim the udiv created in BypassSlowDivision is exact.
Summary:
In BypassSlowDivision's short-dividend path, we would create e.g.

  udiv exact i32 %a, %b

"exact" here means that we are asserting that %a is a multiple of %b.
But we have no reason to believe this must be true -- this is just a
bug, as far as I can tell.

Reviewers: tra

Subscribers: jholewinski, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285459 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 21:43:51 +00:00
Justin Bogner
10df7e9f9c cmake: Enable the lto cache when building with -flto=thin on darwin
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285450 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 20:48:47 +00:00
Matt Arsenault
0e18bbf16a AMDGPU: Change check prefix in test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285449 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 20:33:01 +00:00
Adrian Prantl
a6548193d8 Fix a copy&paste error in the macro definition for HANDLE_DW_MACRO and
HANDLE_DE_RLE. Caught by the LLDB build bot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285448 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 20:32:17 +00:00
Matt Arsenault
6cabc8f486 AMDGPU: Diagnose using too many SGPRs
This is possible when using inline asm.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285447 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 20:31:47 +00:00
Adrian Prantl
7dcc2cb961 Remove redundant prefixes from constants and unbreak the LLDB bots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285444 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 20:18:26 +00:00
Tim Shen
b3c6b68166 [APFloat] Use std::move() in move assignment operator
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285442 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 20:13:06 +00:00
Krzysztof Parzyszek
1adbd7e4f5 Handle non-~0 lane masks on live-in registers in LivePhysRegs
When LivePhysRegs adds live-in registers, it recognizes ~0 as a special
lane mask indicating the entire register. If the lane mask is not ~0,
it will only add the subregisters that overlap the specified lane mask.

The problem is that if a live-in register does not have subregisters,
and the lane mask is not ~0, it will not be added to the live set.
(The given lane mask may simply be the lane mask of its register class.)

If a register does not have subregisters, add it to the live set if
the lane mask is non-zero.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285440 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 20:06:37 +00:00
Matt Arsenault
593670b86b SpeculativeExecution: Allow speculating more inst types
Partial step towards removing the whitelist and only
using TTI's cost.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285438 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 20:00:33 +00:00
Matt Arsenault
2d7bc6b1e1 AMDGPU: Fix using incorrect private resource with no allocation
It's possible to have a use of the private resource descriptor or
scratch wave offset registers even though there are no allocated
stack objects. This would result in continuing to use the maximum
number reserved registers. This could go over the number of SGPRs
available on VI, or violate the SGPR limit requested by
the function attributes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285435 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 19:43:31 +00:00
Nemanja Ivanovic
0b61b12b8c Implement vector count leading/trailing bytes with zero lsb and vector parity
builtins - llvm portion

This patch corresponds to review https://reviews.llvm.org/D26003.
Committing on behalf of Zaara Syeda.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285434 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 19:38:24 +00:00
Teresa Johnson
4c68e05037 [ThinLTO] Use flags from summary when writing variable summary (NFC)
We already read the flags out of the summary when writing the summary
records for functions and aliases, do the same for variables.

This is an NFC change for now since the flags computed on the fly from
the GlobalValue currently will always match those in the summary
already, but once I send a follow-on patch to set the NoRename flag for
locals in the llvm.used set this becomes a necessary change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285433 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 19:36:00 +00:00
George Burgess IV
d7cf4df07b [MemorySSA] Add const to getClobberingMemoryAccess.
Thanks to bryant for the patch!

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285432 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 19:22:46 +00:00
Arnold Schwaighofer
9943293184 Make swift calling convention test specific to armv7
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285431 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 19:18:09 +00:00
Sanjay Patel
3dc20a0272 [x86] add tests for missed umin/umax
This is actually a deficiency in ValueTracking's matchSelectPattern(),
but a codegen test is the simplest way to expose the bug.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285429 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 19:08:20 +00:00