Commit Graph

129974 Commits

Author SHA1 Message Date
Duncan P. N. Exon Smith
ef94029809 IR: Add missing assertion for ConstantVector::ConstantVector
Use the same assertion as ConstantArray.  Vectors should have the right
number of elements.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265463 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 20:53:47 +00:00
Quentin Colombet
aa40fb64ae [RegisterBank] Provide a way to check if a register bank is valid.
Change the default constructor to create invalid object.
The target will have to properly initialize the register banks before
using them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265460 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 20:48:32 +00:00
Duncan P. N. Exon Smith
2707ee3256 Revert "Fix Clang-tidy modernize-deprecated-headers warnings in remaining files; other minor fixes."
This reverts commit r265454 since it broke the build.  E.g.:

  http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_build/22413/

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265459 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 20:45:04 +00:00
Duncan P. N. Exon Smith
f45d3278d3 Make constructors for final subclasses of Constant private, NFC
These were `protected` before, but might as well be `private`.  Also
marked the classes themselves `final`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265458 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 20:31:23 +00:00
David Blaikie
46c3acf600 llvm-dwp: Handle GCC's use of multiple debug_types.dwo sections in a single .dwo file
(also includes the .test file missing from my previous commit, r265452)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265457 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 20:26:50 +00:00
Duncan P. N. Exon Smith
15121b5f36 ValueMapper: Rewrite Mapper::mapMetadata without recursion
This commit completely rewrites Mapper::mapMetadata (the implementation
of llvm::MapMetadata) using an iterative algorithm.  The guts of the new
algorithm are in MDNodeMapper::map, the entry function in a new class.

Previously, Mapper::mapMetadata performed a recursive exploration of the
graph with eager "just in case there's a reason" malloc traffic.

The new algorithm has these benefits:

  - New nodes and temporaries are not created eagerly.
  - Uniquing cycles are not duplicated (see new unit test).
  - No recursion.

Given a node to map, it does this:

 1. Use a worklist to perform a post-order traversal of the transitively
    referenced unmapped nodes.

 2. Track which nodes will change operands, and which will have new
    addresses in the mapped scheme.  Propagate the changes through the
    POT until fixed point, to pick up uniquing cycles that need to
    change.

 3. Map all the distinct nodes without touching their operands.  If
    RF_MoveDistinctMetadata, they get mapped to themselves; otherwise,
    they get mapped to clones.

 4. Map the uniqued nodes (bottom-up), lazily creating temporaries for
    forward references as needed.

 5. Remap the operands of the distinct nodes.

Mehdi helped me out by profiling this with -flto=thin.  On his workload
(importing/etc. for opt.cpp), MapMetadata sped up by 15%, contributed
about 50% less to persistent memory, and made about 100x fewer calls to
malloc.  The speedup is less than I'd hoped.  The profile mainly blames
DenseMap lookups; perhaps there's a way to reduce them (e.g., by
disallowing remapping of MDString).

It would be nice to break the strange remaining recursion on the Value
side: MapValue => materializeInitFor => RemapInstruction => MapValue.  I
think we could do this by having materializeInitFor return a worklist of
things to be remapped.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265456 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 20:23:21 +00:00
Quentin Colombet
cdf87d0168 [TargetRegisterClass] Improve the comment for how to use getSubClassMask.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265455 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 20:21:53 +00:00
Eugene Zelenko
9a7a3bcf29 Fix Clang-tidy modernize-deprecated-headers warnings in remaining files; other minor fixes.
Some Include What You Use suggestions were used too.

Use anonymous namespaces in source files.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265454 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 20:19:49 +00:00
David Blaikie
fe34a372e1 llvm-dwp: Handle dwo files produced by GCC
To start with, handle DW_FORM_string names. Follow up commit will handle
the interesting quirk with type units I was originally aiming for here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265452 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 20:16:38 +00:00
Lang Hames
cb6a5650f3 [llvm-rtdyld] Fix the return type on ErrorAndExit.
As suggested by Rafael - this function no longer returns a value as of r264425.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265451 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 20:11:24 +00:00
Ahmed Bougacha
db4b54ff8f [X86] Reuse EFLAGS and form LOCKed ops when only user is SETCC.
We only generate LOCKed versions of add/sub when the result is unused.
It often happens that the result is used, but only by a comparison. We
can optimize those out by reusing EFLAGS, which lets us use the proper
instructions, instead of having to fallback to LXADD.

