platform/upstream/llvm.git
8 years ago[LSan] Enable use_registers test for MIPS
Mohit K. Bhakkad [Thu, 3 Mar 2016 05:05:20 +0000 (05:05 +0000)]
[LSan] Enable use_registers test for MIPS

Reviewers: samsonov

Subscribers: jaydeep, sagar, llvm-commits

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

llvm-svn: 262581

8 years ago[BranchFolding] Change function name related with merging MMOs. NFC
Junmo Park [Thu, 3 Mar 2016 03:57:20 +0000 (03:57 +0000)]
[BranchFolding] Change function name related with merging MMOs. NFC

Summary:
Removing MMOs is not our prefer behavior any more.

Reviewers: mcrosier, reames

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

llvm-svn: 262580

8 years agoAMDGPU: Insert two S_NOP instructions for every high level source statement.
Tom Stellard [Thu, 3 Mar 2016 03:53:29 +0000 (03:53 +0000)]
AMDGPU: Insert two S_NOP instructions for every high level source statement.

Patch by: Konstantin Zhuravlyov

Summary: Tools, such as debugger, need to pause execution based on user input (i.e. breakpoint). In order to do this, two S_NOP instructions are inserted for each high level source statement: one before first isa instruction of high level source statement, and one after last isa instruction of high level source statement. Further, debugger may replace S_NOP instructions with S_TRAP instructions based on user input.

Reviewers: tstellarAMD, arsenm

Subscribers: echristo, dblaikie, arsenm, llvm-commits

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

llvm-svn: 262579

8 years ago[OPENMP 4.5] Initial support for data members in 'linear' clause.
Alexey Bataev [Thu, 3 Mar 2016 03:52:24 +0000 (03:52 +0000)]
[OPENMP 4.5] Initial support for data members in 'linear' clause.

OpenMP 4.5 allows to privatize data members of current class in member
functions. Patch adds initial support for privatization of data members
in 'linear' clause, no codegen support.

llvm-svn: 262578

8 years agoAMDGPU/SI: Don't try to move scratch wave offset when there are no free SGPRs
Tom Stellard [Thu, 3 Mar 2016 03:45:09 +0000 (03:45 +0000)]
AMDGPU/SI: Don't try to move scratch wave offset when there are no free SGPRs

Summary:
When there were no free SGPRs, we were trying to move this value into
some of the reserved registers which was causing a segmentation fault.

Reviewers: arsenm

Subscribers: arsenm, llvm-commits

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

llvm-svn: 262577

8 years agoCaught and fixed a typo in r262572.
Sean Callanan [Thu, 3 Mar 2016 02:22:05 +0000 (02:22 +0000)]
Caught and fixed a typo in r262572.

I should have checked and imported D's in-class initializer.
Instead I accidentally used ToField's in-class initializer,
which is always NULL so ToField will never get one.

<rdar://problem/24943405>

llvm-svn: 262576

8 years ago[X86] Enable forwarding bool arguments in tail calls (PR26305)
Hans Wennborg [Thu, 3 Mar 2016 02:06:32 +0000 (02:06 +0000)]
[X86] Enable forwarding bool arguments in tail calls (PR26305)

The code was previously not able to track a boolean argument
at a call site back to the formal argument of the caller.

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

llvm-svn: 262575

8 years agoInline a trivial CMakeLists.txt.
Rui Ueyama [Thu, 3 Mar 2016 01:56:23 +0000 (01:56 +0000)]
Inline a trivial CMakeLists.txt.

llvm-svn: 262574

8 years ago[PPCVSXFMAMutate] Temporarily disable this pass
Tim Shen [Thu, 3 Mar 2016 01:27:35 +0000 (01:27 +0000)]
[PPCVSXFMAMutate] Temporarily disable this pass

llvm-svn: 262573

8 years agoFixed a problem where the ASTImporter mishandled in-class initializers.
Sean Callanan [Thu, 3 Mar 2016 01:21:28 +0000 (01:21 +0000)]
Fixed a problem where the ASTImporter mishandled in-class initializers.

Previously, the ASTImporter, when copying a FieldDecl, would make the
new FieldDecl use the exact same in-class initializer as the original
FieldDecl, which is a problem since the initializer is in the wrong AST.
The initializer must be imported, just like all the other parts of the
field.

Doug Gregor reviewed this fix.

<rdar://problem/24943405>

llvm-svn: 262572

8 years ago[MBP] Renaming a confusing variable and add clarifying comments
Philip Reames [Thu, 3 Mar 2016 00:58:43 +0000 (00:58 +0000)]
[MBP] Renaming a confusing variable and add clarifying comments

Was discussed as part of http://reviews.llvm.org/D17830

llvm-svn: 262571

8 years agoFix Clang-tidy modernize-use-nullptr warnings in some files in source/Core; other...
Eugene Zelenko [Thu, 3 Mar 2016 00:51:40 +0000 (00:51 +0000)]
Fix Clang-tidy modernize-use-nullptr warnings in some files in source/Core; other minor fixes.

llvm-svn: 262570

8 years agoSimplify string operations. NFC.
Rui Ueyama [Thu, 3 Mar 2016 00:51:23 +0000 (00:51 +0000)]
Simplify string operations. NFC.

llvm-svn: 262569

8 years agoUse StringRef member function instead of including StringExtras.h
Rui Ueyama [Thu, 3 Mar 2016 00:51:21 +0000 (00:51 +0000)]
Use StringRef member function instead of including StringExtras.h

llvm-svn: 262568

8 years ago[lanai] Fixing file path used in test
Jacques Pienaar [Thu, 3 Mar 2016 00:30:02 +0000 (00:30 +0000)]
[lanai] Fixing file path used in test

llvm-svn: 262567

