Commit Graph

26313 Commits

Author SHA1 Message Date
Benjamin Kramer 4b36616af3 [APInt] No need for a copy when taking min/max of an APInt.
llvm-svn: 260827
2016-02-13 17:23:27 +00:00
Tom Stellard 4409051d00 AMDGPU/SI: Add llvm.amdgcn.mov.dpp intrinsic
This intrinsic will be used to expose dpp functionality to higher-level
languages. It will map to the dpp version of v_mov_b32.

llvm-svn: 260792
2016-02-13 02:09:49 +00:00
Keno Fischer 7c7c3e3591 [Cloning] Clone every Function's Debug Info
Summary:
Export the CloneDebugInfoMetadata utility, which clones all debug info
associated with a function into the first module. Also use this function
in CloneModule on each function we clone (the CloneFunction entrypoint
already does this).

Without this, cloning a module will lead to DI quality regressions,
especially since r252219 reversed the Function <-> DISubprogram edge
(before we could get lucky and have this edge preserved if the
DISubprogram itself was, e.g. due to location metadata).

This was verified to fix missing debug information in julia and
a unittest to verify the new behavior is included.

Patch by Yichao Yu! Thanks!

Reviewers: loladiro, pcc
Differential Revision: http://reviews.llvm.org/D17165

llvm-svn: 260791
2016-02-13 02:04:29 +00:00
Matt Arsenault 5e845e54f5 Add AMDGPU related triple vendors/OSes
As support expands to more runtimes, we'll need to
distinguish between more than just HSA and unknown.
This also lets us stop using unknown everywhere.

llvm-svn: 260790
2016-02-13 01:56:21 +00:00
Matt Arsenault ce56a0ef54 AMDGPU: Add intrinsics for sin/cos
These provide direct access to the hardware instruction without
the unit version required like llvm.sin/llvm.cos lowering requires.

llvm-svn: 260782
2016-02-13 01:19:56 +00:00
Matt Arsenault 79963e80b8 AMDGPU: Rename intrinsic to better match instruction name
Also fixes missing f32 test.

llvm-svn: 260780
2016-02-13 01:03:00 +00:00
Tom Stellard 1debba54a7 AMDGPU/SI: Organize intrinsics by subtarget
Reviewers: arsenm

Subscribers: llvm-commits

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

llvm-svn: 260771
2016-02-13 00:29:57 +00:00
Rong Xu bb49490de1 [PGO] Add another interface for annotateValueSite
Add another interface to function annotateValueSite() which directly uses the
VauleData array.

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

llvm-svn: 260741
2016-02-12 21:36:17 +00:00
Justin Lebar 144c5a6c15 Add convergent property to CodeMetrics.
Summary: No functional changes.

Reviewers: jingyue, arsenm

Subscribers: arsenm, llvm-commits

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

llvm-svn: 260728
2016-02-12 21:01:31 +00:00
Justin Lebar 531b24b53a Initialize CodeMetrics' member variables inline with definitions.
Summary: No functional changes.

Reviewers: jingyue

Subscribers: llvm-commits

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

llvm-svn: 260727
2016-02-12 20:59:20 +00:00
Quentin Colombet 232f447782 Get rid of some GLOBAL_ISEL ifdefs that should be harmless for code size.
More to come, but those were easy.

llvm-svn: 260723
2016-02-12 20:41:24 +00:00
Benjamin Kramer 56d13e8937 Remove LLVMGetTargetMachineData leftovers.
llvm-svn: 260720
2016-02-12 20:26:46 +00:00
Argyrios Kyrtzidis 67d55fac12 [ADT] Revert the llvm/ADT/OptionSet.h header and unit test.
llvm-svn: 260714
2016-02-12 19:47:35 +00:00
Rafael Espindola cbc31d699b Delete the deprecated LLVMLinkModules.
llvm-svn: 260683
2016-02-12 15:28:45 +00:00
Mehdi Amini f71d653879 C API: Remove LLVMGetDataLayout that was deprecated in 3.7
From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 260657
2016-02-12 06:22:00 +00:00
Argyrios Kyrtzidis 2329967714 [ADT] OptionSet: ifdef out some code that seems to be crashing MSVC.
llvm-svn: 260654
2016-02-12 04:36:48 +00:00
Argyrios Kyrtzidis 4538dcb01b [ADT] Introduce ‘OptionSet’ in llvm/ADT headers, which is a utility class that makes it convenient to work with enumerators representing bit options.
llvm-svn: 260652
2016-02-12 02:48:26 +00:00
Evgeniy Stepanov ba6ca87ffb [msan] Put msan constructor in a comdat.
MSan adds a constructor to each translation unit that calls
__msan_init, and does nothing else. The idea is to run __msan_init
before any instrumented code. This results in multiple constructors
and multiple .init_array entries in the final binary, one per
translation unit. This is absolutely unnecessary; one would be
enough.