Instead of doing this as an MI peephole (as we do for the other
non-LOCKed (really, non-MR) forms), do it in ISel. It becomes quite
tricky later.

This also makes it eventually possible to stop expanding and/or/xor
if the only user is an icmp (also see D18141).

This uses the LOCK ISD opcodes added by r262244.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265450 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 20:02:57 +00:00
Quentin Colombet
baea9b2a9a [GlobalISel] Add the RegisterBankInfo class for the handling of register banks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265449 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 20:02:47 +00:00
Ahmed Bougacha
a4e82226ec [X86] Add tests for ATOMIC_LOAD_OP EFLAGS reuse. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265448 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 20:02:44 +00:00
Ahmed Bougacha
90af9e7014 [X86] Simplify early-exit check. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265447 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 20:02:22 +00:00
Lang Hames
c224d81083 [Support] Add a checked flag to Expected<T>, require checks before access or
destruction.

This makes the Expected<T> class behave like Error, even when in success mode.
Expected<T> values must be checked to see whether they contain an error prior
to being dereferenced, assigned to, or destructed.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265446 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 19:57:03 +00:00
Quentin Colombet
9b710764b9 [GlobalISel] Add a class, RegisterBank, to represent register banks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265445 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 19:54:44 +00:00
Sanjay Patel
3a27360c9d fixed to discard earlier advertising
Also, hardcode (there must be a better way...) the 'utils' dir in the 
advertisement, so it's easier to find.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265444 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 19:50:21 +00:00
Sanjay Patel
ace0cc82e4 fix typo; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265442 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 19:27:39 +00:00
Quentin Colombet
ec856b3cc7 [AArch64][Test] Do not override the suffixes for test cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265441 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 19:26:42 +00:00
Quentin Colombet
278bb5de48 [GlobalISel] Add the skeleton of the RegBankSelect pass.
This pass is reponsible for assigning the generic virtual registers to register
banks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265440 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 19:06:01 +00:00
Lang Hames
8a1ae616c9 [Support] clang-format Error.h.
This tidies up the ExitOnError class and some other recently added code. NFC.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265438 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 18:50:09 +00:00
Sanjay Patel
25f2ff181c fix documentation comments; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265434 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 18:23:30 +00:00
Manman Ren
2bf0ebe961 Swift Calling Convention: swifterror target-independent change.
At IR level, the swifterror argument is an input argument with type
ErrorObject**. For targets that support swifterror, we want to optimize it
to behave as an inout value with type ErrorObject*; it will be passed in a
fixed physical register.

The main idea is to track the virtual registers for each swifterror value. We
define swifterror values as AllocaInsts with swifterror attribute or a function
argument with swifterror attribute.

In SelectionDAGISel.cpp, we set up swifterror values (SwiftErrorVals) before
handling the basic blocks.

When iterating over all basic blocks in RPO, before actually visiting the basic
block, we call mergeIncomingSwiftErrors to merge incoming swifterror values when
there are multiple predecessors or to simply propagate them. There, we create a
virtual register for each swifterror value in the entry block. For predecessors
that are not yet visited, we create virtual registers to hold the swifterror
values at the end of the predecessor. The assignments are saved in
SwiftErrorWorklist and will be materialized at the end of visiting the basic
block.

