platform/upstream/llvm.git
8 years ago[X86] PR26575: Fix LEA optimization pass (Part 2).
Andrey Turetskiy [Sat, 20 Feb 2016 10:58:28 +0000 (10:58 +0000)]
[X86] PR26575: Fix LEA optimization pass (Part 2).

Handle address displacement operands of a type other than Immediate or Global in LEAs and load/stores.

Ref: https://llvm.org/bugs/show_bug.cgi?id=26575

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

llvm-svn: 261428

8 years ago[SimplifyCFG] Use pointer identity to simplify predicate.
Benjamin Kramer [Sat, 20 Feb 2016 10:40:42 +0000 (10:40 +0000)]
[SimplifyCFG] Use pointer identity to simplify predicate.

No functional change intended.

llvm-svn: 261427

8 years ago[LVI] Move ConstantRanges instead of copying.
Benjamin Kramer [Sat, 20 Feb 2016 10:40:34 +0000 (10:40 +0000)]
[LVI] Move ConstantRanges instead of copying.

No functional change intended. Copying small (<= 64 bits) APInts isn't
expensive but bloats code by generating the slow path everywhere. Moving
doesn't care about the size of the value.

llvm-svn: 261426

8 years ago[MSVC Compat] Implement -EHc semantics
David Majnemer [Sat, 20 Feb 2016 09:23:47 +0000 (09:23 +0000)]
[MSVC Compat] Implement -EHc semantics

The -EHc flag implicitly adds a nothrow attribute to any extern "C"
function when exceptions are enabled.

llvm-svn: 261425

8 years ago[MSVC Compat] Add support for /GX, /GX-
David Majnemer [Sat, 20 Feb 2016 09:23:44 +0000 (09:23 +0000)]
[MSVC Compat] Add support for /GX, /GX-

These are legacy flags which map to /EHsc and /EHs-c- respectively.

llvm-svn: 261424

8 years agoRemove -fnew-ms-eh
David Majnemer [Sat, 20 Feb 2016 09:23:41 +0000 (09:23 +0000)]
Remove -fnew-ms-eh

This flag no longer controls any behavior inside of clang.

llvm-svn: 261423

8 years agoFix handling of vaargs on PPC32 when going from regsave to overflow.
Roman Divacky [Sat, 20 Feb 2016 08:31:24 +0000 (08:31 +0000)]
Fix handling of vaargs on PPC32 when going from regsave to overflow.

It can happen that when we only have 1 more register left in the regsave
area we need to store a value bigger than 1 register and therefore we
go to the overflow area. In this case we have to leave the last slot
in the regsave area unused and keep using overflow area. Do this
by storing a limit value to the used register counter in the overflow block.

Issue diagnosed by and solution tested by Mark Millard!

llvm-svn: 261422

8 years agoRename <__hash_table> traits so they don't conflict with similar traits.
Eric Fiselier [Sat, 20 Feb 2016 07:59:16 +0000 (07:59 +0000)]
Rename <__hash_table> traits so they don't conflict with similar traits.

In particular <__tree> defines many of the same types of traits classes.

llvm-svn: 261421

8 years agoMove some code from doInitialization to runOnFunction
David Majnemer [Sat, 20 Feb 2016 07:34:21 +0000 (07:34 +0000)]
Move some code from doInitialization to runOnFunction

This has no observable behavior change, it just makes the state
insertion pass look a little more like normal passes.

llvm-svn: 261420

8 years agoRemove all usages of "const" node pointer typedefs in the assoc containers.
Eric Fiselier [Sat, 20 Feb 2016 07:12:17 +0000 (07:12 +0000)]
Remove all usages of "const" node pointer typedefs in the assoc containers.

The "const" pointer typedefs such as "__node_const_pointer" and
"__node_base_const_pointer" are identical to their non-const pointer types.
This patch changes all usages of "const" pointer type names to their respective
non-const typedef.

Since "fancy pointers to const" cannot be converted back to a non-const pointer
type according to the allocator requirements it is important that we never
actually use "const" pointers.

Furthermore since "__node_const_pointer" and "__node_pointer" already
name the same type, it's very confusing to use both names. Especially
when defining const/non-const overloads for member functions.

llvm-svn: 261419

8 years ago[X86] Remove some unused encoding checks from the disassembler table building.
Craig Topper [Sat, 20 Feb 2016 06:20:21 +0000 (06:20 +0000)]
[X86] Remove some unused encoding checks from the disassembler table building.

llvm-svn: 261418

8 years ago[X86] Add some missing reversed forms of XOP instructions.
Craig Topper [Sat, 20 Feb 2016 06:20:17 +0000 (06:20 +0000)]
[X86] Add some missing reversed forms of XOP instructions.

llvm-svn: 261417

8 years agoCleanup node-type handling in the associative containers.
Eric Fiselier [Sat, 20 Feb 2016 05:28:30 +0000 (05:28 +0000)]
Cleanup node-type handling in the associative containers.

This patch is very similar to r260431.

This patch is the first in a series of patches that's meant to better
support map. map has a special "value_type" that
differs from pair<const Key, Value>. In order to meet the EmplaceConstructible
and CopyInsertable requirements we need to teach __tree about this
special value_type.

This patch creates a "__tree_node_types" traits class that contains
all of the typedefs needed by the associative containers and their iterators.
These typedefs include ones for each node type and  node pointer type,
as well as special typedefs for "map"'s value type.

Although the associative containers already supported incomplete types, this
patch makes it official by adding tests.

This patch will be followed up shortly with various cleanups within __tree and
fixes for various map bugs and problems.

llvm-svn: 261416

