127814 Commits

Author SHA1 Message Date
Amaury Sechet
c2e77df6b8 Add support for phi nodes in the LLVM C API test
Summary: This required to add binding to Instruction::removeFromParent so that instruction can be forward declared and then moved at the right place.

Reviewers: bogner, chandlerc, echristo, dblaikie, joker.eph, Wallbraker

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260597 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 21:37:54 +00:00
Quentin Colombet
c83ca6a674 [GlobalISel][MachineIRBuilder] Fix comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260594 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 21:21:40 +00:00
Quentin Colombet
c7525b652c [GlobalISel] Make the getter for MBB in MachneIRBuilder public.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260593 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 21:20:35 +00:00
Quentin Colombet
6b6079747f [Target] Add a helper function to check if an opcode is invalid after isel.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260590 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 21:16:56 +00:00
Tom Stellard
d64ea69f34 AMDGPU/SI: When splitting SMRD instructions, add its users to VALU worklist
Summary:
When we split SMRD instructions into two MUBUFs we were adding the users
of the newly created MUBUFs to the VALU worklist.  However, the only
users these instructions had was the REG_SEQUENCE that was inserted
by splitSMRD when the original SMRD instruction was split.

We need to make sure to add the users of the original SMRD to the VALU
worklist before it is split.

I have a test case, but it requires one other bug fix, so it will be
added in a later commt.

Reviewers: mareko, arsenm

Subscribers: arsenm, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260588 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 21:14:34 +00:00
Pete Cooper
d84e67e364 Set load alignment on aggregate loads.
When optimizing a extractvalue(load), we generate a load from the
aggregate type.  This load didn't have alignment set and so would
get the alignment of the type.  This breaks when the type is packed
and so the alignment should be lower.

For example, loading { int, int } would give us alignment of 4, but
the original load from this type may have an alignment of 1 if packed.

Reviewed by David Majnemer

Differential revision: http://reviews.llvm.org/D17158

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260587 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 21:10:40 +00:00
Matthias Braun
e7d57e326e Revert "LiveIntervalAnalysis: Support moving of subregister defs in handleMove"
This is broke a bot:

http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/4703/steps/test-suite/logs/test.log

Reverting while I investigate.

This reverts commit r260565.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260586 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 21:07:44 +00:00
Derek Schuff
f0d31106f3 [WebAssembly] Reformat WebAssemblyFrameLowering and WebAssemblyISelLowering
Reviewers: sunfish, jfb

Subscribers: jfb, dschuff

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260585 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 20:57:09 +00:00
Sanjay Patel
a52e2127b6 [SelectionDAG] change getConstant() to use the input SDLoc when building splat vectors
The code change is simple enough: instead of attaching an anonymous SDLoc to splatted
vector constants, use the scalar constant's existing SDLoc since that is what is passed 
into getConstant() as a param. But this changes instruction scheduling, so I'll explain
why that happens.

The motivation for this patch starts near:
http://reviews.llvm.org/rL258833
...x86's getZeroVector() could be similarly cleaned up and I thought it would be 'NFC'.
But when I made that change locally, several x86 codegen tests wiggled.

It turns out that the lack of SDLoc consistency in getConstant() changes the way 
ScheduleDAGRRList behaves. This is because the SDLoc contains 'IROrder' and some DAG
scheduler algorithms use IROrder for tie-breaking.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260582 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 20:21:24 +00:00
Quentin Colombet
0cd715129e [GlobalISel] Add the necessary plumbing to lower formal arguments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260579 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 19:59:41 +00:00
Peter Collingbourne
cb4440633e DwarfDebug: emit type units immediately.
Rather than storing type units in a vector and emitting them at the end
of code generation, emit them immediately and destroy them, reclaiming the
memory we were using for their DIEs.

In one benchmark carried out against Chromium's 50 largest (by bitcode
file size) translation units, total peak memory consumption with type units
decreased by median 17%, or by 7% when compared against disabling type units.

Tested using check-{llvm,clang}, the GDB 7.5 test suite (with
'-fdebug-types-section') and by eyeballing llvm-dwarfdump output on those
Chromium translation units with split DWARF both disabled and enabled, and
verifying that the only changes were to addresses and abbreviation ordering.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260578 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 19:57:46 +00:00
Rafael Espindola
ba3b03fb25 Use copy initialization.
We can do it since getMemBuffer returns a unique_ptr.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260576 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 19:54:18 +00:00
Quentin Colombet
bfa9628e54 [AArch64] Trivial implementation of lower return for the IRTranslator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260574 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 19:45:27 +00:00
Reid Kleckner
697dfcddcf [codeview] Add test intended for r260571
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260573 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 19:44:26 +00:00
Kevin B. Smith
fa502aa703 [X86] New pass to change byte and word instructions to zero-extending versions.
Differential Revision: http://reviews.llvm.org/D17032


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260572 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 19:43:04 +00:00
Reid Kleckner
6d97a8c749 [codeview] Fix bug around multi-level wrapper inlining
If there were wrapper functions with no instructions of their own in the
inlining tree, we would fail to emit InlineSite records for them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260571 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 19:41:47 +00:00
Quentin Colombet
8d0faf368d [AArch64] Plug the beginning of the GlobalISel pipeline.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260569 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 19:35:06 +00:00
Quentin Colombet
3f0151fdc6 Play nice with Visual Studio and attributes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260568 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 19:33:21 +00:00
Quentin Colombet
317e76f08d [CMake] Produce an empty library for GlobalISel when not building it.
The rational for this change is that LLVMBuild cannot express conditional 
dependencies. Therefore, when we start optionally using GlobalISel library for 
say AArch64, without that change, all the tools that use the AArch64 library 
would need to explicitly link with GlobalISel when we ask for it.