This change moves the constructors to a comdat group in order to drop
the extra ones.

llvm-svn: 260632
2016-02-12 00:37:52 +00:00
Mehdi Amini 9c1c3ac627 Revert "Refactor the PassManagerBuilder: extract a "addFunctionSimplificationPasses()""
This reverts commit r260603.
I didn't intend to push it :(

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 260607
2016-02-11 22:09:11 +00:00
Mehdi Amini c5bf5ecc1b Revert "Define the ThinLTO Pipeline"
This reverts commit r260604.
I didn't intend to push this now.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 260606
2016-02-11 22:09:07 +00:00
Mehdi Amini 1462b76cdc Revert "Add a new insert_as() method to DenseMap and use it for ConstantUniqueMap"
This reverts commit r260458.

It was backported on an internal branch and broke stage2 build. Since
this can lead to weird random crash I'm reverting upstream as well
while investigating.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 260605
2016-02-11 22:00:36 +00:00
Mehdi Amini 484470d605 Define the ThinLTO Pipeline
Summary:
On the contrary to Full LTO, ThinLTO can afford to shift compile time
from the frontend to the linker: both phases are parallel.
This pipeline is based on the proposal in D13443 for full LTO. We ]
didn't move forward on this proposal because the link was far too long
after that.

This patch refactor the "function simplification" passes that are part
of the inliner loop in a helper function (this part is NFC and can be
commited separately to simplify the diff). The ThinLTO pipeline
integrates in the regular O2/O3 flow:

 - The compile phase perform the inliner with a somehow lighter
   function simplification. (TODO: tune the inliner thresholds here)
   This is intendend to simplify the IR and get rid of obvious things
   like linkonce_odr that will be inlined.
 - The link phase will run the pipeline from the start, extended with
   some specific passes that leverage the augmented knowledge we have
   during LTO. Especially after the inliner is done, a sequence of
   globalDCE/globalOpt is performed, followed by another run of the
   "function simplification" passes.

The measurements on the public test suite as well as on our internal
suite show an overall net improvement. The binary size for the clang
executable is reduced by 5%. We're still tuning it with the bringup
of ThinLTO but this should provide a good starting point.

Reviewers: tejohnson

Subscribers: joker.eph, llvm-commits, dexonsmith

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

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 260604
2016-02-11 22:00:31 +00:00
Mehdi Amini f9a3718c5a Refactor the PassManagerBuilder: extract a "addFunctionSimplificationPasses()"
It is intended to contains the passes run over a function after the
inliner is done with a function and before it moves to its callers.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 260603
2016-02-11 22:00:25 +00:00
Quentin Colombet ccd7725808 [IRTranslator] Use a single virtual register to represent any Value.
PR26161.

llvm-svn: 260602
2016-02-11 21:48:32 +00:00
Amaury Sechet 2f43208c9a 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

llvm-svn: 260597
2016-02-11 21:37:54 +00:00
Quentin Colombet 7bd6a225e8 [GlobalISel][MachineIRBuilder] Fix comments.
llvm-svn: 260594
2016-02-11 21:21:40 +00:00
Quentin Colombet 27b7b8e3e5 [GlobalISel] Make the getter for MBB in MachneIRBuilder public.
llvm-svn: 260593
2016-02-11 21:20:35 +00:00
Quentin Colombet 8fd6718700 [Target] Add a helper function to check if an opcode is invalid after isel.
llvm-svn: 260590
2016-02-11 21:16:56 +00:00
Quentin Colombet fd9d0a07d8 [GlobalISel] Add the necessary plumbing to lower formal arguments.
llvm-svn: 260579
2016-02-11 19:59:41 +00:00
Peter Collingbourne 7c384ccea2 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