8 years ago[OPENMP 4.5] Initial support for data members in 'lastprivate' clause.
Alexey Bataev [Sat, 20 Feb 2016 04:09:36 +0000 (04:09 +0000)]
[OPENMP 4.5] Initial support for data members in 'lastprivate' clause.

OpenMP 4.5 allows to privatize non-static data members of current class
in non-static member functions. Patch adds initial support for data
members.

llvm-svn: 261412

8 years ago[PM/AA] Wire up TBAA to the new pass manager's registry and test it.
Chandler Carruth [Sat, 20 Feb 2016 04:04:52 +0000 (04:04 +0000)]
[PM/AA] Wire up TBAA to the new pass manager's registry and test it.

llvm-svn: 261411

8 years ago[PM/AA] Wire up the scoped-no-alias AA to the new pass manager's
Chandler Carruth [Sat, 20 Feb 2016 04:03:06 +0000 (04:03 +0000)]
[PM/AA] Wire up the scoped-no-alias AA to the new pass manager's
registry and test it.

llvm-svn: 261410

8 years ago[PM/AA] Wire up SCEVAA to the new pass manager's registry and test it.
Chandler Carruth [Sat, 20 Feb 2016 04:01:45 +0000 (04:01 +0000)]
[PM/AA] Wire up SCEVAA to the new pass manager's registry and test it.

llvm-svn: 261409

8 years agoMachineCopyPropagation: Introduce Reg2MIMap typedef; NFC
Matthias Braun [Sat, 20 Feb 2016 03:56:41 +0000 (03:56 +0000)]
MachineCopyPropagation: Introduce Reg2MIMap typedef; NFC

llvm-svn: 261408

8 years agoMachineCopyPropagation: Move variables from function to pass
Matthias Braun [Sat, 20 Feb 2016 03:56:39 +0000 (03:56 +0000)]
MachineCopyPropagation: Move variables from function to pass

This avoids unnecessarily passing them around when calling helper
functions. It may also be slightly faster to call clear() on the
datastructures instead of freshly initializing them for each block.

llvm-svn: 261407

8 years agoMachineCopyPropagation: Use ranged for, cleanup; NFC
Matthias Braun [Sat, 20 Feb 2016 03:56:36 +0000 (03:56 +0000)]
MachineCopyPropagation: Use ranged for, cleanup; NFC

llvm-svn: 261406

8 years agoMachineCopyPropagation: Use assert() instead of if{report_error()} for 'impossible...
Matthias Braun [Sat, 20 Feb 2016 03:56:33 +0000 (03:56 +0000)]
MachineCopyPropagation: Use assert() instead of if{report_error()} for 'impossible' condition

llvm-svn: 261405

8 years ago[PM/AA] Wire up CFLAA to the new pass manager fully, and port one of its
Chandler Carruth [Sat, 20 Feb 2016 03:52:02 +0000 (03:52 +0000)]
[PM/AA] Wire up CFLAA to the new pass manager fully, and port one of its
tests over to exercise this code.

This uncovered a few missing bits here and there in the analysis, but
nothing interesting.

llvm-svn: 261404

8 years ago[PM/AA] Port alias analysis evaluator to the new pass manager, and use
Chandler Carruth [Sat, 20 Feb 2016 03:46:03 +0000 (03:46 +0000)]
[PM/AA] Port alias analysis evaluator to the new pass manager, and use
it to actually test the new pass manager AA wiring.

This patch was extracted from the (somewhat too large) D12357 and
rebosed on top of the slightly different design of the new pass manager
AA wiring that I just landed. With this we can start testing the AA in
a thorough way with the new pass manager.

Some minor cleanups to the code in the pass was necessitated here, but
otherwise it is a very minimal change.

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

llvm-svn: 261403

8 years agoAdd more isl object printing functions
Hongbin Zheng [Sat, 20 Feb 2016 03:40:19 +0000 (03:40 +0000)]
Add more isl object printing functions

llvm-svn: 261402

8 years agoAssign meaningful name to MemoryAccess. NFC
Hongbin Zheng [Sat, 20 Feb 2016 03:40:15 +0000 (03:40 +0000)]
Assign meaningful name to MemoryAccess. NFC

Now the name of MemoryAccess is <StatementName>_[Read|Write|MayWrite]<Number>_<BaseName>,
e.g. Stmt_for_body_4_Read0_MemRef_A

llvm-svn: 261401

8 years agofixing msvc warning.
Mike Aizatsky [Sat, 20 Feb 2016 02:11:49 +0000 (02:11 +0000)]
fixing msvc warning.

llvm-svn: 261396

8 years ago[SCEV] Don't spell `SCEV *` variables as `Scev`; NFC
Sanjoy Das [Sat, 20 Feb 2016 01:59:15 +0000 (01:59 +0000)]
[SCEV] Don't spell `SCEV *` variables as `Scev`; NFC

I missed a spot in rL261393.

llvm-svn: 261395

8 years ago[SCEV] Don't spell `SCEV *` variables as `Scev`; NFC
Sanjoy Das [Sat, 20 Feb 2016 01:44:10 +0000 (01:44 +0000)]
[SCEV] Don't spell `SCEV *` variables as `Scev`; NFC

It reads odd since most other places name a `SCEV *` as `S`.  Pure
renaming change.

llvm-svn: 261393

8 years ago[SCEV] Don't use std::make_pair; NFC
Sanjoy Das [Sat, 20 Feb 2016 01:35:56 +0000 (01:35 +0000)]
[SCEV] Don't use std::make_pair; NFC

`{A, B}` reads cleaner than `std::make_pair(A, B)`.

llvm-svn: 261392

8 years agoWork around GCC bug in .fail.cpp tests
Eric Fiselier [Sat, 20 Feb 2016 01:11:55 +0000 (01:11 +0000)]
Work around GCC bug in .fail.cpp tests

