135208 Commits

Author SHA1 Message Date
Mehdi Amini
d800b6909f Add missing test for r275347 "[IPRA] Set callee saved registers to none for local function when IPRA is enabled."
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275358 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 01:31:20 +00:00
Davide Italiano
0f630b6089 [SCCP] Generalize tryToReplaceInstWithConstant to work also with arguments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275357 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 01:27:29 +00:00
Matthias Braun
18d2e0ea00 MIRParser: Fix MIRParser not reporting nullptr on error.
While some code paths in MIRParserImpl::parse() already returned nullptr
in case of error one of the important ones did not.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275355 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 00:42:37 +00:00
Adrian Prantl
57df85bcd9 Synchronize LLVM and clang's ObjCDeclSpec::ObjCPropertyAttributeKind.
This adds Clang-specific DWARF constants for nullability and ObjC
class properties that are already generated by clang. This patch adds
dwarfdump support and a more comprehensive testcase.

<rdar://problem/27335745>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275354 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 00:41:18 +00:00
Lang Hames
5daf897d80 [Object] Revert r275316, Archive::child_iterator changes, while I update lld.
Should fix the bots broken by r275316.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275353 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 00:37:04 +00:00
David Majnemer
3dc0c3e82b [ConstantFolding] Fold masked loads
We can constant fold a masked load if the operands are appropriately
constant.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275352 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 00:29:50 +00:00
Justin Lebar
7f0ddc40a0 Force a semicolon at the end of the LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE() macro.
This silences a warning about an extra semicolon on gcc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275349 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 23:52:19 +00:00
Mehdi Amini
f167a26c50 Add EnableIPRA to TargetOptions, and move the cl::opt -enable-ipra to TargetMachine.cpp
Avoid exposing a cl::opt in a public header and instead promote this
option in the API.
Alternatively, we could land the cl::opt in CommandFlags.h so that
it is available to every tool, but we would still have to find an
option for clang.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275348 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-13 23:39:46 +00:00
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