135050 Commits

Author SHA1 Message Date
Mehdi Amini
bf8318ccc8 [IPRA] Set callee saved registers to none for local function when IPRA is enabled.
IPRA try to optimize caller saved register by propagating register
usage information from callee to caller so it is beneficial to have
caller saved registers compare to callee saved registers when IPRA
is enabled. Please find more detailed explanation here
https://groups.google.com/d/msg/llvm-dev/XRzGhJ9wtZg/tjAJqb0eEgAJ.

This change makes local function do not have any callee preserved
register when IPRA is enabled. A simple test case is also added to
verify this change.

Patch by Vivek Pandya <vivekvpandya@gmail.com>

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275347 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 23:39:34 +00:00
Sanjoy Das
47acfe627c [JumpThreading] Delete commented out debug code; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275346 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 23:33:20 +00:00
David Majnemer
46fef919d4 [ConstantFolding] Extend FoldReinterpretLoadFromConstPtr to handle negative offsets
Treat loads which clip before the start of a global initializer the same
way we treat clipping beyond the end of the initializer: use zeros.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275345 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 23:33:07 +00:00
David Majnemer
d2dd1e2fd6 Move a transform from InstCombine to InstSimplify.
This transform doesn't require any new instructions, it can safely live
in InstSimplify.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275344 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 23:32:53 +00:00
Michael Kuperstein
95c81ed0a1 Fix copy/paste bug in r275340.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275343 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 23:28:00 +00:00
Matthias Braun
67cca86db4 MIRParser: Move SlotMapping and SourceMgr refs to PFS; NFC
Code cleanup: Move references to SlotMapping and SourceMgr into the
PerFunctionMIParsingState to avoid unnecessary passing around in
parameters.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275342 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 23:27:50 +00:00
Michael Kuperstein
a38e7e4c53 [DAG] Correctly chain masked loads
If a masked loads is not added to the chain, it should not reset the chain's
root.