llvm-svn: 261391

8 years ago[SimplifyCFG] Merge together cleanuppads
David Majnemer [Sat, 20 Feb 2016 01:07:45 +0000 (01:07 +0000)]
[SimplifyCFG] Merge together cleanuppads

Cleanuppads may be merged together if one is the only predecessor of the
other in which case a simple transform can be performed: replace the
a cleanupret with a branch and remove an unnecessary cleanuppad.

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

llvm-svn: 261390

8 years agoFix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in some files...
Eugene Zelenko [Sat, 20 Feb 2016 00:58:29 +0000 (00:58 +0000)]
Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in some files in source/Commands; other minor fixes.

llvm-svn: 261389

8 years agoRemove a duplicate declaration specifier from _ReadBarrier
David Majnemer [Sat, 20 Feb 2016 00:57:00 +0000 (00:57 +0000)]
Remove a duplicate declaration specifier from _ReadBarrier

This fixes PR26675.

llvm-svn: 261388

8 years ago[X86ISelLowering] Fix TLSADDR lowering when shrink-wrapping is enabled.
Davide Italiano [Sat, 20 Feb 2016 00:44:47 +0000 (00:44 +0000)]
[X86ISelLowering] Fix TLSADDR lowering when shrink-wrapping is enabled.

TLSADDR nodes are lowered into actuall calls inside MC. In order to prevent
shrink-wrapping from pushing prologue/epilogue past them (which result
in TLS variables being accessed before the stack frame is set up), we
put markers, so that the stack gets adjusted properly.
Thanks to Quentin Colombet for guidance/help on how to fix this problem!

llvm-svn: 261387

8 years agoAMDGPU/SI: Use v_readfirstlane to legalize SMRD with VGPR base pointer
Tom Stellard [Sat, 20 Feb 2016 00:37:25 +0000 (00:37 +0000)]
AMDGPU/SI: Use v_readfirstlane to legalize SMRD with VGPR base pointer

Summary:
Instead of trying to replace SMRD instructions with a VGPR base pointer
with an equivalent MUBUF instruction, we now copy the base pointer to
SGPRs using v_readfirstlane.

This is safe to do, because any load selected as an SMRD instruction
has been proven to have a uniform base pointer, so each thread in the
wave will have the same pointer value in VGPRs.

This will fix some errors on VI from trying to replace SMRD instructions
with addr64-enabled MUBUF instructions that don't exist.

Reviewers: arsenm, cfang, nhaehnle

Subscribers: arsenm, llvm-commits

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

llvm-svn: 261385

8 years ago[RegAllocFast] Properly track the physical register definitions on calls.
Quentin Colombet [Sat, 20 Feb 2016 00:32:29 +0000 (00:32 +0000)]
[RegAllocFast] Properly track the physical register definitions on calls.

PR26485

llvm-svn: 261384

8 years agoFix PR26622 - Make CheckLibcxxAtomic.cmake use the libc++ headers.
Eric Fiselier [Sat, 20 Feb 2016 00:24:43 +0000 (00:24 +0000)]
Fix PR26622 - Make CheckLibcxxAtomic.cmake use the libc++ headers.

llvm-svn: 261383

8 years agoMake __wrap_iter work with GCC again
Eric Fiselier [Sat, 20 Feb 2016 00:19:45 +0000 (00:19 +0000)]
Make __wrap_iter work with GCC again

Summary:
This bug was originally fixed in http://reviews.llvm.org/D7201.

However it was broken again by the fix to https://llvm.org/bugs/show_bug.cgi?id=22605.

This patch re-fixes __wrap_iter with GCC by providing a forward declaration of <vector> before the friend declaration in __wrap_iter.
This patch avoids the issues in PR22605 by putting canonical forward declarations in <iosfwd> and including <iosfwd> in <vector>.

<iosfwd> was chosen as the canonical forward declaration headers for the following reasons:

1. `<iosfwd>` is small with almost no dependancies.
2. It already forward declares `std::allocator`
3. It is already included in `<iterator>` which we need to fix the GCC bug.

This patch fixes the test "gcc_workaround.pass.cpp"

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

llvm-svn: 261382

8 years agoAdd stdbool.h wrapper for libc++
Eric Fiselier [Sat, 20 Feb 2016 00:16:41 +0000 (00:16 +0000)]
Add stdbool.h wrapper for libc++

Summary:
According to the C++ standard <stdbool.h> isn't allowed to define `true` `false` or `bool`. However these macros are sometimes defined by the compilers `stdbool.h`.

Clang defines the macros whenever `__STRICT_ANSI__` isn't defined (ie `-std=gnu++11`).
New GCC versions define the macros in C++03 mode only, older GCC versions (4.9 and before) always define the macros.

This patch adds a wrapper header for `stdbool.h` that undefs the required macros.

Reviewers: mclow.lists, rsmith, EricWF

Subscribers: cfe-commits

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

llvm-svn: 261381

8 years ago[codeview] Fix emission of file changes in inline line tables
Reid Kleckner [Fri, 19 Feb 2016 23:55:38 +0000 (23:55 +0000)]
[codeview] Fix emission of file changes in inline line tables

These are supposed to be file checksum table offsets, not file ids.

llvm-svn: 261379

8 years ago[CMake] Adding a CMake cache file that matches Apple's build configs
Chris Bieneman [Fri, 19 Feb 2016 22:59:18 +0000 (22:59 +0000)]
[CMake] Adding a CMake cache file that matches Apple's build configs

This should have no impact on anyone, but we're going to use it from GreenDragon to make our builders match what we ship.

llvm-svn: 261377

