136614 Commits

Author SHA1 Message Date
David Majnemer
2d62ce6ee8 Use the range variant of find/find_if instead of unpacking begin/end
If the result of the find is only used to compare against end(), just
use is_contained instead.

No functionality change is intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278469 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 03:55:06 +00:00
Duncan P. N. Exon Smith
369a6329ff ADT: Add ilist_iterator conversions to/from ilist_node
Allow an ilist_iterator to be constructed from an ilist_node, and give
access to the underlying ilist_node as well.

This will be used immediately in lld to support a type-erasure use case.
Longer term, they'll stick around once the iterator is using
ilist_node<NodeTy>* instead of NodeTy*.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278467 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 03:35:33 +00:00
Wei Mi
31333a7c12 Recommit 'Remove the restriction that MachineSinking is now stopped by
"insert_subreg, subreg_to_reg, and reg_sequence" instructions' after
adjusting some unittest checks.

This is to solve PR28852. The restriction was added at 2010 to make better register
coalescing. We assumed that it was not necessary any more. Testing results on x86
supported the assumption.

We will look closely to any performance impact it will bring and will be prepared
to help analyzing performance problem found on other architectures.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278466 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 03:33:22 +00:00
Haicheng Wu
df403b36e6 [BranchFolding] Restrict tail merging loop blocks after MBP
To fix PR28014, this patch restricts tail merging to blocks that belong to the
same loop after MBP.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278463 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 03:30:23 +00:00
Ivan Krasin
d79f1f1720 WholeProgramDevirt: initialize WasDevirt in all constructors.
Summary: This is a follow up to r278389 and r278442.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278455 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 01:40:10 +00:00
Eli Friedman
35ff6f0857 [DSE] Don't remove stores made live by a call which unwinds.
Issue exposed by noalias or more aggressive alias analysis.

Fixes http://llvm.org/PR25422.

Differential revision: https://reviews.llvm.org/D21007



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278451 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 01:09:53 +00:00
Pete Cooper
2d34392ce2 Refactor isValidAssumeForContext to reduce duplication and indentation. NFC.
This method had some duplicate code when we did or did not have a dom tree.  Refactor
it to remove the duplication, but also clean up the control flow to have less duplication.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278450 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 01:00:15 +00:00
David Majnemer
b0353c6db2 Use the range variant of find_if instead of unpacking begin/end
No functionality change is intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278443 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 00:18:03 +00:00
Ivan Krasin
88add6b31b WholeProgramDevirt: fix access to a non-initialized field.
Summary: This is a follow up to r278389, where I have introduced the bug

Reviewers: mehdi_amini

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278442 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 00:07:14 +00:00
Xinliang David Li
b9ecebcaa5 Add comment /NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278438 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 23:09:56 +00:00
Tim Shen
161e82b933 [ADT] Migrate DepthFirstIterator to use NodeRef
Summary:
Notice that the data layout is changed: instead of using
std::pair<PointerIntPair<NodeType*, 1>, ChildItTy>, now use
std::pair<NodeRef, Optional<ChildItTy>>.

A NFC but worth noticing change is operator==(), since we only compare
an iterator against end(), it's better to put an assert there and make
people noticed when it fails.

Reviewers: dblaikie, chandlerc

Subscribers: mzolotukhin, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278437 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 22:36:16 +00:00
Xinliang David Li
124c0a493c Fix typos /NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278436 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 22:34:00 +00:00
Pete Cooper
ae480017c2 Remove unnecessary extra version of isValidAssumeForContext. NFC.
There were 2 versions of this method.  A public one which takes a
const Instruction* and a private implementation which takes a mutable
Value* and casts to an Instruction*.

There was no need for the 2 versions as all callers pass a const Instruction*
and there was no need for a mutable pointer as we only do analysis here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278434 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 22:23:07 +00:00
David Majnemer
975248e4fb Use the range variant of find instead of unpacking begin/end
If the result of the find is only used to compare against end(), just
use is_contained instead.

No functionality change is intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278433 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 22:21:41 +00:00
Piotr Padlewski
fb2a7f990d Don't import variadic functions
Summary:
This patch adds IsVariadicFunction bit to summary in order
to not import variadic functions. Inliner doesn't inline
variadic functions because it is hard to reason about it.

This one small fix improves Importer by about 16%
(going from 86% to 100% of imported functions that are
inlined anywhere)
on some spec benchmarks like 'int' and others.

Reviewers: eraman, mehdi_amini, tejohnson

Subscribers: mehdi_amini, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278432 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 22:13:57 +00:00
Vyacheslav Klochkov
5747888f2f X86-FMA3: Implemented commute transformation for EVEX/AVX512 FMA3 opcodes.
This helped to improved memory-folding and register coalescing optimizations.

