platform/upstream/llvm.git
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

8 years ago[SjLjEHPrepare] Simplify/cleanup code
David Majnemer [Fri, 19 Feb 2016 04:46:06 +0000 (04:46 +0000)]
[SjLjEHPrepare] Simplify/cleanup code

No functional change is intended.

llvm-svn: 261307

8 years agoLegalizeDAG: Fix ExpandFCOPYSIGN assuming the same type on both inputs
Matthias Braun [Fri, 19 Feb 2016 04:44:19 +0000 (04:44 +0000)]
LegalizeDAG: Fix ExpandFCOPYSIGN assuming the same type on both inputs

llvm-svn: 261306

8 years ago[LPM] Actually test what the O2 pass pipeline consists of in key places,
Chandler Carruth [Fri, 19 Feb 2016 04:09:40 +0000 (04:09 +0000)]
[LPM] Actually test what the O2 pass pipeline consists of in key places,
especially the *structure* of it with respect to various pass managers.

This uncovers an absolute horror show of problems. This test shows just
how bad PR24804 is: we have a totaly of *seven* loop pass managers in
the main optimization pipeline.

I've tried to comment the various bits to the best of my knowledge, but
more enhancements here would be great.

Also great would be folks adding various test for other pipelines, I'm
focused on trying to fix the O2 pipeline. I just wanted a test to show
what I'm changing.

llvm-svn: 261305

8 years agoAdd profile summary support for sample profile.
Easwaran Raman [Fri, 19 Feb 2016 03:15:33 +0000 (03:15 +0000)]
Add profile summary support for sample profile.

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

llvm-svn: 261304

8 years ago[SjLjEHPrepare] Don't grab pointers to functions in doInitialization
David Majnemer [Fri, 19 Feb 2016 03:13:40 +0000 (03:13 +0000)]
[SjLjEHPrepare] Don't grab pointers to functions in doInitialization

Certain optimization passes (like globaldce) can prune function
declaration that SjLjEHPrepare assumed would exit when it'd
runOnFunction.

This fixes PR26669.

llvm-svn: 261303

8 years ago[AA] Preserve the AA results wrapper pass as well as BasicAA in a few
Chandler Carruth [Fri, 19 Feb 2016 03:12:14 +0000 (03:12 +0000)]
[AA] Preserve the AA results wrapper pass as well as BasicAA in a few
more places to prevent gratuitous re-"runs" of these passes.

The passes themselves don't do any work when run, but we keep spending
time scheduling and running these needlessly when we really don't need
to do so.

This is the first patch towards fixing the really horrible loop pass
pipeline fragmentation pointed out by Sanjoy in PR24804.

llvm-svn: 261302

8 years agoFix SemaTemplate/instantiate-field.cpp after r261297.
Nico Weber [Fri, 19 Feb 2016 02:51:07 +0000 (02:51 +0000)]
Fix SemaTemplate/instantiate-field.cpp after r261297.

For templates, fields can have incomplete types:

  template <class T>
  struct A2 {
    struct B;
    B b;
  };

Don't try to touch the DefinitionData of those fields.

llvm-svn: 261301

8 years ago[llvm-nm] In C++, main implicitly returns 0. Pointed out by David Blaikie.
Davide Italiano [Fri, 19 Feb 2016 02:22:54 +0000 (02:22 +0000)]
[llvm-nm] In C++, main implicitly returns 0. Pointed out by David Blaikie.

llvm-svn: 261300

8 years agoBug fix: use dyn_cast_or_null instead of dyn_cast
Lawrence Hu [Fri, 19 Feb 2016 02:17:07 +0000 (02:17 +0000)]
Bug fix: use dyn_cast_or_null instead of dyn_cast

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

llvm-svn: 261299

8 years agollvm-dwp: Don't test compression when zlib isn't available
David Blaikie [Fri, 19 Feb 2016 02:03:45 +0000 (02:03 +0000)]
llvm-dwp: Don't test compression when zlib isn't available

llvm-svn: 261298

8 years agoImplement the likely resolution of core issue 253.
Nico Weber [Fri, 19 Feb 2016 01:52:46 +0000 (01:52 +0000)]
Implement the likely resolution of core issue 253.

C++11 requires const objects to have a user-provided constructor, even for
classes without any fields. DR 253 relaxes this to say "If the implicit default
constructor initializes all subobjects, no initializer should be required."