llvm-svn: 260578
2016-02-11 19:57:46 +00:00
Quentin Colombet 74d7d2f00b [GlobalISel] Teach the IRTranslator how to lower returns.
llvm-svn: 260562
2016-02-11 18:53:28 +00:00
Quentin Colombet 9855111b77 [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.

llvm-svn: 260558
2016-02-11 18:22:37 +00:00
Quentin Colombet 37a09a8428 [GlobalISel] Add a hook in TargetConfigPass to run GlobalISel.
llvm-svn: 260553
2016-02-11 17:57:22 +00:00
Quentin Colombet a7fae162e6 [GlobalISel][IRTranslator] Change the ownership of the MIRBuilder field.
llvm-svn: 260551
2016-02-11 17:53:23 +00:00
Quentin Colombet 17c494b91c [GlobalISel][IRTranslator] Teach the pass how to translate Add instructions.
llvm-svn: 260549
2016-02-11 17:51:31 +00:00
Quentin Colombet 2ad1f851a1 [GlobalISel] Add a MachineIRBuilder class.
Helper class to build machine instrs. This is a higher abstraction
than MachineInstrBuilder.

llvm-svn: 260547
2016-02-11 17:44:59 +00:00
Jacques Pienaar dbfe8700cb [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

llvm-svn: 260545
2016-02-11 17:16:20 +00:00
Artur Pilipenko 66d6d3eb2d 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

llvm-svn: 260520
2016-02-11 13:42:59 +00:00
Michael J. Spencer 582c4d2bab [readobj] Handle ELF files with no section table or with no program headers.
This adds support for finding the dynamic table and dynamic symbol table via
the section table or the program header table. If there's no section table an
attempt is made to figure out the length of the dynamic symbol table.

llvm-svn: 260488
2016-02-11 04:59:45 +00:00
Quentin Colombet e1494c353a [GlobalISel][MachineRegisterInfo] Add a method to create generic vregs.
For now, generic virtual registers will not have a register class. We may want
to change that. For instance, if we want to use all the methods from
TargetRegisterInfo with generic virtual registers, we need to either have some
sort of generic register classes that do what we want, or teach those methods
how to deal with nullptr register class.

Although the latter seems easy enough to do, we may still want to differenciate
generic register classes from nullptr to catch cases where nullptr gets
introduced by a bug of some sort.

Anyway, I will file a PR to keep track of that.

llvm-svn: 260474
2016-02-11 00:19:17 +00:00
Quentin Colombet 36ce1b0157 [GlobalISel] Remember the size of generic virtual registers
llvm-svn: 260468
2016-02-10 23:43:48 +00:00
Mehdi Amini c87d7d02e1 Use a StringSet in Internalize, and allow to create the pass from an existing one (NFC)
There is not reason to pass an array of "char *" to rebuild a set if
the client already has one.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 260462
2016-02-10 23:24:31 +00:00
Mehdi Amini 0bfaa589f0 Add the ability to initialize a StringSet from a pair of iterators (NFC)
From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 260461
2016-02-10 23:24:21 +00:00
Mehdi Amini 2476e0027e Add a new insert_as() method to DenseMap and use it for ConstantUniqueMap
Summary:
Just like the existing find_as() method, the new insert_as() accepts
an extra parameter which is used as a key to find the bucket in the
map.
When creating a Constant, we want to check the map before actually
creating the object. In this case we have to perform two queries to
the map, and this extra parameter can save recomputing the hash value
for the second query.

Reviewers: dexonsmith, chandlerc

Subscribers: llvm-commits

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

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 260458
2016-02-10 23:07:29 +00:00
Quentin Colombet 2ecff3bff2 [GlobalISel] More detailed skeleton for the IRTranslator.
llvm-svn: 260456
2016-02-10 22:59:27 +00:00
Mehdi Amini b87dec4b56 Bitcode reader: replace DecodeChar6() with a lookup table (NFC)
Summary: Measured to be more performant when reading bitcode.

Reviewers: rafael, dexonsmith

Subscribers: llvm-commits

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

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 260455
2016-02-10 22:47:48 +00:00
Mehdi Amini 8914d29008 Simplify handleOperandChangeImpl() removing last argument (NFC)
The Use argument was used to compute the operand number for a fast
path when replacing only one operand. However we always have to go
through all the operands. So the argument number can be recomputed
locally anyway.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 260454
2016-02-10 22:47:15 +00:00
Rong Xu 69683f13d2 [PGO] Make the number of records for each value site metada adjustable
The patch adds a parameter in annotateValueSite() to control the max number
of records written to the value profile meta data for each value site. The
default is kept as the current value of 3.

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

llvm-svn: 260450
2016-02-10 22:19:43 +00:00
Teresa Johnson e1164de5d0 Restore "[ThinLTO] Use MD5 hash in function index." with fix
This restores commit r260408, along with a fix for a bot failure.

The bot failure was caused by dereferencing a unique_ptr in the same
call instruction parameter list where it was passed via std::move.
Apparently due to luck this was not exposed when I built the compiler
with clang, only with gcc.

llvm-svn: 260442
2016-02-10 21:55:02 +00:00
Reid Kleckner f9c275fe0a [codeview] Describe int local variables using .cv_def_range
Summary:
Refactor common value, scope, and label tracking logic out of DwarfDebug
into a common base class called DebugHandlerBase.

Update an old LLVM IR test case to avoid an assertion in LexicalScopes.

Reviewers: dblaikie, majnemer

Subscribers: llvm-commits

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

llvm-svn: 260432
2016-02-10 20:55:49 +00:00