8 years ago[sancov] use GetLoadedModules for list of modules rather than sanitizer's list.
Mike Aizatsky [Fri, 19 Feb 2016 22:55:21 +0000 (22:55 +0000)]
[sancov] use GetLoadedModules for list of modules rather than sanitizer's list.

llvm-svn: 261376

8 years ago[sancov] sanitizer html report cosmetic improvements.
Mike Aizatsky [Fri, 19 Feb 2016 22:55:08 +0000 (22:55 +0000)]
[sancov] sanitizer html report cosmetic improvements.

llvm-svn: 261375

8 years agoHandle undef symbols in LTO.
Rafael Espindola [Fri, 19 Feb 2016 22:50:16 +0000 (22:50 +0000)]
Handle undef symbols in LTO.

This also handles bc files is archives.

llvm-svn: 261374

8 years ago[modules] Do less scanning of macro definition chains when computing the set of
Richard Smith [Fri, 19 Feb 2016 22:43:58 +0000 (22:43 +0000)]
[modules] Do less scanning of macro definition chains when computing the set of
exported module macros outside local submodule visibility mode. Related to
PR24667.

llvm-svn: 261373

8 years ago[modules] Flatten -fmodule-name= and -fmodule-implementation-of= into a single
Richard Smith [Fri, 19 Feb 2016 22:25:36 +0000 (22:25 +0000)]
[modules] Flatten -fmodule-name= and -fmodule-implementation-of= into a single
option. Previously these options could both be used to specify that you were
compiling the implementation file of a module, with a different set of minor
bugs in each case.

This change removes -fmodule-implementation-of, and instead tracks a flag to
determine whether we're currently building a module. -fmodule-name now behaves
the same way that -fmodule-implementation-of previously did.

llvm-svn: 261372

8 years ago[X86ISelLowering] Provide a more informative assert message.
Davide Italiano [Fri, 19 Feb 2016 22:18:49 +0000 (22:18 +0000)]
[X86ISelLowering] Provide a more informative assert message.

I stumbled upon this while debugging a lowering bug.

llvm-svn: 261371

8 years ago[X86ISelLowering] Merge two conditions inside a single if.
Davide Italiano [Fri, 19 Feb 2016 22:01:07 +0000 (22:01 +0000)]
[X86ISelLowering] Merge two conditions inside a single if.

llvm-svn: 261370

8 years agoRevert r255691 "[LoopVectorizer] Refine loop vectorizer's register usage calculator...
Hans Wennborg [Fri, 19 Feb 2016 21:40:12 +0000 (21:40 +0000)]
Revert r255691 "[LoopVectorizer] Refine loop vectorizer's register usage calculator by ignoring specific instructions."

It caused PR26509.

llvm-svn: 261368

8 years agoRevert r253557 "Alternative to long nops for X86 CPUs, by Andrey Turetsky"
Hans Wennborg [Fri, 19 Feb 2016 21:26:31 +0000 (21:26 +0000)]
Revert r253557 "Alternative to long nops for X86 CPUs, by Andrey Turetsky"

Turns out the new nop sequences aren't actually nops on x86_64 (PR26554).

llvm-svn: 261365

8 years agollvm-dwp: Improve performance (N^2 to amortized N) by using a MapVector instead of...
David Blaikie [Fri, 19 Feb 2016 21:09:26 +0000 (21:09 +0000)]
llvm-dwp: Improve performance (N^2 to amortized N) by using a MapVector instead of linear searches through a vector

Figured this would be a problem, but didn't want to jump the gun - large
inputs demonstrate it pretty easily (mostly for type units, but might as
well do the same for CUs too). A random sample 6m27s -> 27s change.

Also, by checking this up-front for CUs (rather than when building the
cu_index) we can probably provide better error messages (see FIXMEs),
hopefully providing the name of the CUs rather than just their
signature.

llvm-svn: 261364

8 years ago[sancov] requiring dynamic asan.
Mike Aizatsky [Fri, 19 Feb 2016 20:47:25 +0000 (20:47 +0000)]
[sancov] requiring dynamic asan.

llvm-svn: 261362

8 years agominor test runline cleanup
Xinliang David Li [Fri, 19 Feb 2016 20:28:51 +0000 (20:28 +0000)]
minor test runline cleanup

llvm-svn: 261361

8 years agoFix incorrect selection of AVX512 sqrt when OptForSize is on
Dimitry Andric [Fri, 19 Feb 2016 20:14:11 +0000 (20:14 +0000)]
Fix incorrect selection of AVX512 sqrt when OptForSize is on

Summary:
When optimizing for size, sqrt calls can be incorrectly selected as
AVX512 VSQRT instructions.  This is because X86InstrAVX512.td has a
`Requires<[OptForSize]>` in its `avx512_sqrt_scalar` multiclass
definition.  Even if the target does not support AVX512, the class can
apparently still be chosen, leading to an incorrect selection of
`vsqrtss`.

In PR26625, this lead to an assertion: Reg >= X86::FP0 && Reg <=
X86::FP6 && "Expected FP register!", because the `vsqrtss` instruction
requires an XMM register, which is not available on i686 CPUs.

Reviewers: grosbach, resistor, joker.eph

Subscribers: spatel, emaste, llvm-commits

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

llvm-svn: 261360

8 years ago[StatepointLowering] Minor non-semantic cleanups
Sanjoy Das [Fri, 19 Feb 2016 19:37:07 +0000 (19:37 +0000)]
[StatepointLowering] Minor non-semantic cleanups

Use auto, bring file up to coding standards etc.

llvm-svn: 261358

8 years agoFix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in some files...
Eugene Zelenko [Fri, 19 Feb 2016 19:33:46 +0000 (19:33 +0000)]
Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in some files in source/Commands; other minor fixes.