When visiting a load from a swifterror value, we copy from the current virtual
register assignment. When visiting a store to a swifterror value, we create a
virtual register to hold the swifterror value and update SwiftErrorMap to
track the current virtual register assignment.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265433 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 18:13:16 +00:00
Sanjay Patel
cd3afd524c add tests to show missing optimization from D18230
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265431 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 18:09:36 +00:00
Sanjay Patel
d8f98f3e4e add example usage and workflow to --help output
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265430 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 18:00:47 +00:00
David Blaikie
037ba978f5 llvm-dwp: Simplify hashing code a bit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265426 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 17:51:40 +00:00
Sanjay Patel
503ff5bcee [InstCombine] regenerate checks
utils/update_test_checks.py was improved with:
http://reviews.llvm.org/rL265414
to CHECK-NEXT the first line of the IR function. This ensures that nothing bad
has happened before that.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265417 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 17:24:54 +00:00
Sanjay Patel
f87ded946e [x86] regenerate checks
utils/update_test_checks.py was improved with:
http://reviews.llvm.org/rL265414
to include the first line of the function (expected to be
a comment line). This ensures that nothing bad has happened
before the first actual line of checked asm. It also matches
the existing behavior of the old script.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265416 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 17:12:19 +00:00
JF Bastien
01d8b6a2ac WebAssembly: fix cfg-stackify test
It was broken by reshuffling induced by r265397 'Don't delete empty preheaders in CodeGenPrepare if it would create a critical edge'.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265415 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 17:01:52 +00:00
Sanjay Patel
4d9b8c9ce1 check or check-next the first line of the function too
We could make this an option if people don't like it. 
But since part of the reason for using a script to generate
checks is to prevent lazy checking that lets bugs crawl 
through, let's have the script check the first line too. 

For asm tests, it ensures that nothing unexpected has 
happened before the first line of asm. This matches the
existing behavior of update_llc_test_checks.py. 

More discussion in PR22897:
https://llvm.org/bugs/show_bug.cgi?id=22897



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265414 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 16:49:07 +00:00
Valery Pykhtin
89372a56d6 [TableGen] AsmMatcherEmitter.cpp: replace a sequence of "if" to "switch" in emitValidateOperandClass.
Differential Revision: http://reviews.llvm.org/D18394

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265412 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 16:18:16 +00:00
Jacques Pienaar
148a26a80b [lanai] LanaiSetflagAluCombiner more conservative
Summary: LanaiSetflagAluCombiner could previously combine instructions across basic building blocks even when not legal. Make the LanaiSetflagAluCombiner more conservative to avoid this.

Reviewers: eliben

Subscribers: joker.eph, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265411 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 16:18:13 +00:00
Sam Parker
e0d1a47716 [ARM] Cleanup of smul and smla instruction descriptions
Removed the SDNode argument passed to the AI_smul and AI_smla multiclass
definitions as they are always mul.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265409 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 16:01:25 +00:00
Konstantin Zhuravlyov
e1d66f4ce3 [AMDGPU] Emit linkonce and linkonce_odr symbols
Differential Revision: http://reviews.llvm.org/D18726


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265408 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 16:00:58 +00:00
Haicheng Wu
7b0de34979 [BlockPlacement] Remove an unnecessary continue
NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265407 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 15:37:08 +00:00
Rafael Espindola
00d9a04525 Use ArrayRef for contiguous areas in ELF. NFC.
This just simplifies the code a bit. More so in lld.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265403 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 14:47:22 +00:00
Chuang-Yu Cheng
8d7c100e12 Add missing test for the "Don't delete empty preheaders" added in r265397
Author: Tom Jablin (tjablin)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265402 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 14:21:32 +00:00
Rafael Espindola
c5c3d28dda Centralize the definition of a few types. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265399 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 14:10:18 +00:00
Chuang-Yu Cheng
afa4f41e9c Don't delete empty preheaders in CodeGenPrepare if it would create a critical edge
Presently, CodeGenPrepare deletes all nearly empty (only phi and branch)
basic blocks. This pass can delete loop preheaders which frequently creates
critical edges. A preheader can be a convenient place to spill registers to
the stack. If the entrance to a loop body is a critical edge, then spills
may occur in the loop body rather than immediately before it. This patch
protects loop preheaders from deletion in CodeGenPrepare even if they are
nearly empty.

Since the patch alters the CFG, it affects a large number of test cases.
In most cases, the changes are merely cosmetic (basic blocks have different
names or instruction orders change slightly). I am somewhat concerned about
the test/CodeGen/Mips/brdelayslot.ll test case. If the loop preheader is not
deleted, then the MIPS backend does not take advantage of a branch delay
slot. Consequently, I would like some close review by a MIPS expert.