This fixes the remaining part of PR28515.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275340 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 23:23:40 +00:00
Davide Italiano
1fed24e4d7 [SCCP] Have the logic for replacing insts with constant in a single place.
The code was pretty much copy-pasted between SCCP and IPSCCP. The situation
became clearly worse after I introduced the support for folding structs in
SCCP.  This commit is NFC as we currently (still) skip the replacement
step in IPSCCP, but I'll change this soon.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275339 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 23:20:04 +00:00
Vedant Kumar
6ee27ade11 [Coverage] Return an ArrayRef to avoid copies (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275338 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 23:12:26 +00:00
Vedant Kumar
fa8c832177 [Coverage] Mark a few methods const (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275337 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 23:12:23 +00:00
Adam Nemet
81c98a7118 [LAA] Don't hold on to DominatorTree in the analysis result
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275335 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 22:36:35 +00:00
Adam Nemet
e12bf89766 [LAA] Don't hold on to TargetLibraryInfo in the analysis result
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275334 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 22:36:27 +00:00
Quentin Colombet
88a264d59f [MIR] Fix one GlobalISel test case that I missed in r275314.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275333 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 22:35:33 +00:00
Justin Lebar
6e665c85a4 [MI] Clean up some loops over MachineInstr::memoperands(). NFC
Use range-based for loops and llvm::any_of instead of explicit
iterators.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275332 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 22:35:19 +00:00
Justin Lebar
ff8bc4a1cf [MI] Fix MachineInstr::isInvariantLoad.
Summary:
Previously it would say we had an invariant load if any of the memory
operands were invariant.  But the load should be invariant only if *all*
the memory operands are invariant.

No testcase because this has proven to be very difficult to tickle in
practice.  As just one example, ARM's ldrd instruction, which loads 64
bits into two 32-bit regs, is theoretically affected by this.  But when
it's produced, it loses its memoperands' invariance bits!

Reviewers: jfb

Subscribers: llvm-commits, aemerson

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275331 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 22:34:50 +00:00
Matthias Braun
13b86678de MIRParser: Move MachineFunction reference into PFS; NFC
Code cleanup: The PerFunctionMIParsingState is per function, moving a
reference into PFS we can avoid passing around the MachineFunction in an
extra parameter most of the time.

Also change most signatures to consistently pass PFS reference first.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275329 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 22:23:23 +00:00
Matthias Braun
d7903640ac MIRYamlMapping: Update stale comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275328 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 22:23:19 +00:00
Nico Weber
cf7c29efff Add a triple to fix test on bots after 275320.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275327 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 22:19:40 +00:00
Adam Nemet
f5d4047fea [LAA] Don't hold on to DataLayout in the analysis result
In fact, don't even pass this to the ctor since we can get it from the
module.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275326 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 22:18:51 +00:00
Adam Nemet
703303a42c [LAA] Don't hold on to LoopInfo in the analysis result
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275325 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 22:18:48 +00:00
Adam Nemet
2ba3aa2758 [LAA] Don't hold on to AliasAnalysis in the analysis result
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275322 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 21:39:09 +00:00
Vedant Kumar
9240c457f7 [llvm-cov] Use a thread pool to speed up report generation (NFC)
It's safe to print out source coverage views using multiple threads when
using the -output-dir mode of the `llvm-cov show` sub-command.

While testing this on my development machine, I observed that the speed
up is roughly linear with the number of available cores. Avg. time for
`llvm-cov show ./llvm-as -show-line-counts-or-regions`:

    1 thread: 7.79s user 0.33s system 98% cpu 8.228 total
    4 threads: 7.82s user 0.34s system 283% cpu 2.880 total

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275321 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 21:38:36 +00:00
Nico Weber
a48eee2309 Fix a TODO in X86CallFrameOptimization to not rely on a codegen artifact.
This happens to make X86CallFrameOptimization in -O0 / FastISel builds as well,
but it's not clear if the pass should run in that setup.

http://reviews.llvm.org/D22314


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275320 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 21:38:27 +00:00
Teresa Johnson
ba51593080 Mark the textual headers in the module map for ProfileData
Follow on to r275312.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275319 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 21:27:51 +00:00
Alina Sbirlea
2c9bd4fc5e Extended LoadStoreVectorizer to vectorize subchains.
Summary:
LSV used to abort vectorizing a chain for interleaved load/store accesses that alias.
Allow a valid prefix of the chain to be vectorized, mark just the prefix and retry vectorizing the remaining chain.

Reviewers: llvm-commits, jlebar, arsenm

Subscribers: mzolotukhin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275317 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 21:20:01 +00:00
Lang Hames
9b42acafff [Object] Change Archive::child_iterator for better interop with Error/Expected.
See http://reviews.llvm.org/D22079

Changes the Archive::child_begin and Archive::children to require a reference
to an Error. If iterator increment fails (because the archive header is
damaged) the iterator will be set to 'end()', and the error stored in the
given Error&. The Error value should be checked by the user immediately after
the loop. E.g.:

Error Err;
for (auto &C : A->children(Err)) {
  // Do something with archive child C.
}
// Check the error immediately after the loop.
if (Err)
  return Err;

Failure to check the Error will result in an abort() when the Error goes out of
scope (as guaranteed by the Error class).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275316 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 21:13:05 +00:00
Quentin Colombet
3d35f0d482 [MIR] Print on the given output instead of stderr.
Currently the MIR framework prints all its outputs (errors and actual
representation) on stderr.

This patch fixes that by printing the regular output in the output
specified with -o.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275314 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 20:36:03 +00:00
Teresa Johnson
2b1c1c15c8 Define a module map entry for ProfileData.
As per Richard Smith, this should help avoid a modules bug exposed
by my r275216 commit:
http://lab.llvm.org:8011/builders/clang-x86_64-linux-selfhost-modules/builds/17560

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275312 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 20:19:09 +00:00
Matt Arsenault
ff534250d4 AMDGPU: Remove last AMDIL intrinsics
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275309 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 19:42:06 +00:00
Davide Italiano
c57350c893 [SCCP] Factor out common code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275308 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 19:33:25 +00:00
Davide Italiano
06c68c215f [SCCP] Use early return. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275307 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 19:23:30 +00:00
Andrew Kaylor
b9ed6a643a Reverting r275284 due to platform-specific test failures
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275304 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 19:09:16 +00:00
Sanjay Patel
a8caac0e00 add more tests for zexty xor sandwiches
...mmm sandwiches


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275302 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 18:58:55 +00:00
Simon Pilgrim
f296054913 [X86][SSE] Regenerate truncated shift test
Check SSE2 and AVX2 implementations

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275300 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 18:50:10 +00:00
Simon Pilgrim
d60c722314 Regenerate test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275299 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 18:46:37 +00:00
Sanjay Patel
d7113ae160 add test for zexty xor sandwich
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275297 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 18:40:38 +00:00
Justin Lebar
59b5dbccba Fix header comment in unittests/CodeGen/DIEHashTest.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275296 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 18:38:20 +00:00
Krzysztof Parzyszek
73aacfbbdb Move mempcpy_call.ll to X86 subdirectory
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275294 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 18:28:45 +00:00
Justin Lebar
00e79db851 Fix warning in ObjectTransformLayerTest.
Doing "I++" inside of an EXPECT_* triggers

  warning: expression with side effects has no effect in an unevaluated context

because EXPECT_* partially expands to

  EqHelper<(sizeof(::testing::internal::IsNullLiteralHelper(MockObjects[I++] + 1)) == 1)>

which is an unevaluated context.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275293 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 18:27:49 +00:00
Justin Lebar
972586b5a1 [ADT] Add LLVM_MARK_AS_BITMASK_ENUM, used to enable bitwise operations on enums without static_cast.
Summary: Normally when you do a bitwise operation on an enum value, you
get back an instance of the underlying type (e.g. int).  But using this
macro, bitwise ops on your enum will return you back instances of the
enum.  This is particularly useful for enums which represent a
combination of flags.

Suppose you have a function which takes an int and a set of flags.  One
way to do this would be to take two numeric params:

  enum SomeFlags { F1 = 1, F2 = 2, F3 = 4, ... };
  void Fn(int Num, int Flags);

  void foo() {
    Fn(42, F2 | F3);
  }

But now if you get the order of arguments wrong, you won't get an error.

You might try to fix this by changing the signature of Fn so it accepts
a SomeFlags arg:

  enum SomeFlags { F1 = 1, F2 = 2, F3 = 4, ... };
  void Fn(int Num, SomeFlags Flags);

  void foo() {
    Fn(42, static_cast<SomeFlags>(F2 | F3));
  }

But now we need a static cast after doing "F2 | F3" because the result
of that computation is the enum's underlying type.

This patch adds a mechanism which gives us the safety of the second
approach with the brevity of the first.

  enum SomeFlags {
    F1 = 1, F2 = 2, F3 = 4, ..., F_MAX = 128,
    LLVM_MARK_AS_BITMASK_ENUM(F_MAX)
  };

  void Fn(int Num, SomeFlags Flags);

  void foo() {
    Fn(42, F2 | F3);  // No static_cast.
  }

The LLVM_MARK_AS_BITMASK_ENUM macro enables overloads for bitwise
operators on SomeFlags.  Critically, these operators return the enum
type, not its underlying type, so you don't need any static_casts.

An advantage of this solution over the previously-proposed BitMask class
[0, 1] is that we don't need any wrapper classes -- we can operate
directly on the enum itself.

The approach here is somewhat similar to OpenOffice's typed_flags_set
[2].  But we skirt the need for a wrapper class (and a good deal of
complexity) by judicious use of enable_if.  We SFINAE on the presence of
a particular enumerator (added by the LLVM_MARK_AS_BITMASK_ENUM macro)
instead of using a traits class so that it's impossible to use the enum
before the overloads are present.  The solution here also seamlessly
works across multiple namespaces.

[0] http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20150622/283369.html
[1] http://lists.llvm.org/pipermail/llvm-commits/attachments/20150623/073434b6/attachment.obj
[2] https://cgit.freedesktop.org/libreoffice/core/tree/include/o3tl/typed_flags_set.hxx

Reviewers: chandlerc, rsmith

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275292 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 18:23:16 +00:00
Justin Lebar
73771535f3 Fix warnings in FunctionTest.cpp.
Because of the goop involved in the EXPECT_EQ macro, we were getting the
following warning

  expression with side effects has no effect in an unevaluated context

because the "I++" was being used inside of a template type:

  switch (0) case 0: default: if (const ::testing::AssertionResult gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing::internal::IsNullLiteralHelper(Args[I++])) == 1)>::Compare("Args[I++]", "&A", Args[I++], &A))) ; else ::testing::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure, "../src/unittests/IR/FunctionTest.cpp", 94, gtest_ar.failure_message()) = ::testing::Message();

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275291 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 18:17:46 +00:00
Sanjay Patel
c45e9127fc [InstCombine] extend vector select matching for non-splat constants
In D21740, we discussed trying to make this a more general matcher. However, I didn't see a clean
way to handle the regular m_Not cases and these non-splat vector patterns, so I've opted for the
direct approach here. If there are other potential uses of areInverseVectorBitmasks(), we could
move that helper function to a higher level.

