Commit Graph

136693 Commits

Author SHA1 Message Date
Dehao Chen
126e4c2d97 Fine tuning of sample profile propagation algorithm.
Summary: The refined propagation algorithm is more accurate and robust.

Reviewers: davidxl, dnovillo

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278522 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 16:22:12 +00:00
Artur Pilipenko
0ac09cb9b3 [x86] X86ISelLowering zext(add_nuw(x, C)) --> add(zext(x), C_zext)
Currently X86ISelLowering has a similar transformation for sexts:
sext(add_nsw(x, C)) --> add(sext(x), C_sext)

In this change I extend this code to handle zexts as well.

Reviewed By: spatel

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278520 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 16:08:30 +00:00
Ehsan Amiri
a3c080381b [BasicAA] Avoid calling GetUnderlyingObject, when the result of a previous call can be reused.
Recursive calls to aliasCheck from alias[GEP|Select|PHI] may result in a second call to GetUnderlyingObject for a Value, whose underlying object is already computed. This patch ensures that in this situations, the underlying object is not computed again, and the result of the previous call is resued.

https://reviews.llvm.org/D22305



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278519 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 16:05:03 +00:00
Artur Pilipenko
e5ae839357 [LVI] Take guards into account
Teach LVI to gather control dependant constraints from guards.

Reviewed By: sanjoy

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278518 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 15:52:23 +00:00
Teresa Johnson
c6f72e4c41 Add move ops to satisfy MSVC.
Try to appease Windows bots after r278508:
http://lab.llvm.org:8011/builders/sanitizer-windows/builds/27250
http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/14776

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278517 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 15:39:26 +00:00
Geoff Berry
67a14c076f [AArch64] Re-factor code shared by AArch64LoadStoreOpt and AArch64InstrInfo.
This re-factoring could cause the following slight changes in generated
code, though none were observed during testing:

- MachineScheduler could decide not to cluster some loads/stores if
  there are other load/stores with non-pairable opcodes that have the
  same base register and offset as a pairable set of load/stores.  One
  case of different MachineScheduler pairing did show up in my testing,
  but it wasn't due to this issue, but due
  BaseMemOpClusterMutation::clusterNeighboringMemOps() being unstable
  w.r.t. the order it considers memory operations.  See PR28942.

- The ImplicitNullChecks optimization could be done for more load/store
  opcodes.  This optimization isn't done for C/C++ code, so it didn't
  show up in my testing.

Reviewers: mcrosier, t.p.northover

Subscribers: aemerson, rengolin, mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278515 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 15:26:00 +00:00
Artur Pilipenko
e18f64c54a [LVI] Fix potential memory corruption in getValueFromCondition
Rewrite Visited[Cond] = getValueFromConditionImpl(..., Visited) statement which can lead to a memory corruption since getValueFromConditionImpl changes Visited map and invalidates the iterators.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278514 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 15:08:15 +00:00
Duncan P. N. Exon Smith
3e97be26b9 ADT: Share code for embedded sentinel traits, NFC
Share code for the (mostly problematic) embedded sentinel traits.
- Move the LLVM_NO_SANITIZE("object-size") attribute to
  ilist_half_embedded_sentinel_traits and ilist_embedded_sentinel_traits
  (previously it spread throughout the code duplication).
- Add an ilist_full_embedded_sentinel_traits which has no UB (but has
  the downside of storing the complete node).
- Replace all the custom sentinel traits in LLVM with a declaration of
  ilist_sentinel_traits that inherits from one of the embedded sentinel
  traits classes.

There are still custom sentinel traits in other LLVM subprojects.  I'll
remove those in a follow-up.