clang is currently the only compiler that implements this C++11 rule, and e.g.
libstdc++ relies on something like DR 253 to compile in newer versions.  This
change  makes it possible to build code that says `const vector<int> v;' again
when using libstdc++5.2 and _GLIBCXX_DEBUG
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60284).

Fixes PR23381.

http://reviews.llvm.org/D16552

llvm-svn: 261297

8 years agollvm-dwp: Support compressed input
David Blaikie [Fri, 19 Feb 2016 01:51:44 +0000 (01:51 +0000)]
llvm-dwp: Support compressed input

llvm-svn: 261296

8 years agoUpdate cxx_dr_status.html with today's cwg_index.html.
Nico Weber [Fri, 19 Feb 2016 01:49:39 +0000 (01:49 +0000)]
Update cxx_dr_status.html with today's cwg_index.html.

Created by:
cd www
curl -O http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_index.html
./make_cxx_dr_status

llvm-svn: 261295

8 years agoMinor code cleanups. NFC.
Junmo Park [Fri, 19 Feb 2016 01:46:04 +0000 (01:46 +0000)]
Minor code cleanups. NFC.

llvm-svn: 261294

8 years ago[analyzer] Add checker callback for beginning of function.
Devin Coughlin [Fri, 19 Feb 2016 01:35:10 +0000 (01:35 +0000)]
[analyzer] Add checker callback for beginning of function.

Add a checker callback that is called when the analyzer starts analyzing a
function either at the top level or when inlined. This will be used by a
follow-on patch making the DeallocChecker path sensitive.

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

llvm-svn: 261293

8 years ago[Sema] PR25181 Fix crash when method declaration with throw spec fails to parse correctly
Reid Kleckner [Fri, 19 Feb 2016 01:15:08 +0000 (01:15 +0000)]
[Sema] PR25181 Fix crash when method declaration with throw spec fails to parse correctly

Fixes crash referenced in PR25181 where dyn_cast is called on a null
instance of LM.Method.

Reviewers: majnemer, rnk

Patch by Don Hinton

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

llvm-svn: 261292

8 years ago[sancov] widening default blacklist.
Mike Aizatsky [Fri, 19 Feb 2016 01:03:12 +0000 (01:03 +0000)]
[sancov] widening default blacklist.

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

llvm-svn: 261291

8 years agoAdd call to find_package to load LLVM dependencies
Reid Kleckner [Fri, 19 Feb 2016 00:56:56 +0000 (00:56 +0000)]
Add call to find_package to load LLVM dependencies

ClangConfig requires LLVMConfig, so add find_package call in
ClangConfig so find_package(clang REQUIRED CONFIG) will just work.  This
makes it easier for cmake based projects to use clang, e.g., tools using
ClangTooling.

Patch by Don Hinton

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

llvm-svn: 261290

8 years ago[sancov] Adding covered/uncovered tables to coverage report.
Mike Aizatsky [Fri, 19 Feb 2016 00:26:20 +0000 (00:26 +0000)]
[sancov] Adding covered/uncovered tables to coverage report.

Summary:
This change adds 3 tables to html report:
- list of covered files with number of functions covered.
- list of not covered files
- list of not covered functions.

I tried to put most coverage-calculating functionality into
SourceCoverageData.

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

llvm-svn: 261287

8 years agoWhen printing MIR, output to errs() rather than outs().
Justin Lebar [Fri, 19 Feb 2016 00:18:46 +0000 (00:18 +0000)]
When printing MIR, output to errs() rather than outs().

Summary:
Without this, this command

  $ llvm-run llc -stop-after machine-cp -o - <( echo '' )

outputs an error, because we close stdout twice -- once when closing the
file opened for "-o", and again when closing outs().

Also clarify in the outs() definition that you can't ever call it if you
want to open your own raw_fd_ostream on stdout.

Reviewers: jroelofs, tstellarAMD

Subscribers: jholewinski, qcolombet, dsanders, llvm-commits

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

llvm-svn: 261286

8 years agoFix my typo from r261278
Richard Trieu [Fri, 19 Feb 2016 00:15:50 +0000 (00:15 +0000)]
Fix my typo from r261278

llvm-svn: 261285

8 years ago[CaptureTracking] Add a test case for pointer cmpxchg
Philip Reames [Fri, 19 Feb 2016 00:13:09 +0000 (00:13 +0000)]
[CaptureTracking] Add a test case for pointer cmpxchg

This test builds on 261250 (IR support for cmpxchg of pointers) and 261245 (capture tracking support for cmpxchg) to show that correctly analyze the capturing of pointers in a cmpxchg of pointer type.

llvm-svn: 261284

8 years ago[IR] Extend cmpxchg to allow pointer type operands
Philip Reames [Fri, 19 Feb 2016 00:06:41 +0000 (00:06 +0000)]
[IR] Extend cmpxchg to allow pointer type operands

Today, we do not allow cmpxchg operations with pointer arguments. We require the frontend to insert ptrtoint casts and do the cmpxchg in integers. While correct, this is problematic from a couple of perspectives:
1) It makes the IR harder to analyse (for instance, it make capture tracking overly conservative)
2) It pushes work onto the frontend authors for no real gain

This patch implements the simplest form of IR support. As we did with floating point loads and stores, we teach AtomicExpand to convert back to the old representation. This prevents us needing to change all backends in a single lock step change. Over time, we can migrate each backend to natively selecting the pointer type. In the meantime, we get the advantages of a cleaner IR representation without waiting for the backend changes.

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

llvm-svn: 261281

8 years agoThis patch stops lldb from loading a .lldbinit file from the current
Jason Molenda [Fri, 19 Feb 2016 00:05:17 +0000 (00:05 +0000)]
This patch stops lldb from loading a .lldbinit file from the current
working directory by default -- a typical security problem that we
need to be more conservative about.

It adds a new target setting, target.load-cwd-lldbinit which may
be true (always read $cwd/.lldbinit), false (never read $cwd/.lldbinit)
or warn (warn if there is a $cwd/.lldbinit and don't read it).  The
default is set to warn.  If this is met with unhappiness, we can look
at changing the default to true (to match current behavior) on a
different platform.

This does not affect reading of ~/.lldbinit - that will still be read,
as before.  If you run lldb in your home directory, it will not warn
about the presence of a .lldbinit file there.

I had to add two SB API - SBHostOS::GetUserHomeDirectory and
SBFileSpec::AppendPathComponent - for the lldb driver code to be
able to get the home directory path in an OS neutral manner.

The warning text is

There is a .lldbinit file in the current directory which is not being read.
To silence this warning without sourcing in the local .lldbinit,
add the following to the lldbinit file in your home directory:
    settings set target.load-cwd-lldbinit false
To allow lldb to source .lldbinit files in the current working directory,
set the value of this variable to true.  Only do so if you understand and
accept the security risk.

<rdar://problem/24199163>

llvm-svn: 261280

8 years agoMake sure code that is in the middle of figuring out the correct architecture
Jim Ingham [Thu, 18 Feb 2016 23:58:45 +0000 (23:58 +0000)]
Make sure code that is in the middle of figuring out the correct architecture
on attach uses the architecture it has figured out, rather than the Target's
architecture, which may not have been updated to the correct value yet.

<rdar://problem/24632895>

llvm-svn: 261279

8 years agoAdd -Wcomma warning to Clang.
Richard Trieu [Thu, 18 Feb 2016 23:58:40 +0000 (23:58 +0000)]
Add -Wcomma warning to Clang.

-Wcomma will detect and warn on most uses of the builtin comma operator.  It
currently whitelists the first and third statements of the for-loop.  For other
cases, the warning can be silenced by casting the first operand of the comma
operator to void.

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

llvm-svn: 261278

8 years ago[x86] fix initialization of PredictableSelectIsExpensive
Sanjay Patel [Thu, 18 Feb 2016 23:08:48 +0000 (23:08 +0000)]
[x86] fix initialization of PredictableSelectIsExpensive

This is effectively NFC because Atom is the only in-order x86 subtarget currently,
but the predicate would have become wrong if any other in-order CPU came along.

See related discussion in:
http://reviews.llvm.org/D16836

llvm-svn: 261275

8 years ago[ASTImporter] Implement missing VisitAccessSpecDecl function in ASTImporter class.
Argyrios Kyrtzidis [Thu, 18 Feb 2016 23:08:36 +0000 (23:08 +0000)]
[ASTImporter] Implement missing VisitAccessSpecDecl function in ASTImporter class.

Patch by Elisavet Sakellari!

llvm-svn: 261274

8 years ago[CMake] Properly set CMAKE_BUILD_TYPE to Debug by default
Chris Bieneman [Thu, 18 Feb 2016 23:07:09 +0000 (23:07 +0000)]
[CMake] Properly set CMAKE_BUILD_TYPE to Debug by default

Summary:
PR26666: CMAKE_BUILD_TYPE was previously being reset to blank.

Reviewers: rnk, beanz

Subscribers: llvm-commits

Patch By: Derek Bruening

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

llvm-svn: 261273