llvm-svn: 261356

8 years agoRemove expectedFailureFreeBSD decorator
Ed Maste [Fri, 19 Feb 2016 19:25:03 +0000 (19:25 +0000)]
Remove expectedFailureFreeBSD decorator

All invocations are updated to use the generic expectedFailureAll.

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

llvm-svn: 261355

8 years ago[WebAssembly] Add another optimization idea to README.txt.
Dan Gohman [Fri, 19 Feb 2016 19:22:44 +0000 (19:22 +0000)]
[WebAssembly] Add another optimization idea to README.txt.

llvm-svn: 261354

8 years agoDon't use an atexit handler for cleaning up the temp directory.
Zachary Turner [Fri, 19 Feb 2016 19:20:44 +0000 (19:20 +0000)]
Don't use an atexit handler for cleaning up the temp directory.

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

llvm-svn: 261353

8 years ago[sancov] using static asan
Mike Aizatsky [Fri, 19 Feb 2016 18:46:30 +0000 (18:46 +0000)]
[sancov] using static asan

We are not able to recover coverage points from dynamically linked
binaries at this point without symbols in @plt tables.

llvm-svn: 261352

8 years ago[OpenCL] Generate metadata for opencl_unroll_hint attribute
Anastasia Stulova [Fri, 19 Feb 2016 18:30:11 +0000 (18:30 +0000)]
[OpenCL] Generate metadata for opencl_unroll_hint attribute

Add support for opencl_unroll_hint attribute from OpenCL v2.0 s6.11.5.

Reusing most of metadata generation from CGLoopInfo helper class.

The code is based on Khronos OpenCL compiler:
https://github.com/KhronosGroup/SPIR/tree/spirv-1.0

Patch by Liu Yaxun (Sam)!

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

llvm-svn: 261350

8 years ago[AArch64][ShrinkWrap] Fix bug in prolog clobbering live reg when shrink wrapping.
Geoff Berry [Fri, 19 Feb 2016 18:27:32 +0000 (18:27 +0000)]
[AArch64][ShrinkWrap] Fix bug in prolog clobbering live reg when shrink wrapping.

Summary: See bug https://llvm.org/bugs/show_bug.cgi?id=26642

Reviewers: qcolombet, t.p.northover

Subscribers: aemerson, rengolin, mcrosier, llvm-commits

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

llvm-svn: 261349

8 years ago[StatepointLowering] Update StatepointMaxSlotsRequired correctly
Sanjoy Das [Fri, 19 Feb 2016 18:15:56 +0000 (18:15 +0000)]
[StatepointLowering] Update StatepointMaxSlotsRequired correctly

Now that we don't always add an element to AllocatedStackSlots if we
don't find a pre-existing unallocated stack slot, bumping
StatepointMaxSlotsRequired to `NumSlots + 1` is not correct.  Instead
bump the statistic near the push_back, to
Builder.FuncInfo.StatepointStackSlots.size().

llvm-svn: 261348

8 years ago[StatepointLowering] Fix a mistake in rL261336
Sanjoy Das [Fri, 19 Feb 2016 18:15:53 +0000 (18:15 +0000)]
[StatepointLowering] Fix a mistake in rL261336

The check on MFI->getObjectSize() has to be on the FrameIndex, not on
the index of the FrameIndex in AllocatedStackSlots.  Weirdly, the tests
I added in rL261336 didn't catch this.

llvm-svn: 261347

8 years ago[LV] Vectorize first-order recurrences
Matthew Simpson [Fri, 19 Feb 2016 17:56:08 +0000 (17:56 +0000)]
[LV] Vectorize first-order recurrences

This patch enables the vectorization of first-order recurrences. A first-order
recurrence is a non-reduction recurrence relation in which the value of the
recurrence in the current loop iteration equals a value defined in the previous
iteration. The load PRE of the GVN pass often creates these recurrences by
hoisting loads from within loops.

In this patch, we add a new recurrence kind for first-order phi nodes and
attempt to vectorize them if possible. Vectorization is performed by shuffling
the values for the current and previous iterations. The vectorization cost
estimate is updated to account for the added shuffle instruction.

Contributed-by: Matthew Simpson and Chad Rosier <mcrosier@codeaurora.org>
Differential Revision: http://reviews.llvm.org/D16197

llvm-svn: 261346

8 years agorefactor/cleanup ClangExpressionParser::Parse
Ewan Crawford [Fri, 19 Feb 2016 17:55:10 +0000 (17:55 +0000)]
refactor/cleanup ClangExpressionParser::Parse

This patches does the following:

+ fix return type: ClangExpressionParser::Parse returns unsigned, but was actually returning a signed value, num_errors.
+ use helper clang::TextDiagnosticBuffer::getNumErrors() instead of counting the errors ourself.
+ limit scoping of block-level automatic variables as much as practical.
+ remove reused multipurpose TextDiagnosticBuffer::const_iterator in favour of loop-scoped err, warn, and note variables in the diagnostic printing code.
+ refactor diagnostic printing loops to use a proper loop invariant.

Author: Luke Drummond <luke.drummond@codeplay.com>
Differential Revision: http://reviews.llvm.org/D17273

llvm-svn: 261345

8 years ago[PGO] Enable profile-rt testing on all supported targets
Xinliang David Li [Fri, 19 Feb 2016 17:52:28 +0000 (17:52 +0000)]
[PGO] Enable profile-rt testing  on all supported targets

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

llvm-svn: 261344

8 years ago[Windows] Simplify more tests now that Clang supports EH
Reid Kleckner [Fri, 19 Feb 2016 17:36:54 +0000 (17:36 +0000)]
[Windows] Simplify more tests now that Clang supports EH