This does not scale.

Instead, we will set the dependencies between the target and GlobalISel and if 
we did not ask to build GlobalISel, the library will just be empty.

Thanks to Chris Bieneman and Mehdi Animi for the idea.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260566 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 19:18:27 +00:00
Matthias Braun
07b147db30 LiveIntervalAnalysis: Support moving of subregister defs in handleMove
If two definitions write to independent subregisters then they can be
put in any order. LiveIntervalAnalysis::handleMove() did not support
this previously because it looks like moving a definition of a vreg past
another one.

This is a modified version of a patch proposed (two years ago) by
Vincent Lejeune! This version does not touch the read-undef flags and is
extended for the case of moving a subregister def behind all uses - this
can happen for subregister defs that are completely unused.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260565 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 19:03:53 +00:00
Quentin Colombet
ad5520eac9 [GlobalISel] Teach the IRTranslator how to lower returns.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260562 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 18:53:28 +00:00
Tom Stellard
0f13bd9bd1 [AMDGPU] Fix for "v_div_scale_f64 reg, vcc, ..." parsing
Summary:
Added support for "VOP3Only" attribute in VOP3bInst encoding.
Set VOP3Only=1 for V_DIV_SCALE_F64/32 insns.
Added support for multi-dest instructions in AMDGPUAs::cvt*().
Added lit test for "V_DIV_SCALE_F64|F32 vreg,vcc|sreg,vreg,vreg,vreg".

Reviewers: tstellarAMD, arsenm

Subscribers: arsenm, SamWot, nhaustov, vpykhtin

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

Patch By: Artem Tamazov

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260560 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 18:25:26 +00:00
Quentin Colombet
7f77b29db7 [GlobalISel] Add a type to MachineInstr.
We actually need that information only for generic instructions, therefore it
would be nice not to have to pay the extra memory consumption for all
instructions. Especially because a typed non-generic instruction does not make
sense.

The question is then, is it possible to have that information in a union or
something?
My initial thought was that we could have a derived class GenericMachineInstr
with additional information, but in practice it makes little to no sense since
generic MachineInstrs are likely turned into non-generic ones by just switching
the opcode. In other words, we don't want to go through the process of creating
a new, non-generic MachineInstr, object each time we do this switch. The memory
benefit probably is not worth the extra compile time.

Another option would be to keep the type of the MachineInstr in a side table.
This would induce an extra indirection though.

Anyway, I will file a PR to discuss about it and remember we need to come back
to it at some point.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260558 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 18:22:37 +00:00
Artem Belevich
384de0fd77 [NVPTX] emit .file directives for files referenced by subprograms.
.. so .loc directives referring to those files work correctly.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260557 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 18:21:47 +00:00
Quentin Colombet
b5d0611e18 [GlobalISel] Add a hook in TargetConfigPass to run GlobalISel.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260553 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 17:57:22 +00:00
Quentin Colombet
fa09f54ecd [GlobalISel][IRTranslator] Change the ownership of the MIRBuilder field.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260551 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 17:53:23 +00:00
Quentin Colombet
c778da675d [GlobalISel][IRTranslator] Fix a typo in assert.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260550 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 17:52:28 +00:00
Quentin Colombet
bbbe03f0d3 [GlobalISel][IRTranslator] Teach the pass how to translate Add instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260549 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 17:51:31 +00:00
Quentin Colombet
eb096dc0d4 [GlobalISel] Add a MachineIRBuilder class.
Helper class to build machine instrs. This is a higher abstraction
than MachineInstrBuilder.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260547 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 17:44:59 +00:00
Jacques Pienaar
9a9aa40b09 [lanai] Add Lanai triple.
Add triple for the Lanai backend.

General Lanai backend discussion on llvm-dev thread "[RFC] Lanai backend".

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260545 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 17:16:20 +00:00
Jun Bum Lim
7872a566bc Add a test case to show isKnownNonZero() returns correctly; NFC
Summary:
Added a test case just to make sure that isKnownNonZero() returns false
when we cannot guarantee that a ConstantExpr is a non-zero constant.

Reviewers: sanjoy, majnemer, mcrosier, nlewycky