Nothing at all should be changing here, this is just rearranging code.
Note that the final goal here is to remove the sentinel traits
altogether, settling on the memory layout of
ilist_half_embedded_sentinel_traits without the UB.  This intermediate
step moves the logic into ilist.h.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278513 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 15:00:55 +00:00
Teresa Johnson
18ff139eea Fix type to avoid problems on 32-bit builds
lto::InputFile::Symbol::getCommonSize should return uint64_t instead of
size_t since it is returning the result of DataLayout::getTypeAllocSize
which returns uint64_t, and the result of getCommonSize is assigned to a
uint64_t variable. On 32-bit builds size_t is unsigned int and there are
type errors. This was introduced in r278338.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278512 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 14:55:43 +00:00
James Y Knight
396941b5b3 Revert "[Sparc] Leon errata fix passes."
...and the two followup commits:
Revert "[Sparc][Leon] Missed resetting option flags from check-in 278489."
Revert "[Sparc][Leon] Errata fixes for various errata in different
versions of the Leon variants of the Sparc 32 bit processor."

This reverts commit r274856, r278489, and r278492.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278511 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 14:48:09 +00:00
Teresa Johnson
7be175919a [PM] Port NameAnonFunction pass to new pass manager
Summary:
Port the NameAnonFunction pass and add a test.

Depends on D23439.

Reviewers: mehdi_amini

Subscribers: llvm-commits, mehdi_amini

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278509 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 14:03:36 +00:00
Teresa Johnson
3143f33d96 [PM] Port ModuleSummaryIndex analysis to new pass manager
Summary:
Port the ModuleSummaryAnalysisWrapperPass to the new pass manager.
Use it in the ported BitcodeWriterPass (similar to how we use the
legacy ModuleSummaryAnalysisWrapperPass in the legacy WriteBitcodePass).

Also, pass the -module-summary opt flag through to the new pass
manager pipeline and through to the bitcode writer pass, and add
a test that uses it.

Reviewers: mehdi_amini

Subscribers: llvm-commits, mehdi_amini

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278508 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 13:53:02 +00:00
Simon Pilgrim
3951c48624 [X86][SSE] Add support for combining target shuffles to PSLLDQ/PSRLDQ byte shifts
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278502 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 11:24:34 +00:00
Krzysztof Parzyszek
4502b2e1ab [Hexagon] Standardize pseudo-instructions for calls and returns
- CALLv3nr        PS_call_nr
- CALLRv3nr       PS_callr_nr
- CALLstk         PS_call_stk

- TCRETURNi       PS_tailcall_i
- TCRETURNr       PS_tailcall_r

- JMPret          PS_jmpret
- JMPrett         PS_jmprett
- JMPretf         PS_jmpretf
- JMPrettnew      PS_jmprettnew
- JMPretfnew      PS_jmpretfnew
- JMPrettnewpt    PS_jmprettnewpt
- JMPretfnewpt    PS_jmpretfnewpt


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278499 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 11:12:02 +00:00
Krzysztof Parzyszek
a8e8317d69 [Hexagon] Treat non-returning indirect calls as scheduling boundaries
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278498 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 11:01:10 +00:00
Artur Pilipenko
38a5bdc3be [LVI] Take range metadata into account while calculating icmp condition constraints
Take range metadata into account for conditions like this:

%length = load i32, i32* %length_ptr, !range !{i32 0, i32 2147483647}
%cmp = icmp ult i32 %a, %length

This is a common pattern for range checks where the length of the array is dynamically loaded.

Reviewed By: sanjoy

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278496 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 10:14:11 +00:00
Benjamin Kramer
a4d5334736 [Webassembly] disable unstable test.
It reads uninitialized memory and crashes randomly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278495 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 10:13:45 +00:00
Simon Pilgrim
f811c0f4a2 [X86][SSE] Fixed PALIGNR target shuffle decode
The PALIGNR target shuffle decode was not taking into account that DecodePALIGNRMask (rather oddly) expects the operands to be in reverse order, nor was it detecting unary patterns, causing combines to combine with the incorrect input.

The cgbuiltin, auto upgrade and instruction comments code correctly swap the operands so are not affected.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278494 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 10:10:51 +00:00
Artur Pilipenko
a6da8aab67 [LVI] Handle any predicate in comparisons like icmp <pred> (add Val, Offset), ...
Currently LVI can only gather value constraints from comparisons like:

* icmp <pred> Val, ...
* icmp ult (add Val, Offset), ...

In fact we can handle any predicate in latter comparisons.

Reviewed By: sanjoy

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278493 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 10:05:11 +00:00
Chris Dewhurst
6af6409f90 [Sparc][Leon] Missed resetting option flags from check-in 278489.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278492 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 09:54:39 +00:00
Chris Dewhurst
85f3311cd5 [Sparc][Leon] Errata fixes for various errata in different versions of the Leon variants of the Sparc 32 bit processor.
The nature of the errata are listed in the comments preceding the errata fix passes. Relevant unit tests are implemented for each of these.

These changes update older versions of these errata fixes with improvements to code and unit tests.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278489 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 09:34:26 +00:00
Benjamin Kramer
94e4f70d0e [Coroutines] Move class into anonymous namespace.
Hopefully fixes visibility warnings from GCC. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278485 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 08:47:13 +00:00
Haicheng Wu
2790d230b8 Revert "[BranchFolding] Restrict tail merging loop blocks after MBP"
This reverts commit r278463 because it hits the bot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278484 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 08:40:24 +00:00
Gor Nishanov
b6ae34d909 [Coroutines]: Part6b: Add coro.id intrinsic.
Summary:
1. Make coroutine representation more robust against optimization that may duplicate instruction by introducing coro.id intrinsics that returns a token that will get fed into coro.alloc and coro.begin. Due to coro.id returning a token, it won't get duplicated and can be used as reliable indicator of coroutine identify when a particular coroutine call gets inlined.
2. Move last three arguments of coro.begin into coro.id as they will be shared if coro.begin will get duplicated.
3. doc + test + code updated to support the new intrinsic.

Reviewers: mehdi_amini, majnemer

Subscribers: mehdi_amini, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278481 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 05:45:49 +00:00
Duncan P. N. Exon Smith
21bcd75d9b ADT: Remove all ilist_iterator => pointer casts, NFC
Remove all ilist_iterator to pointer casts.  There were two reasons for
casts:

  - Checking for an uninitialized (i.e., null) iterator.  I added
    MachineInstrBundleIterator::isValid() to check for that case.

  - Comparing an iterator against the underlying pointer value while
    avoiding converting the pointer value to an iterator.  This is
    occasionally necessary in MachineInstrBundleIterator, since there is
    an assertion in the constructors that the underlying MachineInstr is
    not bundled (but we don't care about that if we're just checking for
    pointer equality).

To support the latter case, I rewrote the == and != operators for
ilist_iterator and MachineInstrBundleIterator.

  - The implicit constructors now use enable_if to exclude
    const-iterator => non-const-iterator conversions from overload
    resolution (previously it was a compiler error on instantiation, now
    it's SFINAE).

  - The == and != operators are now global (friends), and are not
    templated.

  - MachineInstrBundleIterator has overloads to compare against both
    const_pointer and const_reference.  This avoids the implicit
    conversions to MachineInstrBundleIterator that assert, instead just
    checking the address (and I added unit tests to confirm this).

Notably, the only remaining uses of ilist_iterator::getNodePtrUnchecked
are in ilist.h, and no code outside of ilist*.h directly relies on this
UB end-iterator-to-pointer conversion anymore.  It's still needed for
ilist_*sentinel_traits, but I'll clean that up soon.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278478 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 05:05:36 +00:00
David Majnemer
7e45eb5f3f Use the range variant of transform instead of unpacking begin/end
No functionality change is intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278477 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 04:32:45 +00:00
David Majnemer
ac0eb3d821 Use the range variant of transform instead of unpacking begin/end
No functionality change is intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278476 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 04:32:42 +00:00
David Majnemer
5d08e375ab Use the range variant of remove_if instead of unpacking begin/end
No functionality change is intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278475 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 04:32:37 +00:00
David Majnemer
33ebfce237 Use the range variant of count_if instead of unpacking begin/end
No functionality change is intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278474 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12 04:32:29 +00:00
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