8 years agoDon't build source/Plugins/Process/Linux in the Xcode project file.
Jason Molenda [Thu, 3 Mar 2016 00:21:32 +0000 (00:21 +0000)]
Don't build source/Plugins/Process/Linux in the Xcode project file.
These files won't build for ios etc arm builds of lldb and aren't
used for macosx native lldb's.

http://reviews.llvm.org/D17750
<rdar://problem/24287153>

llvm-svn: 262566

8 years agoThis patch adds doxygen comments for all the intrinsincs in the header file tmmintrin.h.
Ekaterina Romanova [Thu, 3 Mar 2016 00:20:11 +0000 (00:20 +0000)]
This patch adds doxygen comments for all the intrinsincs in the header file tmmintrin.h.
The doxygen comments are automatically generated based on Sony's intrinsics document.

I got an OK from Eric Christopher to commit doxygen comments without prior code review upstream.

llvm-svn: 262565

8 years agoSerialize `pragma pointers_to_members` state.
Nico Weber [Thu, 3 Mar 2016 00:17:35 +0000 (00:17 +0000)]
Serialize `pragma pointers_to_members` state.

Like r262539, but for pointers_to_members.

llvm-svn: 262552

8 years agoImprove some infrastructure for extended parameter infos and
John McCall [Thu, 3 Mar 2016 00:10:03 +0000 (00:10 +0000)]
Improve some infrastructure for extended parameter infos and
fix a bug with the instantiation of ns_consumed parameter
attributes in ARC.

llvm-svn: 262551

8 years agoAllow joined options to fix http://llvm.org/pr26730.
Rui Ueyama [Thu, 3 Mar 2016 00:09:02 +0000 (00:09 +0000)]
Allow joined options to fix llvm.org/pr26730.

llvm-svn: 262550

8 years agoTargetSchedule: Allow explicit Unsupported markers in InstRW
Matthias Braun [Thu, 3 Mar 2016 00:05:07 +0000 (00:05 +0000)]
TargetSchedule: Allow explicit Unsupported markers in InstRW

llvm-svn: 262549

8 years agoTableGen: Accept itinerary data when checking for schedmodel completeness
Matthias Braun [Thu, 3 Mar 2016 00:04:59 +0000 (00:04 +0000)]
TableGen: Accept itinerary data when checking for schedmodel completeness

llvm-svn: 262548

8 years ago[MBP] Avoid placing random blocks between loop preheader and header
Philip Reames [Thu, 3 Mar 2016 00:01:42 +0000 (00:01 +0000)]
[MBP] Avoid placing random blocks between loop preheader and header

If we have a loop with a rarely taken path, we will prune that from the blocks which get added as part of the loop chain. The problem is that we weren't then recognizing the loop chain as schedulable when considering the preheader when forming the function chain. We'd then fall to various non-predecessors before finally scheduling the loop chain (as if the CFG was unnatural.) The net result was that there could be lots of garbage between a loop preheader and the loop, even though we could have directly fallen into the loop. It also meant we separated hot code with regions of colder code.