There is an open question as to which is of these forms should be considered the canonical IR:
  %sel = select <4 x i1> <i1 true, i1 false, i1 false, i1 true>, <4 x i32> %a, <4 x i32> %b
  %shuf = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 5, i32 6, i32 3>

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275289 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 18:07:02 +00:00
Marek Olsak
6b62d37e9b AMDGPU/SI: Emit the number of SGPR and VGPR spills
Summary:
v2: don't count SGPRs spilled to scratch twice

I think this is sufficient. It doesn't count private memory usage, which
happens often and uses scratch but isn't technically a spill. The private
memory usage can be computed by:
  [scratch_per_thread - vgpr_spills - a random multiple of SGPR spills].

The fact SGPR spills add very high numbers to the scratch size make that
computation a guessing game, but I don't have a solution to that.

Reviewers: tstellarAMD

Subscribers: arsenm, kzhuravl

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275288 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 17:35:15 +00:00
Andrew Kaylor
c949e6e642 Fix for Bug 26903, adds support to inline __builtin_mempcpy
Patch by Sunita Marathe

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275284 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 17:25:11 +00:00
David Blaikie
c0ba7ba967 PR28516: Fix LangRef description of call and invoke to match IR changes for typeless pointers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275283 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 17:21:34 +00:00
Matthias Braun
e01c09683d PatchableFunction: Skip pseudos that do not create code
This fixes http://llvm.org/PR28524

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275278 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 16:37:29 +00:00
Teresa Johnson
929c941856 [ThinLTO/gold] Enable symbol resolution in distributed backend case
While testing a follow-on change to enable index-based symbol resolution
and internalization in the distributed backends, I realized that a test
case change I made in r275247 was only required because we were not
analyzing symbols in the claimed files in thinlto-index-only mode.