Also, this patch fixed the tracker #17229.

Reviewer: Craig Topper.
Differential Revision: https://reviews.llvm.org/D23108


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278431 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 22:07:33 +00:00
Rui Ueyama
837032f833 Re-commit r278066: Do not ignore SizeOfOptionalHeader in COFF header even if PE header is not present.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278429 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 22:02:44 +00:00
Tim Northover
d4a60d05aa GlobalISel: support 'null' constant in translation.
It's sharing the integer G_CONSTANT for now since I don't *think* it creates
any ambiguity (even on weird archs). If that turns out wrong we can create a
G_PTRCONSTANT or something.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278423 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 21:40:55 +00:00
Ehsan Amiri
f11cae6f49 Extend trip count instead of truncating IV in LFTR, when legal
When legal, extending trip count in the loop control logic generates better code compared to truncating IV. This is because

(1) extending trip count is a loop invariant operation (see genLoopLimit where we prove trip count is loop invariant).
(2) Scalar Evolution seems to have problems understanding trunc when computing loop trip count. So removing them allows better analysis performed in Scalar Evolution. (In particular this fixes PR 28363 which is the motivation for this change).

I am not going to perform any performance test. Any degradation caused by this should be an indication of a bug elsewhere.

To prove legality, we rely on SCEV to prove zext(trunc(IV)) == IV (or similarly for sext). If this holds, we can prove equivalence of trunc(IV)==ExitCnt (1) and IV == zext(ExitCnt). Simply take zext of boths sides of (1) and apply the proven equivalence.

This commit contains changes in a newly added testcase which was not included in the previous commit (which was reverted later on).

https://reviews.llvm.org/D23075



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278421 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 21:31:40 +00:00
Daniel Berlin
417fcecd6b [MSSA] Use is_contained
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278418 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 21:26:50 +00:00
David Majnemer
dc9c737666 Use range algorithms instead of unpacking begin/end
No functionality change is intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278417 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 21:15:00 +00:00
Krzysztof Parzyszek
4110644365 [Hexagon] Allow non-returning calls in hardware loops
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278416 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 21:14:25 +00:00
David Majnemer
4df81566d5 [vim] Add more attributes to llvm.vim
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278415 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 21:14:05 +00:00
Matt Arsenault
2e8e1e63de AMDGPU: Remove unused tablegen utilities
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278414 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 21:08:43 +00:00
Geoff Berry
510ec2063e [SCEV] Update interface to handle SCEVExpander insert point motion.
Summary:
This is an extension of the fix in r271424.  That fix dealt with builder
insert points being moved by SCEV expansion, but only for the lifetime
of the expand call.  This change modifies the interface so that LSR can
safely call expand multiple times at the same insert point and do the
right thing if one of the expansions decides to move the original insert
point.

This is a fix for PR28719.

Reviewers: sanjoy

Subscribers: llvm-commits, mcrosier, mzolotukhin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278413 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 21:05:17 +00:00
Tim Northover
789ee9fd77 Remove empty file left by partial reversion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278411 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 21:01:15 +00:00
Tim Northover
814d8b30da GlobalISel: add translation support for shift operations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278410 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 21:01:13 +00:00
Tim Northover
94c692ea05 GlobalISel: support zext & sext during translation phase.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278409 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 21:01:10 +00:00
Teresa Johnson
fe3eab28ce Fix type truncation warnings
Avoid type truncation warnings from a 32-bit bot due to size_t not
being unsigned long long, by converting the variables and constants to
unsigned. This was introduced by r278338 and caused warnings here:
http://bb.pgr.jp/builders/i686-mingw32-RA-on-linux/builds/15527/steps/build_llvmclang/logs/warnings%20%287%29

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278406 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 20:38:39 +00:00
Daniel Berlin
c9f97fcd4c Move GVNHoist tests into their own directory since it is a separate pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278404 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 20:35:07 +00:00
Wei Ding
2daf966c6f AMDGPU : Add intrinsic for instruction v_cvt_pk_u8_f32
Differential Revision: http://reviews.llvm.org/D23336

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278403 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 20:34:48 +00:00
Wei Mi
da956b94ff Revert rL278384 which caused several buildbot failures (like check failures in CodeGen/X86/clz.ll).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278402 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 20:33:37 +00:00
Daniel Berlin
828990c2fc Fix PR 28933
Summary:
This fixes PR 28933 by making sure GVNHoist does not try to recreate memory
accesses when it has not actually moved them.

Reviewers: sebpop

Subscribers: llvm-commits, george.burgess.iv

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278401 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 20:32:43 +00:00
Tim Shen
4c26d96c61 [ADT] Add relation operators for Optional
Summary: Make Optional's behavior the same as the coming std::optional.

