130917 Commits

Author SHA1 Message Date
Evgeny Stupachenko
a27504ef06 The patch fixes PR27392.
Summary:
 It is incorrect to compare TripCount (which is BECount + 1)
  with extraiters (or Count) to check if we should enter unrolled
  loop or not, because TripCount can potentially overflow
  (when BECount is max unsigned integer).
 While comparing BECount with (Count - 1) is overflow safe and
  therefore correct.

Reviewer: hfinkel

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

From: Evgeny Stupachenko <evstupac@gmail.com>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267662 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27 03:04:54 +00:00
Philip Reames
ee1148650b [LVI] Delete stale and misleading comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267661 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27 03:03:15 +00:00
Chuang-Yu Cheng
4bbf2a928e [ppc64] fix bug in prologue that mfocrf's cr operand should be explict state instead of implicit
This fixes PR27414

Reviewers: kbarton mgrang tjablin

http://reviews.llvm.org/D19255

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267660 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27 02:59:28 +00:00
Ahmed Bougacha
30fc21220d [X86] Set AddPristinesAndCSRs to FixupBW LivePhysRegs. NFC.
We run after PEI, so we need to AddPristinesAndCSRs.
In practice, that makes no difference here, because we only ask about
liveness of super-registers of defined GR8/GR16 registers, so they
can't be pristine. Still, it's the correct thing to do.

Thanks to Quentin for noticing!

Follow-up to r267495.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267658 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27 01:51:38 +00:00
Mehdi Amini
35f5834b76 Fix the test from r267656: Support "preserving" the summary information when using setModule() API in LTOCodeGenerator
From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267657 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27 01:49:11 +00:00
Mehdi Amini
1ceaa07a74 Add a test for r267655: Support "preserving" the summary information when using setModule() API in LTOCodeGenerator
From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267656 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27 01:47:46 +00:00
Mehdi Amini
65bb806054 Support "preserving" the summary information when using setModule() API in LTOCodeGenerator
From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267655 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27 01:46:48 +00:00
Sanjoy Das
23165eebbb Fix typo in comment; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267653 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27 01:44:31 +00:00
Ahmed Bougacha
4f196793f2 [X86] Don't assume that MMX extractelts are from index 0.
It's probably the case for all 3 MMX users out there, but with
hand-crafted IR, you can trigger selection failures. Fix that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267652 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27 01:35:29 +00:00
Ahmed Bougacha
74e636a042 [X86] Re-enable MMX i32 extractelt combine.
This effectively adds back the extractelt combine removed by r262358:
the direct case can still occur (because x86_mmx is special, see
r262446), but it's the indirect case that's now superseded by the
generic combine.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267651 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27 01:35:25 +00:00
Cong Hou
283390a068 Detects the SAD pattern on X86 so that much better code will be emitted once the pattern is matched.
Differential revision: http://reviews.llvm.org/D14840



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267649 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27 01:29:18 +00:00
Philip Reames
6d1c855241 [LVI] Add a comment explaining a subtle piece of code
Or at least, I didn't understand the implications the first several times I read it it.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267648 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27 01:02:25 +00:00
Adam Nemet
9f23dcdf45 [Docs] Try to clarify the concept of domains for noalias scope
Summary:
This tries to anchor down the concept of domains a bit better.  I had
trouble initially relating this to anything.  Also talking to David
Majnemer on IRC suggested that I wasn't the only one.

Reviewers: hfinkel

Subscribers: llvm-commits, majnemer

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267647 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27 00:52:48 +00:00
Mehdi Amini
3b7741bb2b ThinLTO: do not promote GlobalVariable that have a specific section.
Differential Revision: http://reviews.llvm.org/D18298

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267646 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27 00:32:13 +00:00
Matt Arsenault
3082da881d SLSR: Use UnknownAddressSpace instead of 0 for pure arithmetic.
In the case where isLegalAddressingMode is used for cases
not related to addressing modes, such as pure adds and muls,
it should not be using address space 0. LSR already passes -1
as the address space in these cases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267645 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27 00:32:09 +00:00
Mehdi Amini
e69ab0b5ff LTOCodeGenerator: turns linkonce(_odr) into weak_(odr) when present "MustPreserve" set
Summary:
If the linker requested to preserve a linkonce function, we should
honor this even if we drop all uses.

Reviewers: dexonsmith

Subscribers: llvm-commits, joker.eph

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

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267644 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27 00:32:02 +00:00
Adam Nemet
7f794cf472 [LoopDist] Split main class. NFC
This splits out the per-loop functionality from the Pass class.