Remove TestCases/Windows/throw_catch.cc, since it is redundant with the
portable test TestCases/throw_catch.cc.

llvm-svn: 261342

8 years agoRemove XFAIL from test passing on FreeBSD
Ed Maste [Fri, 19 Feb 2016 17:35:01 +0000 (17:35 +0000)]
Remove XFAIL from test passing on FreeBSD

There is a report in the PR from several months ago that it failed
intermittently, but it is passing consistently for me on FreeBSD 10
and 11.  We can re-add a decorator if further testing shows it is
still flakey.

llvm.org/pr17214

llvm-svn: 261340

8 years agoRemove XFAIL from test passing on FreeBSD
Ed Maste [Fri, 19 Feb 2016 17:31:05 +0000 (17:31 +0000)]
Remove XFAIL from test passing on FreeBSD

This is passing for me consistently on FreeBSD 10 and FreeBSD 11.

llvm.org/pr15989

llvm-svn: 261339

8 years ago[Windows] Add 10s timeout to some WaitForSingleObject calls
Reid Kleckner [Fri, 19 Feb 2016 17:30:38 +0000 (17:30 +0000)]
[Windows] Add 10s timeout to some WaitForSingleObject calls

I ran the test suite yesterday and when I came back this morning the
queue_user_work_item.cc test was hung. This could be why the
sanitizer-windows buildbot keeps randomly timing out. I updated all the
usages of WaitForSingleObject involving threading events. I'm assuming
the API can reliably wait for subprocesses, which is what the majority
of call sites use it for.

While I'm at it, we can simplify some EH tests now that clang can
compile C++ EH.

llvm-svn: 261338

8 years ago[StatepointLowering] Change AllocatedStackSlots to use SmallBitVector
Sanjoy Das [Fri, 19 Feb 2016 17:15:26 +0000 (17:15 +0000)]
[StatepointLowering] Change AllocatedStackSlots to use SmallBitVector

NFCI.  They key motivation here is that I'd like to use
SmallBitVector::all() in a later change.  Also, using a bit vector here
seemed better in general.

The only interesting change here is that in the failure case of
allocateStackSlot, we no longer (the equivalent of) push_back(true) to
AllocatedStackSlots.  As far as I can tell, this is fine, since we'd
never re-use those slots in the same StatepointLoweringState instance.

Technically there was no need to change the operator[] type accesses to
set() and test(), but I thought it'd be nice to make it obvious that
we're using something other than a std::vector like thing.

llvm-svn: 261337

8 years ago[StatepointLowering] Fix bug in allocateStackSlot
Sanjoy Das [Fri, 19 Feb 2016 17:15:22 +0000 (17:15 +0000)]
[StatepointLowering] Fix bug in allocateStackSlot