In the fixed test case there should be no internalization because we are
linking in -shared mode, so f() is in fact exported, which is detected
properly when we analyze symbols in thinlto-index-only mode. Note that
this is not (yet) a correctness issue (because we are not yet performing
the index-based linkage optimizations in the distributed backends -
that's coming in a follow-on patch).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275277 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 16:35:56 +00:00
Sanjay Patel
2ca896a175 [x86][SSE/AVX] optimize pcmp results better (PR28484)
We know that pcmp produces all-ones/all-zeros bitmasks, so we can use that behavior to avoid unnecessary constant loading.

One could argue that load+and is actually a better solution for some CPUs (Intel big cores) because shifts don't have the
same throughput potential as load+and on those cores, but that should be handled as a CPU-specific later transformation if
it ever comes up. Removing the load is the more general x86 optimization. Note that the uneven usage of vpbroadcast in the
test cases is filed as PR28505:
https://llvm.org/bugs/show_bug.cgi?id=28505

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275276 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 16:04:07 +00:00
David Majnemer
549def0571 [ConstantFolding] Use sdiv_ov
This is a simplification, there should be no functional change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275273 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 15:53:46 +00:00
Simon Pilgrim
15e94506a9 [X86][AVX512] Add support for VPERMILPD/VPERMILPS variable shuffle mask comments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275272 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 15:45:36 +00:00