With this the fact whether the loop is forced-distribute with the new
metadata/pragma can be cached in the per-loop class rather than passed
around.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267643 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27 00:31:03 +00:00
Philip Reames
82d78c2f27 [LVI] Reduce compile time by lazily scanning blocks if needed
When encountering a non-local pointer, LVI would eagerly scan the block for dereferences of the given object to prove the pointer to be non null.  That's all well and good, but *then* we'd go recurse through our input blocks.  As a result, we could end up scanning each and every block we traverse, even if the final definition was obviously non null or we found a constant value somewhere up the chain.  The previous code papered over this by using the isKnownNonNull routine from value tracking.  This made the duplication less painful in the common case.

Instead, we know do the block scan only *after* we've gotten the recursive results back.  This lets us stop scanning individual blocks as soon as we've determined it to be non-null in any predecessor block and use our usual merge rules to propagate that information cheaply through successor blocks.  For a pointer which can be found non-null, this does strictly less work and sometimes substaintially so.

Note that the case where we *can't* prove something non-null is still the really expensive case.  We end up scanning each and every block looking for a dereference and never end up finding one.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267642 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27 00:30:55 +00:00
Quentin Colombet
7ec26d4fef [MachineInstrBundle] Actually set the PartialDeadDef flag only when the register
is defined!

The users were checking the proper thing (Defined + PartialDeadDef), but the
information may have been wrong for other use cases, so fix that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267641 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27 00:16:29 +00:00
Quentin Colombet
820df98fdc [MachineInstrBundle] Update the comment for PhysRegInfo::DeadDef.
I missed read the comment when I commited r267621 and thought the
comment did not need update. Matthias kindly proved me wrong.
Fixing that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267638 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 23:55:41 +00:00
Andrew Kaylor
5225ed2081 Add optimization bisect opt-in calls for SystemZ passes
Differential Revision: http://reviews.llvm.org/D19562



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267636 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 23:49:41 +00:00
Andrew Kaylor
347552aa8a Add optimization bisect opt-in calls for NVPTX passes
Differential Revision: http://reviews.llvm.org/D19518



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267635 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 23:44:31 +00:00
Quentin Colombet
ba357d2f7b [X86] Make sure it is safe to clobber EFLAGS, if need be, when choosing
the prologue.

Do not use basic blocks that have EFLAGS live-in as prologue if we need
to realign the stack. Realigning the stack uses AND instruction and this
clobbers EFLAGS.

An other alternative would have been to save and restore EFLAGS around
the stack realignment code, but this is likely inefficient.

Fixes PR27531.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267634 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 23:44:14 +00:00
Justin Bogner
c943cfacc2 PM: Port Reassociate to the new pass manager
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267631 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 23:39:29 +00:00
Mitch Bodart
573cbb5e7b [X86] Replace -mcpu with -mattr in several tests
Differential Revision: http://reviews.llvm.org/D19568


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267629 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 23:36:38 +00:00
Justin Bogner
b7e074989d Reassociate: Convert another functor into a lambda. NFC
Also move the explanatory comment with it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267628 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 23:32:00 +00:00
Philip Reames
aa06cc178a [LVI] Cut short search if we know we can't return a useful result
Previously we were recursing on our operands for unary and binary operators regardless of whether we knew how to reason about the operator in question.  This has the effect of doing a potentially large amount of work, only to throw it away.  By checking whether the operation is one LVI can handle, we can cut short the search and return the (overdefined) answer more quickly.  The quality of the results produced should not change.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267626 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 23:27:33 +00:00
Sanjay Patel
b4a90e614d [SimplifyCFG] propagate branch metadata when creating select
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267624 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 23:15:48 +00:00
Quentin Colombet
316e8d944d [X86] Teach the expansion of copy instructions how to do proper liveness.
When the simple analysis provided by MachineBasicBlock::computeRegisterLiveness
fails, fall back on the LivePhysReg utility.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267623 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 23:14:32 +00:00
Quentin Colombet
1b369e43d3 [MachineBasicBlock] Take advantage of the partially dead information.
Thanks to that information we wouldn't lie on a register being live whereas it
is not.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267622 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 23:14:29 +00:00
Quentin Colombet
b62e24784c [MachineInstrBundle] Improvement the recognition of dead definitions.
Now, it is possible to know that partial definitions are dead definitions and
recognize that clobbered registers are also dead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267621 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 23:14:24 +00:00
Philip Reames
5fcdfef145 [LVI] Apply transfer rule for overdefine inputs for binary operators
As pointed out by John Regehr over in http://reviews.llvm.org/D19485, LVI was being incredibly stupid about applying its transfer rules.  Rather than gathering local facts from the expression itself, it was simply giving up entirely if one of the inputs was overdefined.  This greatly impacts the precision of the overall analysis and makes it far more fragile as well.