The patch also partially subsumes D16893 from George Burgess IV. George
correctly notes that CodeGenPrepare does not actually preserve the dominator
tree. I think the dominator tree was usually not valid when CodeGenPrepare
ran, but I am using LoopInfo to mark preheaders, so the dominator tree is
now always valid before CodeGenPrepare.

Author: Tom Jablin (tjablin)
Reviewers: hfinkel george.burgess.iv vkalintiris dsanders kbarton cycheng

http://reviews.llvm.org/D16984

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265397 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 14:06:20 +00:00
Peter Zotov
2b8aed70d6 [llvm-c] Expose LLVM{Get,Set}ModuleIdentifier
Patch by Nicole Mazzuca <npmazzuca@gmail.com>.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265394 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 13:56:59 +00:00
Simon Dardis
521f98ca01 [mips] MIPSR6 Compact jump support
This patch adds support for compact jumps similiar to the previous compact
branch support for MIPSR6. Unlike compact branches, compact jumps do not
have a forbidden slot.

As MipsInstrInfo::getEquivalentCompactForm can determine the correct
expansion for jumps and branches for both microMIPS and MIPSR6, remove the
unnecessary distinction in the delay slot filler.

Reviewers: vkalintiris

Subscribers: llvm-commits, dsanders


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265390 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 12:50:29 +00:00
Justin Holewinski
515b87030b [NVPTX] Handle ldg created from sign-/zero-extended load
Reviewers: jingyue

Subscribers: jholewinski

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265389 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 12:38:01 +00:00
David L Kreitzer
51dcabbf7c Adds the ability to use an epilog remainder loop during loop unrolling and makes
this the default behavior.

Patch by Evgeny Stupachenko (evstupac@gmail.com).

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265388 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 12:19:35 +00:00
Tamas Berghammer
2b45afffa0 Set the thumb flag for thumb symbols coming from an ELF file
Without setting the flag there is no way to determine if a symbol
points to an arm or to a thumb function as the LSB of the address
masked out in all getter function.

Note: Currently the thumb flag is only used for MachO files so
adding a test to this change is not possible. It will be used
by the upcoming fix for llvm-objdump for disassembling thumb
functions what is easily testable.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265387 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 12:11:40 +00:00
Haojian Wu
f0a7cfdba2 Add parentheses around && within || to avoid compiler warning message.
Summary: The assert code is introduced by r265370.

Reviewers: bkramer

Subscribers: tejohnson

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265383 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 09:07:47 +00:00
Dmitry Polukhin
51a06a2c66 [IFUNC] Use GlobalIndirectSymbol when aliases and ifuncs have something similar
Second part extracted from http://reviews.llvm.org/D15525

Use GlobalIndirectSymbol in all cases when aliases and ifuncs have
something in common.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265382 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 08:47:51 +00:00
Etienne Bergeron
bf3b2ca04c [Support] Fix an invalid character escaping in string literal (unittest).
Summary:
A character within a string literal is not escaped correctly.
In this case, there is no semantic change because the invalid character turn out to be NUL anyway.

note: "\0x12" is equivalent to {0, 'x', '1', '2'} and not { 12 }.

This issue was found by clang-tidy.

Reviewers: rnk

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265376 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 01:46:26 +00:00
Teresa Johnson
3890d33905 [ThinLTO] Refactor some common code into getGlobalValueInfo method (NFC)
Refactor common code that queries the ModuleSummaryIndex for a value's
GlobalValueInfo struct into getGlobalValueInfo helper methods, which
will also be used by D18763.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265370 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 00:40:16 +00:00
JF Bastien
f90bc5f1a3 Docs: dampen story time for atomics
Story time was nice a few years ago, but by now it's nice to state how things are, rather than explain the diff from ye olden atomic history. These were dark times.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265369 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 00:31:25 +00:00
JF Bastien
3f3bbdbcf9 Lanai: fix -Wsign-compare warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265368 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 00:20:27 +00:00