Reviewers: dblaikie

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278397 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 20:10:15 +00:00
Duncan P. N. Exon Smith
eeb1d4fe2e CodeGen: Avoid dereferencing end() in MachineScheduler
Check MachineInstr::isDebugValue for the same instruction as we're
calling isSchedBoundary, avoiding the possibility of dereferencing
end().

This is a functionality change even when I!=end().  Matthias had a look
and agrees this is the right resolution (as opposed to checking for
end()).

This is triggered by a huge number of tests, but they happen to
magically pass right now.  I found this because WIP patches for PR26753
convert them into crashes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278394 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 20:03:09 +00:00
Matt Arsenault
44cd439f9a AMDGPU: Prune includes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278391 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 19:18:50 +00:00
Krzysztof Parzyszek
50f0fc5733 [Hexagon] Standardize "select" pseudo-instructions
- PS_pselect: general register pairs
- PS_vselect: vector registers (+ 128B version)
- PS_wselect: vector register pairs (+ 128B version)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278390 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 19:12:18 +00:00
Ivan Krasin
dcedd3b6ff WholeProgramDevirt: generate more detailed and accurate remarks.
Summary:
Keep track of all methods for which we have devirtualized at least
one call and then print them sorted alphabetically. That allows to
avoid duplicates and also makes the order deterministic.

Add optimization names into the remarks, so that it's easier to
understand how has each method been devirtualized.

Fix a bug when wrong methods could have been reported for
tryVirtualConstProp.

Reviewers: kcc, mehdi_amini

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278389 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 19:09:02 +00:00
Wei Mi
158f898c51 Remove the restriction that MachineSinking is now stopped by "insert_subreg,
subreg_to_reg, and reg_sequence" instructions.

This is to solve PR28852. The restriction was added at 2010 to make better register
coalescing. We assumed that it was not necessary any more. Testing results on x86
supported the assumption.

We will look closely to any performance impact it will bring and will be prepared
to help analyzing performance problem found on other architectures.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278384 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 18:42:56 +00:00
Krzysztof Parzyszek
3c99845d54 If-conversion incorrectly calculates liveness of redefined registers
Differential Revision: https://reviews.llvm.org/D23207


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278383 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 18:42:06 +00:00
Barnabas Bittner
847ddff694 Test commit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278380 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 18:34:29 +00:00
Andrew Kaylor
2f5689ff2f Target independent codesize heuristics for Loop Idiom Recognition
Patch by Sunita Marathe

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278378 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 18:28:33 +00:00
Easwaran Raman
2d003b3f5e Add a new method to create SimpleInliner instance and make pre-inliner use this.
This adds a createFunctionInliningPass pass that takes an InlineParams object and use this to create the pre-inliner pass. This prevents the regular inliner's threshold flag from influencing the preinliner.

Differential revision: https://reviews.llvm.org/D23377


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278377 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 18:24:08 +00:00
Krzysztof Parzyszek
cf9748d82d [Hexagon] Skip byval arguments when checking parameter attributes
From the point of view of register assignment, byval parameters are
ignored: a byval parameter is not going to be assigned to a register,
and it will not affect the assignments of subsequent parameters.
When matching registers with parameters in the bit tracker, make sure
to skip byval parameters before advancing the registers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278375 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 18:15:16 +00:00
Dominic Chen
fbdf373856 Improve virtual register handling when computing debug information
Summary: Some backends, like WebAssembly, use virtual registers instead of physical registers. This crashes the DbgValueHistoryCalculator pass, which assumes that all registers are physical. Instead, skip virtual registers when iterating aliases, and assume that they are clobbered.

Reviewers: dexonsmith, dschuff, aprantl

Subscribers: yurydelendik, llvm-commits, jfb, sunfish

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278371 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 17:52:40 +00:00
Michael Kuperstein
f1860b7beb Make TwoAddressInstructionPass::rescheduleMIBelowKill subreg-aware
This fixes PR28824.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278370 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 17:38:33 +00:00
Matt Arsenault
d751c97ce5 AMDGPU: Fix crashes on memory functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278369 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 17:31:42 +00:00
Matt Arsenault
9ffb824366 AArch64: Assert on analyzeBranch failing
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278366 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 17:22:59 +00:00
Michael Kuperstein
e99815b052 [AliasSetTracker] Delete dead code
Deletes unused remove() and containsPointer() interfaces. NFC.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278365 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 17:20:20 +00:00
Eugene Zelenko
c986ab210b Fix some Clang-tidy modernize and Include What You Use warnings.
Differential revision: https://reviews.llvm.org/D23291


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278364 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 17:20:18 +00:00