The particular reason for the rejection of the loop chain was that we were scanning predecessor of the header, seeing the backedge, believing that was a globally more important predecessor (true), but forgetting to account for the fact the backedge precessor was already part of the existing loop chain (oops!.

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

llvm-svn: 262547

8 years ago[X86] Don't give catch objects a displacement of zero
David Majnemer [Thu, 3 Mar 2016 00:01:25 +0000 (00:01 +0000)]
[X86] Don't give catch objects a displacement of zero

Catch objects with a displacement of zero do not initialize a catch
object.  The displacement is relative to %rsp at the end of the
function's prologue for x86_64 targets.

If we place an object at the top-of-stack, we will end up wit a
displacement of zero resulting in our catch object remaining
uninitialized.

Address this by creating our catch objects as fixed objects.  We will
ensure that the UnwindHelp object is created after the catch objects so
that no catch object will have a displacement of zero.

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

llvm-svn: 262546

8 years agoAdd SymbolFilePDB to xcode project file to keep it
Jason Molenda [Wed, 2 Mar 2016 23:39:59 +0000 (23:39 +0000)]
Add SymbolFilePDB to xcode project file to keep it
up to date after 4262528.

llvm-svn: 262543

8 years agoclang-cl pch test: Instead of copying the input, use /Fp to not write into the test...
Nico Weber [Wed, 2 Mar 2016 23:29:29 +0000 (23:29 +0000)]
clang-cl pch test: Instead of copying the input, use /Fp to not write into the test directory.

Also fix a bug with /Fp and absolute paths uncovered by this.
Follow-up to r262487.

llvm-svn: 262541

8 years ago[AArch64] add tests to demonstrate existing codegen for PR26819
Sanjay Patel [Wed, 2 Mar 2016 23:22:03 +0000 (23:22 +0000)]
[AArch64] add tests to demonstrate existing codegen for PR26819

llvm-svn: 262540

8 years agoSerialize `pragma ms_struct` state.
Nico Weber [Wed, 2 Mar 2016 23:22:00 +0000 (23:22 +0000)]
Serialize `pragma ms_struct` state.

pragma ms_struct has an effect on struct decls, and the effect is serialized
correctly already.  But the "is ms_struct currently on" state wasn't before
this change.

This uses the same approach as `pragma clang optimize`: When writing a module,
the state isn't serialized, only when writing a pch file.

llvm-svn: 262539

8 years agoAMDGPU: Simplify boolean conditional return statements
Matt Arsenault [Wed, 2 Mar 2016 23:00:21 +0000 (23:00 +0000)]
AMDGPU: Simplify boolean conditional return statements

Patch by Richard Thomson

llvm-svn: 262536

8 years agoAdd new OpenMP 4.5 taskloop construct feature
Jonathan Peyton [Wed, 2 Mar 2016 22:47:51 +0000 (22:47 +0000)]
Add new OpenMP 4.5 taskloop construct feature

From the standard: The taskloop construct specifies that the iterations of one
or more associated loops will be executed in parallel using OpenMP tasks. The
iterations are distributed across tasks created by the construct and scheduled
to be executed.

This initial implementation uses a simple linear tasks distribution algorithm.
Later we can add other algorithms to speedup generation of huge number of tasks
(i.e., tree-like tasks generation should be faster).

This needs to be put into the OpenMP runtime library in order for the
compiler team to develop the compiler side of the implementation.

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

llvm-svn: 262535

8 years agoclang-format: [JS] Optionally re-quote string literals.
Daniel Jasper [Wed, 2 Mar 2016 22:44:03 +0000 (22:44 +0000)]
clang-format: [JS] Optionally re-quote string literals.

Turns "foo" into 'foo' (or vice versa, depending on configuration).
This makes it more convenient to follow the Google JavaScript style
guide:
https://google.github.io/styleguide/javascriptguide.xml?showone=Strings#Strings

This functionality is behind the option "JavaScriptQuotes", which can be:

  * "leave" (no re-quoting)
  * "single" (change to single quotes)
  * "double" (change to double quotes)

This also changes single quoted JavaScript string literals to be treated
as tok::string_literal, not tok::char_literal, which fixes two unrelated
tests.

Patch by Martin Probst. Thank you.

llvm-svn: 262534

8 years agoForgot to add test files for doacross and task priority.
Jonathan Peyton [Wed, 2 Mar 2016 22:43:14 +0000 (22:43 +0000)]
Forgot to add test files for doacross and task priority.

llvm-svn: 262533

8 years agoAdd new OpenMP 4.5 doacross loop nest feature
Jonathan Peyton [Wed, 2 Mar 2016 22:42:06 +0000 (22:42 +0000)]
Add new OpenMP 4.5 doacross loop nest feature

From the standard: A doacross loop nest is a loop nest that has cross-iteration
dependence. An iteration is dependent on one or more lexicographically earlier
iterations. The ordered clause parameter on a loop directive identifies the
loop(s) associated with the doacross loop nest.

The init/fini routines allocate/free doacross buffer(s) for each loop for each
thread.  The wait routine waits for a flag designated by the dependence vector.
The post routine sets the flag designated by current iteration vector.  We use
a similar technique of shared buffer indices that covers up to 7 nowait loops
executed simultaneously by different threads (number 7 has no real meaning,
just heuristic value).  Also, the size of structures are kept intact via
reducing dummy arrays.

This needs to be put into the OpenMP runtime library in order for the compiler
team to develop the compiler side of the implementation.

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

llvm-svn: 262532

8 years ago[MBP] Remove overly verbose debug output
Philip Reames [Wed, 2 Mar 2016 22:40:51 +0000 (22:40 +0000)]
[MBP] Remove overly verbose debug output

llvm-svn: 262531

8 years agoExplode store of arrays in instcombine
Amaury Sechet [Wed, 2 Mar 2016 22:36:45 +0000 (22:36 +0000)]
Explode store of arrays in instcombine

Summary: This is the last step toward supporting aggregate memory access in instcombine. This explodes stores of arrays into a serie of stores for each element, allowing them to be optimized.

Reviewers: joker.eph, reames, hfinkel, majnemer, mgrang

Subscribers: llvm-commits

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

llvm-svn: 262530

8 years ago[llvm-nm] Restore the previous behaviour (pre r262525).
Davide Italiano [Wed, 2 Mar 2016 22:33:49 +0000 (22:33 +0000)]
[llvm-nm] Restore the previous behaviour (pre r262525).

It broke some buildbots.

Pointy-hat to:  me

llvm-svn: 262529

8 years agoAdd support for reading line tables from PDB files.
Zachary Turner [Wed, 2 Mar 2016 22:05:52 +0000 (22:05 +0000)]
Add support for reading line tables from PDB files.

PDB is Microsoft's debug information format, and although we
cannot yet generate it, we still must be able to consume it.
Reason for this is that debug information for system libraries
(e.g. kernel32, C Runtime Library, etc) only have debug info
in PDB format, so in order to be able to support debugging
of system code, we must support it.

Currently this code should compile on every platform, but on
non-Windows platforms the PDB plugin will return 0 capabilities,
meaning that for now PDB is only supported on Windows.  This
may change in the future, but the API is designed in such a way
that this will require few (if any) changes on the LLDB side.
In the future we can just flip a switch and everything will
work.

This patch only adds support for line tables.  It does not return
information about functions, types, global variables, or anything
else.  This functionality will be added in a followup patch.

Differential Revision: http://reviews.llvm.org/D17363
Reviewed by: Greg Clayton

llvm-svn: 262528

8 years agoAdd some minimal portability code paths for PS4.
Sean Silva [Wed, 2 Mar 2016 22:05:46 +0000 (22:05 +0000)]
Add some minimal portability code paths for PS4.

Summary:
Hi David, SCE folks,

What is implemented in this patch is enough for the upstream libprofile to
work for PGO with the PS4 game codebase I tested ("game7" for you SCE
folks; this is with a standalone build of compiler-rt).

The first change, which is simple, is to stub out gethostname. PS4
doesn't have a simple analog for this that doesn't bring in extra
OS libraries, so for now we do not support `%h` expansion.
This is consistent with internal B#136272.

The second change implies future work, but is a simple change at present.
PS4 does not have `getenv`, so for now we will introduce a shim.
This obviously makes it impossible for many of the tests to be run since
they require setting `LLVM_PROFILE_FILE=`.

I see two paths forward:

1. In the tests we are already wrapping execution with `%run` and so by
   setting a PS4-specific expansion for `%run` we can pass the information
   in another way We can adapt the getenv shim as appropriate.
   We will need to experiment with this internally.
   Maggie, Phillip, Filipe? Any ideas? Maybe ping me internally since we
   may need to get into some PS4 vagaries. I'm thinking a fake getenv
   library that uses some side channel for communication.

2. Another possibility which is more verbose is to use a separate clang
   invocation with `-profile-generate=<filename>` to set the filename in
   each test.
   This might require redundant clang invocations though which may be
   undesirable for upstream. David, thoughts?
   Also, this is a fairly libprofile-specific workaround, so it e.g.
   doesn't help Filipe's ASan work.
   Overall, this approach sounds like a bit of a hack to me.

Small detail:
InstrProfilingPort.h seems like the natural place for the getenv shim,
but GCDAProfiling.c needs it as well. InstrProfilingUtil.h is currently
the only header common between InstrProfilingFile.c and GCDAProfiling.c.
I can move the shim to InstrProfilingPort.h and add an include to
GCDAProfiling.c as per your preference David.

Reviewers: davidxl, MaggieYi, phillip.power, filcab

Subscribers: simon.f.whittaker, slingn, probinson, llvm-commits

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

llvm-svn: 262527

8 years ago[analyzer] Move ObjCSuperDeallocChecker out of the alpha package.
Devin Coughlin [Wed, 2 Mar 2016 22:01:03 +0000 (22:01 +0000)]
[analyzer] Move ObjCSuperDeallocChecker out of the alpha package.

It will now be on by default on Darwin.

rdar://problem/6953275

llvm-svn: 262526

8 years ago[llvm-nm] Fix rendering of -s grouping with all the othe options.
Davide Italiano [Wed, 2 Mar 2016 21:59:31 +0000 (21:59 +0000)]
[llvm-nm] Fix rendering of -s grouping with all the othe options.

llvm-svn: 262525

8 years ago[analyzer] Move ObjCDeallocChecker out of the alpha package.
Devin Coughlin [Wed, 2 Mar 2016 21:50:54 +0000 (21:50 +0000)]
[analyzer] Move ObjCDeallocChecker out of the alpha package.

It will now be on by default on Darwin.

rdar://problem/6927496

llvm-svn: 262524

8 years ago[MBP] Adjust debug output to be more focused and approachable
Philip Reames [Wed, 2 Mar 2016 21:45:13 +0000 (21:45 +0000)]
[MBP] Adjust debug output to be more focused and approachable

llvm-svn: 262522

8 years agoUnpack array of all sizes in InstCombine
Amaury Sechet [Wed, 2 Mar 2016 21:28:30 +0000 (21:28 +0000)]
Unpack array of all sizes in InstCombine

Summary: This is another step toward improving fca support. This unpack load of array in a series of load to array's elements.

Reviewers: chandlerc, joker.eph, majnemer, reames, hfinkel

Subscribers: llvm-commits

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

llvm-svn: 262521

8 years ago[analyzer] Fix capitalization in ObjCSuperDeallocChecker diagnostic.
Devin Coughlin [Wed, 2 Mar 2016 21:22:48 +0000 (21:22 +0000)]
[analyzer] Fix capitalization in ObjCSuperDeallocChecker diagnostic.

llvm-svn: 262520

8 years agoReally fix ASAN leak/etc issues with MemorySSA unittests
Daniel Berlin [Wed, 2 Mar 2016 21:16:28 +0000 (21:16 +0000)]
Really fix ASAN leak/etc issues with MemorySSA unittests

llvm-svn: 262519

8 years agoUse ld.lld instead of "lld -flavor gnu".
Rui Ueyama [Wed, 2 Mar 2016 21:11:36 +0000 (21:11 +0000)]
Use ld.lld instead of "lld -flavor gnu".

llvm-svn: 262518

8 years ago[libFuzzer] add -Werror for libFuzzer build rule
Kostya Serebryany [Wed, 2 Mar 2016 21:08:16 +0000 (21:08 +0000)]
[libFuzzer] add -Werror for libFuzzer build rule

llvm-svn: 262517

8 years agoFixed test failure platforms with name mangling different from Linux.
Artem Belevich [Wed, 2 Mar 2016 21:03:20 +0000 (21:03 +0000)]
Fixed test failure platforms with name mangling different from Linux.
* Run cc with -triple x86_64-linux-gnu to make symbol mangling predictable.
* Use temporary file as a fake GPU input so its content
  does not interfere with pattern matching.

llvm-svn: 262516

8 years ago[PGO] Change profile use cc1 option to handle IR level profiles
Rong Xu [Wed, 2 Mar 2016 20:59:36 +0000 (20:59 +0000)]
[PGO] Change profile use cc1 option to handle IR level profiles

This patch changes cc1 option for PGO profile use from
-fprofile-instr-use=<path> to -fprofile-instrument-use-path=<path>.
-fprofile-instr-use=<path> is now a driver only option.

In addition to decouple the cc1 option from the driver level option, this patch
also enables IR level profile use. cc1 option handling now reads the profile
header and sets CodeGenOpt ProfileUse (valid values are {None, Clang, LLVM}
-- this is a common enum for -fprofile-instrument={}, for the profile
instrumentation), and invoke the pipeline to enable the respective PGO use pass.

Reviewers: silvas, davidxl

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

llvm-svn: 262515

8 years agoFix minor bug in test
Xinliang David Li [Wed, 2 Mar 2016 20:59:11 +0000 (20:59 +0000)]
Fix minor bug in test

llvm-svn: 262514

8 years agoUse shallow clones in build-llvm.py.
Stephane Sezer [Wed, 2 Mar 2016 20:53:19 +0000 (20:53 +0000)]
Use shallow clones in build-llvm.py.

Summary:
This makes cloning (and therefore the whole build) faster.
The checkout step goes from ~4m to ~30s on my host.

Reviewers: tfiala

Subscribers: lldb-commits

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

llvm-svn: 262513

8 years agoRevert "Fix ASAN detected errors in code and test" (it was not meant to be committed...
Daniel Berlin [Wed, 2 Mar 2016 20:36:22 +0000 (20:36 +0000)]
Revert "Fix ASAN detected errors in code and test" (it was not meant to be committed yet)

This reverts commit 890bbccd600ba1eb050353d06a29650ad0f2eb95.

llvm-svn: 262512

8 years agoFix ASAN detected errors in code and test
Daniel Berlin [Wed, 2 Mar 2016 20:27:29 +0000 (20:27 +0000)]
Fix ASAN detected errors in code and test

llvm-svn: 262511

8 years agoAdd another test for the GlobalOpt change in r212079.
Bob Wilson [Wed, 2 Mar 2016 20:02:25 +0000 (20:02 +0000)]
Add another test for the GlobalOpt change in r212079.

This is a test that Akira Hatanaka wrote to test GlobalOpt's handling of
aliases with GEP operands. David Majnemer independently made the same
change to GlobalOpt in r212079. Akira's test is a useful addition, so I'm
pulling it over from the llvm repo for Swift on GitHub.

llvm-svn: 262510

8 years ago[libFuzzer] more trophies
Kostya Serebryany [Wed, 2 Mar 2016 19:45:10 +0000 (19:45 +0000)]
[libFuzzer] more trophies

llvm-svn: 262509

8 years agofix test from r262506
Nico Weber [Wed, 2 Mar 2016 19:38:24 +0000 (19:38 +0000)]
fix test from r262506

llvm-svn: 262508

8 years ago[ARM] Merging 64-bit divmod lib calls into one
Renato Golin [Wed, 2 Mar 2016 19:35:45 +0000 (19:35 +0000)]
[ARM] Merging 64-bit divmod lib calls into one

When div+rem calls on the same arguments are found, the ARM back-end merges the
two calls into one __aeabi_divmod call for up to 32-bits values. However,
for 64-bit values, which also have a lib call (__aeabi_ldivmod), it wasn't
merging the calls, and thus calling ldivmod twice and spilling the temporary
results, which generated pretty bad code.

This patch legalises 64-bit lib calls for divmod, so that now all the spilling
and the second call are gone. It also relaxes the DivRem combiner a bit on the
legal type check, since it was already checking for isLegalOrCustom on every
value, so the extra check for isTypeLegal was redundant.

This patch fixes PR17193 (and a long time FIXME in the tests).

llvm-svn: 262507

8 years agoSerialize `#pragma detect_mismatch`.
Nico Weber [Wed, 2 Mar 2016 19:28:54 +0000 (19:28 +0000)]
Serialize `#pragma detect_mismatch`.

This is like r262493, but for pragma detect_mismatch instead of pragma comment.
The two pragmas have similar behavior, so use the same approach for both.

llvm-svn: 262506

8 years agoRevert "[X86] Elide references to _chkstk for dynamic allocas"
Reid Kleckner [Wed, 2 Mar 2016 19:20:59 +0000 (19:20 +0000)]
Revert "[X86] Elide references to _chkstk for dynamic allocas"

This reverts commit r262370.

It turns out there is code out there that does sequences of allocas
greater than 4K: http://crbug.com/591404

The goal of this change was to improve the code size of inalloca call
sequences, but we got tangled up in the mess of dynamic allocas.
Instead, we should come back later with a separate MI pass that uses
dominance to optimize the full sequence. This should also be able to
remove the often unneeded stacksave/stackrestore pairs around the call.

llvm-svn: 262505

8 years agoARM: Introduce conservative load/store optimization mode
Matthias Braun [Wed, 2 Mar 2016 19:20:00 +0000 (19:20 +0000)]
ARM: Introduce conservative load/store optimization mode

Most of the time ARM has the CCR.UNALIGN_TRP bit set to false which
means that unaligned loads/stores do not trap and even extensive testing
will not catch these bugs. However the multi/double variants are not
affected by this bit and will still trap. In effect a more aggressive
load/store optimization will break existing (bad) code.

These bugs do not necessarily manifest in the broken code where the
misaligned pointer is formed but often later in perfectly legal code
where it is accessed. This means recompiling system libraries (which
have no alignment bugs) with a newer compiler will break existing
applications (with alignment bugs) that worked before.

So (under protest) I implemented this safe mode which limits the
formation of multi/double operations to cases that are not affected by
user code (stack operations like spills/reloads) or cases where the
normal operations trap anyway (floating point load/stores). It is
disabled by default.

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

llvm-svn: 262504

8 years ago[libFuzzer] allow -fsanitize-coverage=0 (disables all coverage)
Kostya Serebryany [Wed, 2 Mar 2016 19:16:54 +0000 (19:16 +0000)]
[libFuzzer] allow -fsanitize-coverage=0 (disables all coverage)

llvm-svn: 262503

8 years agoMerge DarwinLdDriver and Driver.
Rui Ueyama [Wed, 2 Mar 2016 19:08:05 +0000 (19:08 +0000)]
Merge DarwinLdDriver and Driver.

Now that DarwinLdDriver is the only derived class of Driver.
This patch merges them and actually removed the class because
they can now just be non-member functions. This change simplifies
a common header, Driver.h.

http://reviews.llvm.org/D17788

llvm-svn: 262502

8 years agoUse C++11 initializers for data members.
Rui Ueyama [Wed, 2 Mar 2016 19:06:20 +0000 (19:06 +0000)]
Use C++11 initializers for data members.

http://reviews.llvm.org/D17793

llvm-svn: 262501

8 years agoSelectionDAG: Use correctly sized allocation functions for SDNodes
Justin Bogner [Wed, 2 Mar 2016 19:01:11 +0000 (19:01 +0000)]
SelectionDAG: Use correctly sized allocation functions for SDNodes

The placement new calls here were all calling the allocation function
in RecyclingAllocator/Recycler for SDNode, instead of the function for
the specific subclass we were constructing.

Since this particular allocator always overallocates it more or less
worked, but would hide what we're actually doing from any memory
tools. Also, if you tried to change this allocator so something like a
BumpPtrAllocator or MallocAllocator, the compiler would crash horribly
all the time.

Part of llvm.org/PR26808.

llvm-svn: 262500

8 years ago[CUDA] Do not generate unnecessary runtime init code.
Artem Belevich [Wed, 2 Mar 2016 18:28:53 +0000 (18:28 +0000)]
[CUDA] Do not generate unnecessary runtime init code.

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

llvm-svn: 262499

8 years ago[CUDA] Emit host-side 'shadows' for device-side global variables
Artem Belevich [Wed, 2 Mar 2016 18:28:50 +0000 (18:28 +0000)]
[CUDA] Emit host-side 'shadows' for device-side global variables

... and register them with CUDA runtime.

This is needed for commonly used cudaMemcpy*() APIs that use address of
host-side shadow to access their counterparts on device side.

Fixes PR26340

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

llvm-svn: 262498

8 years ago1Fix handling of undef in partial LTO.
Rafael Espindola [Wed, 2 Mar 2016 18:21:46 +0000 (18:21 +0000)]
1Fix handling of undef in partial LTO.

llvm-svn: 262497

8 years ago[AArch64] Enable non-leaf frame pointer elimination.
Geoff Berry [Wed, 2 Mar 2016 17:58:31 +0000 (17:58 +0000)]
[AArch64] Enable non-leaf frame pointer elimination.

Summary:
This change enables frame pointer elimination in non-leaf functions.
The -fomit-frame-pointer option still needs to be used when compiling
via clang (or an equivalent method of not setting the
'no-frame-pointer-elim*' function attributes if generating llvm IR via
some other method) to take advantage of this optimization.

This change should be NFC when compiling via clang without
-fomit-frame-pointer.

Reviewers: t.p.northover

Subscribers: aemerson, rengolin, tberghammer, qcolombet, llvm-commits, danalbert, mcrosier, srhines

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

llvm-svn: 262495

8 years ago[CMake] Add test-depends target to build dependencies of check-all
Chris Bieneman [Wed, 2 Mar 2016 17:56:30 +0000 (17:56 +0000)]
[CMake] Add test-depends target to build dependencies of check-all

This is just another convenience target for bots to use. It enables isolation of building and testing.

llvm-svn: 262494

8 years agoSerialize `#pragma comment`.
Nico Weber [Wed, 2 Mar 2016 17:28:48 +0000 (17:28 +0000)]
Serialize `#pragma comment`.

`#pragma comment` was handled by Sema calling a function on ASTConsumer, and
CodeGen then implementing this function and writing things to its output.

Instead, introduce a PragmaCommentDecl AST node and hang one off the
TranslationUnitDecl for every `#pragma comment` line, and then use the regular
serialization machinery. (Since PragmaCommentDecl has codegen relevance, it's
eagerly deserialized.)

http://reviews.llvm.org/D17799

llvm-svn: 262493

8 years agoLTO: Use the correct relocation model.
Rafael Espindola [Wed, 2 Mar 2016 17:21:06 +0000 (17:21 +0000)]
LTO: Use the correct relocation model.

llvm-svn: 262492

8 years ago[cmake] Check the compiler version first
Reid Kleckner [Wed, 2 Mar 2016 16:42:56 +0000 (16:42 +0000)]
[cmake] Check the compiler version first

Otherwise users get messages from CheckAtomic about missing libatomic
instead of a sensible message that says "use GCC 4.7 or newer".

I structured the change along the lines of HandleLLVMStdlib.cmake, so
that the standalone build of Clang still gets the compiler version
check.

Reviewers: beanz

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

llvm-svn: 262491

8 years ago[AA] Hoist the logic to reformulate various AA queries in terms of other
Chandler Carruth [Wed, 2 Mar 2016 15:56:53 +0000 (15:56 +0000)]
[AA] Hoist the logic to reformulate various AA queries in terms of other
parts of the AA interface out of the base class of every single AA
result object.

Because this logic reformulates the query in terms of some other aspect
of the API, it would easily cause O(n^2) query patterns in alias
analysis. These could in turn be magnified further based on the number
of call arguments, and then further based on the number of AA queries
made for a particular call. This ended up causing problems for Rust that
were actually noticable enough to get a bug (PR26564) and probably other
places as well.

When originally re-working the AA infrastructure, the desire was to
regularize the pattern of refinement without losing any generality.
While I think it was successful, that is clearly proving to be too
costly. And the cost is needless: we gain no actual improvement for this
generality of making a direct query to tbaa actually be able to
re-use some other alias analysis's refinement logic for one of the other
APIs, or some such. In short, this is entirely wasted work.

To the extent possible, delegation to other API surfaces should be done
at the aggregation layer so that we can avoid re-walking the
aggregation. In fact, this significantly simplifies the logic as we no
longer need to smuggle the aggregation layer into each alias analysis
(or the TargetLibraryInfo into each alias analysis just so we can form
argument memory locations!).

However, we also have some delegation logic inside of BasicAA and some
of it even makes sense. When the delegation logic is baking in specific
knowledge of aliasing properties of the LLVM IR, as opposed to simply
reformulating the query to utilize a different alias analysis interface
entry point, it makes a lot of sense to restrict that logic to
a different layer such as BasicAA. So one aspect of the delegation that
was in every AA base class is that when we don't have operand bundles,
we re-use function AA results as a fallback for callsite alias results.
This relies on the IR properties of calls and functions w.r.t. aliasing,
and so seems a better fit to BasicAA. I've lifted the logic up to that
point where it seems to be a natural fit. This still does a bit of
redundant work (we query function attributes twice, once via the
callsite and once via the function AA query) but it is *exactly* twice
here, no more.

The end result is that all of the delegation logic is hoisted out of the
base class and into either the aggregation layer when it is a pure
retargeting to a different API surface, or into BasicAA when it relies
on the IR's aliasing properties. This should fix the quadratic query
pattern reported in PR26564, although I don't have a stand-alone test
case to reproduce it.

It also seems general goodness. Now the numerous AAs that don't need
target library info don't carry it around and depend on it. I think
I can even rip out the general access to the aggregation layer and only
expose that in BasicAA as it is the only place where we re-query in that
manner.

However, this is a non-trivial change to the AA infrastructure so I want
to get some additional eyes on this before it lands. Sadly, it can't
wait long because we should really cherry pick this into 3.8 if we're
going to go this route.

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

llvm-svn: 262490

8 years agoHandle comdat in LTO.
Rafael Espindola [Wed, 2 Mar 2016 15:43:50 +0000 (15:43 +0000)]
Handle comdat in LTO.

llvm-svn: 262489

8 years agoFix: Add pass manager barrier.
Michael Kruse [Wed, 2 Mar 2016 14:59:16 +0000 (14:59 +0000)]
Fix: Add pass manager barrier.

The LNT test suite with -polly-process-unprofitable
-polly-position=before-vectorizer currenty fails 59 tests. With this
barrier added, only 16 keep failing. This is probably because Polly's
code generation currently does not correctly preserve all analyses it
promised to preserve. Temporarily add this barrier until further
investigation.

llvm-svn: 262488

8 years agotest/Driver/cl-pch-errorhandling.cpp: Copy input file to a temporary
Daniel Jasper [Wed, 2 Mar 2016 14:26:59 +0000 (14:26 +0000)]
test/Driver/cl-pch-errorhandling.cpp: Copy input file to a temporary
location as we cannot assume the location of the input file to be
writable.

llvm-svn: 262487

8 years ago[X86][SSSE3] Added combine test for unary shuffle (pshufb) only referencing elements...
Simon Pilgrim [Wed, 2 Mar 2016 14:16:50 +0000 (14:16 +0000)]
[X86][SSSE3] Added combine test for unary shuffle (pshufb) only referencing elements from one of the inputs of a binary shuffle (punpcklbw)

llvm-svn: 262486

8 years agoFix BUILD_SHARED_LIBS build.
Rafael Espindola [Wed, 2 Mar 2016 14:12:37 +0000 (14:12 +0000)]
Fix BUILD_SHARED_LIBS build.

llvm-svn: 262485

8 years ago[clang-tidy] Fix an assertion failure of "SLocEntry::getExpansion()" when IncludeInse...
Haojian Wu [Wed, 2 Mar 2016 14:12:17 +0000 (14:12 +0000)]
[clang-tidy] Fix an assertion failure of "SLocEntry::getExpansion()" when IncludeInserter handles macro header file.

Summary: Also Fixes PR24749.

Reviewers: alexfh

Subscribers: cfe-commits

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

llvm-svn: 262484

8 years ago[TSAN] Fix test java_race_pc
Sagar Thakur [Wed, 2 Mar 2016 13:53:22 +0000 (13:53 +0000)]
[TSAN] Fix test java_race_pc

Incremented the pc for each architecture in accordance with StackTrace:GetPreviousInstructionPC

Reviewers: samsonov, dvyukov
Subscribers: llvm-commits, mohit.bhakkad, jaydeep
Differential: http://reviews.llvm.org/D17802
llvm-svn: 262483

8 years agoUpgrade the arm/thumb architecture used by the disassembler
Tamas Berghammer [Wed, 2 Mar 2016 12:42:43 +0000 (12:42 +0000)]
Upgrade the arm/thumb architecture used by the disassembler

Previously we were using thumbv7 and armv8.1a what ended up showing a
few undefined instruction when disassembling code. This CL update the
architectures used to armv8.2a and thumbv8.2a (newest available) so we
display all instruction in the disassambly.

llvm-svn: 262482

8 years ago[CLANG] [AVX512] [BUILTIN] Adding PSRA{W|WI}{128|256|512}.
Michael Zuckerman [Wed, 2 Mar 2016 12:06:06 +0000 (12:06 +0000)]
[CLANG] [AVX512] [BUILTIN] Adding PSRA{W|WI}{128|256|512}.

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

llvm-svn: 262481

8 years ago[LLVM][AVX512]PSRAWI Change imm8 to int.
Michael Zuckerman [Wed, 2 Mar 2016 12:05:07 +0000 (12:05 +0000)]
[LLVM][AVX512]PSRAWI Change imm8 to int.

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

llvm-svn: 262480

8 years agoRevert "[RT] Make tsan tests more portable"
Renato Golin [Wed, 2 Mar 2016 11:54:07 +0000 (11:54 +0000)]
Revert "[RT] Make tsan tests more portable"

This reverts commit r262476, as it broken the AArch64 VMA42 buildbot.

llvm-svn: 262479

8 years ago[X86][SSE] Lower 128-bit MOVDDUP with existing VBROADCAST mechanisms
Simon Pilgrim [Wed, 2 Mar 2016 11:43:05 +0000 (11:43 +0000)]
[X86][SSE] Lower 128-bit MOVDDUP with existing VBROADCAST mechanisms

We have a number of useful lowering strategies for VBROADCAST instructions (both from memory and register element 0) which the 128-bit form of the MOVDDUP instruction can make use of.

This patch tweaks lowerVectorShuffleAsBroadcast to enable it to broadcast 2f64 args using MOVDDUP as well.

It does require a slight tweak to the lowerVectorShuffleAsBroadcast mechanism as the existing MOVDDUP lowering uses isShuffleEquivalent which can match binary shuffles that can lower to (unary) broadcasts.

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

llvm-svn: 262478

8 years agoRevert "[AMDGPU] table-driven parser/printer for amd_kernel_code_t structure fields"
Nikolay Haustov [Wed, 2 Mar 2016 11:16:56 +0000 (11:16 +0000)]
Revert "[AMDGPU] table-driven parser/printer for amd_kernel_code_t structure fields"

Build failure with clang.

llvm-svn: 262477

8 years ago[RT] Make tsan tests more portable
Renato Golin [Wed, 2 Mar 2016 11:10:02 +0000 (11:10 +0000)]
[RT] Make tsan tests more portable

by avoiding potential races when scanning stdout and stderr output.

Patch by Maxim Kuvyrkov.

llvm-svn: 262476

8 years agoRevert "[AMDGPU] Using table-driven amd_kernel_code_t field parser in assembler."
Nikolay Haustov [Wed, 2 Mar 2016 10:54:21 +0000 (10:54 +0000)]
Revert "[AMDGPU] Using table-driven amd_kernel_code_t field parser in assembler."

Build failure with clang.

llvm-svn: 262475

8 years ago[AMDGPU] Using table-driven amd_kernel_code_t field parser in assembler.
Nikolay Haustov [Wed, 2 Mar 2016 10:36:30 +0000 (10:36 +0000)]
[AMDGPU] Using table-driven amd_kernel_code_t field parser in assembler.

complementary patch to table-driven amd_kernel_code_t field parser/printer utility. lit tests passed.

Patch by: Valery Pykhtin

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

llvm-svn: 262474

8 years ago[AMDGPU] table-driven parser/printer for amd_kernel_code_t structure fields
Nikolay Haustov [Wed, 2 Mar 2016 10:36:25 +0000 (10:36 +0000)]
[AMDGPU] table-driven parser/printer for amd_kernel_code_t structure fields

This is going to be used in .hsatext disassembler and can be used
in current assembler parser (lit tests passed on parsing).
Code using this helpers isn't included in this patch.

Benefits:

unified approach
fast field name lookup on parsing
Later I would like to enhance some of the field naming/syntax using this code.

Patch by: Valery Pykhtin

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

llvm-svn: 262473

8 years agolibfuzzer: fix compiler warnings
Dmitry Vyukov [Wed, 2 Mar 2016 09:54:40 +0000 (09:54 +0000)]
libfuzzer: fix compiler warnings

- unused sigaction/setitimer result (used in assert)
- unchecked fscanf return value
- signed/unsigned comparison

llvm-svn: 262472

8 years ago[CLANG] [AVX512] [BUILTIN] Adding PSRAV
Michael Zuckerman [Wed, 2 Mar 2016 09:05:46 +0000 (09:05 +0000)]
[CLANG] [AVX512] [BUILTIN] Adding PSRAV

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

llvm-svn: 262471

8 years ago[clang-tidy] Make 'modernize-pass-by-value' fix work on header files.
Haojian Wu [Wed, 2 Mar 2016 09:01:25 +0000 (09:01 +0000)]
[clang-tidy] Make 'modernize-pass-by-value' fix work on header files.

Reviewers: alexfh

Subscribers: jbcoe, cfe-commits

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

llvm-svn: 262470

8 years ago[test/vptr-non-unique-typeinfo] Address Samsonov's post-commit review
Filipe Cabecinhas [Wed, 2 Mar 2016 08:30:40 +0000 (08:30 +0000)]
[test/vptr-non-unique-typeinfo] Address Samsonov's post-commit review

Reviewers: samsonov

Subscribers: llvm-commits

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

llvm-svn: 262469

8 years ago[X86] Remove unnecessary call to isReg from emitter's DestMem handling for VEX prefix...
Craig Topper [Wed, 2 Mar 2016 07:32:45 +0000 (07:32 +0000)]
[X86] Remove unnecessary call to isReg from emitter's DestMem handling for VEX prefix. The operand is always a register. NFC

llvm-svn: 262468

8 years ago[X86] Make X86MCCodeEmitter::DetermineREXPrefix locate operands more like how VEX...
Craig Topper [Wed, 2 Mar 2016 07:32:43 +0000 (07:32 +0000)]
[X86] Make X86MCCodeEmitter::DetermineREXPrefix locate operands more like how VEX prefix handling does.

llvm-svn: 262467

8 years ago[Sema] PR26444 fix crash when alignment value is >= 2**16
David Majnemer [Wed, 2 Mar 2016 06:48:47 +0000 (06:48 +0000)]
[Sema] PR26444 fix crash when alignment value is >= 2**16

Sema allows max values up to 2**28, use unsigned instead of unsiged
short to hold values that large.

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

Patch by Don Hinton!

llvm-svn: 262466

8 years ago[X86] Permit reading of the FLAGS register without it being previously defined
David Majnemer [Wed, 2 Mar 2016 06:46:52 +0000 (06:46 +0000)]
[X86] Permit reading of the FLAGS register without it being previously defined

We modeled the RDFLAGS{32,64} operations as "using" {E,R}FLAGS.
While technically correct, this is not be desirable for folks who want
to examine aspects of the FLAGS register which are not related to
computation like whether or not CPUID is a valid instruction.

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

llvm-svn: 262465

8 years ago[X86] Remove assertion I accidentally left in.
Craig Topper [Wed, 2 Mar 2016 06:35:22 +0000 (06:35 +0000)]
[X86] Remove assertion I accidentally left in.

llvm-svn: 262464

8 years ago[modules] addHeaderInclude() can't fail.
Davide Italiano [Wed, 2 Mar 2016 06:09:18 +0000 (06:09 +0000)]
[modules] addHeaderInclude() can't fail.

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

llvm-svn: 262463