Subscribers: nlewycky, mssimpso, mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260544 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 17:11:49 +00:00
Jun Bum Lim
307381b3a9 Fixed typo in r260530
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260541 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 16:46:13 +00:00
James Y Knight
5b06a939bd Add -match-full-lines argument to FileCheck.
This is useful for some tests where more-exact matching is useful, such
as clang's Preprocessor tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260540 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 16:46:09 +00:00
Hans Wennborg
b03ba0e6af Revert r260507: "[X86] Enable the LEA optimization pass by default."
This caused PR26575.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260538 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 16:44:06 +00:00
Jun Bum Lim
45279e6a90 [AArch64] Refactoring findMatchingStore() in aarch64-ldst-opt; NFC
Summary: This change makes findMatchingStore() follow the same coding style introduced in r260275.

Reviewers: gberry, junbuml

Subscribers: aemerson, rengolin, haicheng, bmakam, mssimpso

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260534 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 16:18:24 +00:00
Jun Bum Lim
885a68b0cf [InstCombine] Simplify a known nonzero incoming value of PHI
Summary:
When a PHI is used only to be compared with zero, it is possible to replace an
incoming value with any non-zero constant if the incoming value can be proved as
a known nonzero value. For example, in below code, we can replace the incoming value %v with
any non-zero constant based on the fact that the PHI is only used to be compared with zero
and %v is a known non-zero value:
  %v = select %cond, 1, 2
  %p = phi [%v, BB] ...
  %c = icmp eq, %p, 0

Reviewers: mcrosier, jmolloy, sanjoy

Subscribers: hfinkel, mcrosier, majnemer, llvm-commits, haicheng, bmakam, mssimpso, gberry

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260530 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 15:50:07 +00:00
Benjamin Kramer
a25f0be03b Drop the hidden visibility from DebugHandlerBase for now.
If a class has hidden visibility all derived classes and all classes
that have it as a member must have hidden visibility too. That may
be fixable here but requires changes to quite a lot of debug info
classes.

This is also one of the things that GCC enforces aggressively while
clang ignores it, making testing more annoying than necessary.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260529 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 15:41:56 +00:00
Chad Rosier
ac5172baad [AArch64] Improve load/store optimizer to handle LDUR + LDR.
This patch allows the mixing of scaled and unscaled load/stores to form
load/store pairs.

This is a reapplication of r259812, which had an incorrect assert.  The
test_stur_str_no_assert() test is a reduced version of the issue hit in
the AArch64 self-host.

PR24465

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260523 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 14:25:08 +00:00
Scott Egerton
a63bae5730 [MC] Fixed parsing of macro arguments where expressions with spaces are present.
Summary:
Fixed an issue for mips with an instruction such as 'sdc1 $f1, 272 +8(a0)' which has a space between '272' and '+'. The parser would then parse '272' and '+8' as two arguments instead of a single expression resulting in one too many arguments in the pseudo instruction.
The reason that the test case has been changed is so that the expected
output matches the output of the GNU assembler.

Reviewers: vkalintiris, dsanders

Subscribers: dsanders, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260521 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 13:48:49 +00:00
Artur Pilipenko
5880de50c1 Make context-sensitive isDereferenceable queries in isSafeToLoadUnconditionally
This is a part of the refactoring to unify isSafeToLoadUnconditionally and isDereferenceablePointer functions. In the subsequent change isSafeToSpeculativelyExecute will be modified to use isSafeToLoadUnconditionally instead of isDereferenceableAndAlignedPointer.   

Reviewed By: reames

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260520 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 13:42:59 +00:00
Tamas Berghammer
e7f78979df Fix MSVC 2013 build after rL260504
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260511 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 11:27:51 +00:00
Artur Pilipenko
1ea08bcb76 Don't propagate dereferenceable attribute through gc.relocate in InstCombine
Reviewed By: reames

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260509 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 11:22:46 +00:00
Andrey Turetskiy
3dd618f0dc [X86] Enable the LEA optimization pass by default.
Differential Revision: http://reviews.llvm.org/D16877



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260507 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 10:51:26 +00:00
Ashutosh Nema
30082e800b Fixed typo in comment & coding style for LoopVersioningLICM.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260504 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 09:23:53 +00:00
Craig Topper
7f53bedefc [TableGen] Use range-based for loops. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260502 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 07:39:29 +00:00
Craig Topper
a78623e3e8 [TableGen] Don't call emitSourceFileHeader a second time in the middle of the output file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260501 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 07:39:27 +00:00
Craig Topper
083ca64734 [TableGen] Whitespace cleanup in output file. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260500 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 07:39:25 +00:00
Craig Topper
269f2734b8 [TableGen] Simplify code slightly. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260499 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 07:39:22 +00:00
Simon Atanasyan
9fab895e0b [MC][ELF] Handle MIPS specific .sdata and .sbss directives
MIPS specific .sdata and .sbss directives create corresponding sections
with proper initialized ELF flags including ELF::SHF_MIPS_GPREL.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260498 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 06:45:54 +00:00
Matt Arsenault
d581c66591 AMDGPU: Fix constant bus use check with subregisters
If the two operands to an instruction were both
subregisters of the same super register, it would incorrectly
think this counted as the same constant bus use.

This fixes the verifier error in fmin_legacy.ll which
was missing -verify-machineinstrs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260495 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 06:15:39 +00:00