This patch builds on 267609 which did the same thing for unary casts.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267620 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 23:10:35 +00:00
Jingyue Wu
ab87c34c6a [NVPTX] Fix some usages of CodeGenOpt::None.
NVPTXLowerKernelArgs is required for correctness, so it should not be guarded
by CodeGenOpt::None.

NVPTXPeephole is optimization only, so it should be skipped when
CodeGenOpt::None.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267619 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 22:59:25 +00:00
Philip Reames
171bf70598 [LVI] A better fix for the assertion error introduced by 267609
Essentially, I was using the wrong size function.  For types which were sized, but not primitive, I wasn't getting a useful size for the operand and failed an assert.  I fixed this, and also added a guard that the input is a sized type.  Test case is for the original mistake.  I'm not sure how to actually exercise the sized type check.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267618 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 22:52:30 +00:00
Philip Reames
1f6f783d9c [LVI] Speculative fix for assertion seen in clang bots
I'll clean this up and add a test case shortly.  I want to make sure this does actually fix the bots; if not, I'll revert.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267617 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 22:31:53 +00:00
Sanjay Patel
d926422b16 [LowerExpectIntrinsic] make default likely/unlikely ratio bigger
We need the default ratio to be sufficiently large that it triggers transforms 
based on block frequency info (BFI) and plays well with the recently introduced
BranchProbability used by CGP.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267615 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 22:23:38 +00:00
Justin Bogner
7fd37fa92d Reassociate: Simplify using lambdas. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267614 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 22:22:18 +00:00
Philip Reames
7f3fd5dcbd [LVI] Infer local facts from unary expressions
As pointed out by John Regehr over in http://reviews.llvm.org/D19485, LVI was being incredibly stupid about applying its transfer rules. Rather than gathering local facts from the expression itself, it was simply giving up entirely if one of the inputs was overdefined. This greatly impacts the precision of the overall analysis and makes it far more fragile as well.

This patch implements only the unary operation case. Once this is in, I'll implement the same for the binary operations.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267609 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 21:48:16 +00:00
Andrew Kaylor
a5c0577492 Optimization bisect support in X86-specific passes
Differential Revision: http://reviews.llvm.org/D19439



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267608 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 21:44:24 +00:00
Ahmed Bougacha
fb52dfa04d [CodeGen] Add getBuildVector and getSplatBuildVector helpers. NFCI.
Differential Revision: http://reviews.llvm.org/D17176

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267606 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 21:15:30 +00:00
David Majnemer
de19e3a88c Revert "[SimplifyLibCalls] sprintf doesn't copy null bytes"
The destination buffer that sprintf uses is restrict qualified, we do
not need to worry about derived pointers referenced via format
specifiers.

This reverts commit r267580.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267605 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 21:04:47 +00:00
Nico Weber
45ba8e9827 Try to get ResponseFile.ll passing on Windows after r267556.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267599 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 20:32:51 +00:00
Zachary Turner
460e256b9c Remove more unused variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267598 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 20:32:35 +00:00
Elena Demikhovsky
b7f92d0916 Masked Store in Loop Vectorizer - bugfix
Fixed a bug in loop vectorization with conditional store.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267597 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 20:18:04 +00:00
Justin Bogner
c3ce5d9c39 PM: Port Internalize to the new pass manager
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267596 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 20:15:52 +00:00
Zachary Turner
1330a1c343 [llvm-pdbdump] Fix version reading on big endian systems.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267595 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 19:48:18 +00:00
Andrew Kaylor
650fa7d863 Add optimization bisect opt-in calls for Hexagon passes
Differential Revision: http://reviews.llvm.org/D19509



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267593 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 19:46:28 +00:00
Zachary Turner
cff4949683 Fix warnings and -Werror build on clang.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267589 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 19:24:10 +00:00
Zachary Turner
3784bf85f3 Parse and dump PDB DBI Stream Header Information
The DBI stream contains a lot of bookkeeping information for other
streams. In particular it contains information about section contributions
and linked modules. This patch is a first attempt at parsing some of the
information out of the DBI stream. It currently only parses and dumps the
headers of the DBI stream, so none of the module data or section
contribution data is pulled out.

This is just a proof of concept that we understand the basic properties of
the DBI stream's metadata, and followup patches will try to extract more
detailed information out.

Differential Revision: http://reviews.llvm.org/D19500
Reviewed By: majnemer, ruiu

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267585 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 18:42:34 +00:00
Krzysztof Parzyszek
87d4b8c4a1 [Tail duplication] Handle source registers with subregisters
When a block is tail-duplicated, the PHI nodes from that block are
replaced with appropriate COPY instructions. When those PHI nodes
contained use operands with subregisters, the subregisters were
dropped from the COPY instructions, resulting in incorrect code.

Keep track of the subregister information and use this information
when remapping instructions from the duplicated block.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267583 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 18:36:34 +00:00