allocateStackSlot did not consider the size of the value to be spilled
before deciding to re-use a spill slot.  This was originally okay (since
originally we'd only ever spill pointers), but it became not okay when
we changed our scheme to directly spill vectors of pointers.

While this change fixes the bug pointed out, it has two performance
caveats:

 - It matches spill slot and spillee size exactly, while in theory we
   can spill, e.g., an 8 byte pointer into a 16 byte slot.  This is
   slightly complicated to fix since in the stackmaps section, we report
   the size of the spill slot as the size of the "indirect value"; and
   if they're no longer equivalent, we'll have to keep track of the
   (indirect) value size separately from the stack slot size.

 - It will "spuriously run out" of reusable slots, since we now have an
   second check in the search loop in addition to the availablity
   check (e.g. you had two free scalar slots, and you first ask for a
   vector slot followed by a scalar slot).  I'll fix this in a later
   commit.

llvm-svn: 261336

8 years ago[StatepointLowering] Clean up allocateStackSlot
Sanjoy Das [Fri, 19 Feb 2016 17:15:17 +0000 (17:15 +0000)]
[StatepointLowering] Clean up allocateStackSlot

This removes the unusual loop structure in allocateStackSlot in favor of
something more straightforward.  I've also removed the cautionary
comment in the function, which I suspect is historical cruft now, and
confuses more than it enlightens.

llvm-svn: 261335

8 years agoRemove XFAIL from test passing on FreeBSD
Ed Maste [Fri, 19 Feb 2016 16:58:08 +0000 (16:58 +0000)]
Remove XFAIL from test passing on FreeBSD

Both Linux and FreeBSD had a comment "This needs to be root-caused."
It looks like the failure has been fixed on both, and the Linux XFAIL
decorator was removed in r233716 (Mar 2015).

llvm-svn: 261333

8 years ago[X86] Change fixup-bw-inst.ll to test output with this optimization on and off.
Kevin B. Smith [Fri, 19 Feb 2016 16:20:48 +0000 (16:20 +0000)]
[X86] Change fixup-bw-inst.ll to test output with this optimization on and off.
Differential Revision: http://reviews.llvm.org/D17415

llvm-svn: 261332

8 years ago[LV] Fix PR26600: avoid out of bounds loads for interleaved access vectorization
Silviu Baranga [Fri, 19 Feb 2016 15:46:10 +0000 (15:46 +0000)]
[LV] Fix PR26600: avoid out of bounds loads for interleaved access vectorization

Summary:
If we don't have the first and last access of an interleaved load group,
the first and last wide load in the loop can do an out of bounds
access. Even though we discard results from speculative loads,
this can cause problems, since it can technically generate page faults
(or worse).

We now discard interleaved load groups that don't have the first and
load in the group.

Reviewers: hfinkel, rengolin

Subscribers: rengolin, llvm-commits, mzolotukhin, anemet

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

llvm-svn: 261331

8 years agoAMDGPU/SI: Fix s_waitcnt insertion for flat instructions
Tom Stellard [Fri, 19 Feb 2016 15:33:13 +0000 (15:33 +0000)]
AMDGPU/SI: Fix s_waitcnt insertion for flat instructions

Summary:
This was broken in r260694 which swapped the address and data operands
for flat store instructions.  The code in SIInsertWaits assumes
that the data operand always comes before the address operand, so
we need to add a special case for flat.

Reviewers: arsenm

Subscribers: arsenm, llvm-commits

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

llvm-svn: 261330

8 years ago[X86][AVX] Added fast-isel intrinsics tests
Simon Pilgrim [Fri, 19 Feb 2016 14:38:09 +0000 (14:38 +0000)]
[X86][AVX] Added fast-isel intrinsics tests

As discussed on PR24580, this patch adds some (more to come) initial fast-isel codegen tests to match the IR generated in clang/test/CodeGen/avx-builtins.c

llvm-svn: 261329

8 years agoDelete unused function in ClangExpressionParser
Ewan Crawford [Fri, 19 Feb 2016 14:31:41 +0000 (14:31 +0000)]
Delete unused function in ClangExpressionParser

[git 65dafa83] introduced the GetBuiltinIncludePath function copied from cfe/lib/Driver/CC1Options.cpp

This function is no longer used in lldb's expression parser and I believe it is safe to remove it.

Author: Luke Drummond <luke.drummond@codeplay.com>
Differential Revision: http://reviews.llvm.org/D17266

llvm-svn: 261328

8 years agoAdd support for merging strings with alignment larger than one char.
Rafael Espindola [Fri, 19 Feb 2016 14:17:40 +0000 (14:17 +0000)]
Add support for merging strings with alignment larger than one char.

This reduces the .rodata of scyladb from 4501932 to 4334639 bytes (1.038
times smaller).

I don't think it is critical to support tail merging, just exact
duplicates, but given the code organization it was actually a bit easier
to support both.

llvm-svn: 261327

8 years agoAdd support for merging strings with alignment larger than one char.
Rafael Espindola [Fri, 19 Feb 2016 14:13:52 +0000 (14:13 +0000)]
Add support for merging strings with alignment larger than one char.

This will be used in a lld patch.

llvm-svn: 261326

8 years ago[SystemZ] Fix ABI for i128 argument and return types
Ulrich Weigand [Fri, 19 Feb 2016 14:10:21 +0000 (14:10 +0000)]
[SystemZ] Fix ABI for i128 argument and return types

According to the SystemZ ABI, 128-bit integer types should be
passed and returned via implicit reference.  However, this is
not currently implemented at the LLVM IR level for the i128
type.  This does not matter when compiling C/C++ code, since
clang will implement the implicit reference itself.

However, it turns out that when calling libgcc helper routines
operating on 128-bit integers, LLVM will use i128 argument and
return value types; the resulting code is not compatible with
the ABI used in libgcc, leading to crashes (see PR26559).

This should be simple to fix, except that i128 currently is not
even a legal type for the SystemZ back end.  Therefore, common
code will already split arguments and return values into multiple
parts.  The bulk of this patch therefore consists of detecting
such parts, and correctly handling passing via implicit reference
of a value split into multiple parts.  If at some time in the
future, i128 becomes a legal type, this code can be removed again.

This fixes PR26559.

llvm-svn: 261325

8 years agoAdd a new check, cert-flp30-c, that diagnoses loop induction expressions of floating...
Aaron Ballman [Fri, 19 Feb 2016 14:03:20 +0000 (14:03 +0000)]
Add a new check, cert-flp30-c, that diagnoses loop induction expressions of floating-point type. This check corresponds to the CERT secure coding rule: https://securecoding.cert.org/confluence/display/c/FLP30-C.+Do+not+use+floating-point+variables+as+loop+counters

llvm-svn: 261324

8 years agoRemoved unused local variable
Serge Pavlov [Fri, 19 Feb 2016 12:06:23 +0000 (12:06 +0000)]
Removed unused local variable

llvm-svn: 261323

8 years agoAttemp to heal windows buildbot
George Rimar [Fri, 19 Feb 2016 11:56:49 +0000 (11:56 +0000)]
Attemp to heal windows buildbot

http://lab.llvm.org:8011/builders/sanitizer-windows/builds/17414

llvm-svn: 261322

8 years agopr26544: Bitfield layout with pragma pack and attributes "packed" and
Alexey Bataev [Fri, 19 Feb 2016 11:23:28 +0000 (11:23 +0000)]
pr26544: Bitfield layout with pragma pack and attributes "packed" and
"aligned", by Vladimir Yakovlev

Fix clang/gcc incompatibility of bitfields layout in the presence of
pragma packed and attributes aligned and packed.
Differential Revision: http://reviews.llvm.org/D17023

llvm-svn: 261321

8 years agoCodegen: Print error in Polly code verification and allow to disable verfication.
Tobias Grosser [Fri, 19 Feb 2016 11:07:12 +0000 (11:07 +0000)]
Codegen: Print error in Polly code verification and allow to disable verfication.

We now always print the reason why the code did not pass the LLVM verifier and
we also allow to disable verfication with -polly-codegen-verify=false. Before
this change the first assertion had generally no information why or what might
have gone wrong and it was also impossible to -view-cfg without recompile. This
change makes debugging bugs that result in incorrect IR a lot easier.

llvm-svn: 261320

8 years ago[LPM] Document the new helpers to make it easy to get consistent require
Chandler Carruth [Fri, 19 Feb 2016 10:59:43 +0000 (10:59 +0000)]
[LPM] Document the new helpers to make it easy to get consistent require
and preserve behavior from loop passes.

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

llvm-svn: 261319

8 years agoStack unwinding emulation: handle adjustment of FP
Tamas Berghammer [Fri, 19 Feb 2016 10:59:25 +0000 (10:59 +0000)]
Stack unwinding emulation: handle adjustment of FP

This change is improving the instruction emulation based unwinding to
handle when the frame pointer is adjusted (increment/decrement) after
it has been initialized. The situation can occur in the prologue of
some function where FP is adjusted before it is copied back to SP.

Example code (thumb, generated by gcc 4.8):
< +0>: push  {r4, r7, lr}
< +2>: sub   sp, #0x14
< +4>: add   r7, sp, #0x0
...
<+50>: adds  r7, #0x14 ; The CL fixes the handling of this instruction
<+52>: mov   sp, r7    ; Previously unwinding from here was broken
<+54>: pop   {r4, r7, pc}

Differential revision: http://reviews.llvm.org/D17295

llvm-svn: 261318

8 years ago[ELF] - Minor refactor of LinkerScript file
George Rimar [Fri, 19 Feb 2016 10:45:45 +0000 (10:45 +0000)]
[ELF] - Minor refactor of LinkerScript file

* Else-ifs in ScriptParser::run() replaced with std::function + map
* Reordered members of ScriptParser

Differential revision: http://reviews.llvm.org/D17256

llvm-svn: 261317

8 years ago[LPM] Factor all of the loop analysis usage updates into a common helper
Chandler Carruth [Fri, 19 Feb 2016 10:45:18 +0000 (10:45 +0000)]
[LPM] Factor all of the loop analysis usage updates into a common helper
routine.

We were getting this wrong in small ways and generally being very
inconsistent about it across loop passes. Instead, let's have a common
place where we do this. One minor downside is that this will require
some analyses like SCEV in more places than they are strictly needed.
However, this seems benign as these analyses are complete no-ops, and
without this consistency we can in many cases end up with the legacy
pass manager scheduling deciding to split up a loop pass pipeline in
order to run the function analysis half-way through. It is very, very
annoying to fix these without just being very pedantic across the board.

The only loop passes I've not updated here are ones that use
AU.setPreservesAll() such as IVUsers (an analysis) and the pass printer.
They seemed less relevant.

With this patch, almost all of the problems in PR24804 around loop pass
pipelines are fixed. The one remaining issue is that we run simplify-cfg
and instcombine in the middle of the loop pass pipeline. We've recently
added some loop variants of these passes that would seem substantially
cleaner to use, but this at least gets us much closer to the previous
state. Notably, the seven loop pass managers is down to three.

I've not updated the loop passes using LoopAccessAnalysis because that
analysis hasn't been fully wired into LoopSimplify/LCSSA, and it isn't
clear that those transforms want to support those forms anyways. They
all run late anyways, so this is harmless. Similarly, LSR is left alone
because it already carefully manages its forms and doesn't need to get
fused into a single loop pass manager with a bunch of other loop passes.

LoopReroll didn't use loop simplified form previously, and I've updated
the test case to match the trivially different output.

Finally, I've also factored all the pass initialization for the passes
that use this technique as well, so that should be done regularly and
reliably.

Thanks to James for the help reviewing and thinking about this stuff,
and Ben for help thinking about it as well!

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

llvm-svn: 261316

8 years ago[OPENMP] Improved layout of CGOpenMPRuntime class, NFC.
Alexey Bataev [Fri, 19 Feb 2016 10:38:26 +0000 (10:38 +0000)]
[OPENMP] Improved layout of CGOpenMPRuntime class, NFC.

llvm-svn: 261315

8 years agoEnable TestUnicodeLiterals
Pavel Labath [Fri, 19 Feb 2016 10:36:38 +0000 (10:36 +0000)]
Enable TestUnicodeLiterals

Test should work everywhere except windows now.

llvm-svn: 261314

8 years agoMark TestLldbGdbServer.test_software_breakpoint_set_and_remove_work_llgs as flaky...
Pavel Labath [Fri, 19 Feb 2016 10:36:31 +0000 (10:36 +0000)]
Mark TestLldbGdbServer.test_software_breakpoint_set_and_remove_work_llgs as flaky on linux

The problem is the asynchronous arrival of inferior stdio (pr25652).

llvm-svn: 261313

8 years agoCorrect typos after acting on invalid subscript expressions
David Majnemer [Fri, 19 Feb 2016 07:15:33 +0000 (07:15 +0000)]
Correct typos after acting on invalid subscript expressions

llvm-svn: 261312

8 years ago[X86] Remove unused entries from the disassembler type enum.
Craig Topper [Fri, 19 Feb 2016 06:57:40 +0000 (06:57 +0000)]
[X86] Remove unused entries from the disassembler type enum.

llvm-svn: 261311

8 years agoAdd test.
JF Bastien [Fri, 19 Feb 2016 06:54:47 +0000 (06:54 +0000)]
Add test.

llvm-svn: 261310

8 years agoARM: fix VFP asm constraints
JF Bastien [Fri, 19 Feb 2016 06:54:45 +0000 (06:54 +0000)]
ARM: fix VFP asm constraints

Summary:
Rich Felker was sad that clang used 'w' and 'P' for VFP constraints when GCC documents them as 't' and 'w':
  https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html

This was added way back in 2008:
  http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20080421/005393.html

Subscribers: aemerson, rengolin, cfe-commits

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

llvm-svn: 261309

8 years agoShuffle header file as per the Coding Standards
David Majnemer [Fri, 19 Feb 2016 04:46:48 +0000 (04:46 +0000)]
Shuffle header file as per the Coding Standards

llvm-svn: 261308