Commit Graph

223208 Commits

Author SHA1 Message Date
Dan Gohman 87e368b7db [WebAssembly] Add another optimization idea to README.txt.
llvm-svn: 261354
2016-02-19 19:22:44 +00:00
Zachary Turner 41331afaef Don't use an atexit handler for cleaning up the temp directory.
Differential Revision: http://reviews.llvm.org/D17420

llvm-svn: 261353
2016-02-19 19:20:44 +00:00
Mike Aizatsky 731942565b [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
2016-02-19 18:46:30 +00:00
Anastasia Stulova 6bdbcbb3d9 [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
2016-02-19 18:30:11 +00:00
Geoff Berry 7e4ba3dc02 [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
2016-02-19 18:27:32 +00:00
Sanjoy Das f6fee29ceb [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
2016-02-19 18:15:56 +00:00
Sanjoy Das e8019df552 [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
2016-02-19 18:15:53 +00:00
Matthew Simpson 29c997c1a1 [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
2016-02-19 17:56:08 +00:00
Ewan Crawford 615a807ee8 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
2016-02-19 17:55:10 +00:00
Xinliang David Li f56aeef645 [PGO] Enable profile-rt testing on all supported targets
Differential Revision: http://reviews.llvm.org/D17361

llvm-svn: 261344
2016-02-19 17:52:28 +00:00
Reid Kleckner 12813b0def [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
2016-02-19 17:36:54 +00:00
Ed Maste 06977c799c 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
2016-02-19 17:35:01 +00:00
Ed Maste 7a2e8b3691 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
2016-02-19 17:31:05 +00:00
Reid Kleckner 00203bc60b [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
2016-02-19 17:30:38 +00:00
Sanjoy Das 171313c69a [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
2016-02-19 17:15:26 +00:00
Sanjoy Das d2db73ba59 [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
2016-02-19 17:15:22 +00:00
Sanjoy Das 7b2e91fb59 [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
2016-02-19 17:15:17 +00:00
Ed Maste 622ab96c85 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
2016-02-19 16:58:08 +00:00
Kevin B. Smith 652128d48c [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
2016-02-19 16:20:48 +00:00
Silviu Baranga ad1dafb2c3 [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
2016-02-19 15:46:10 +00:00
Tom Stellard 2d26fe7aa6 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
2016-02-19 15:33:13 +00:00
Simon Pilgrim 9630a4ab15 [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
2016-02-19 14:38:09 +00:00
Ewan Crawford 766492fde3 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
2016-02-19 14:31:41 +00:00
Rafael Espindola 7efa5be205 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
2016-02-19 14:17:40 +00:00
Rafael Espindola 758de9ca18 Add support for merging strings with alignment larger than one char.
This will be used in a lld patch.

llvm-svn: 261326
2016-02-19 14:13:52 +00:00
Ulrich Weigand cfa1d2b49d [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
2016-02-19 14:10:21 +00:00
Aaron Ballman 611d2e4ee6 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://www.securecoding.cert.org/confluence/display/c/FLP30-C.+Do+not+use+floating-point+variables+as+loop+counters
llvm-svn: 261324
2016-02-19 14:03:20 +00:00
Serge Pavlov 7ca8a826f4 Removed unused local variable
llvm-svn: 261323
2016-02-19 12:06:23 +00:00
George Rimar d2389bfd9d Attemp to heal windows buildbot
http://lab.llvm.org:8011/builders/sanitizer-windows/builds/17414

llvm-svn: 261322
2016-02-19 11:56:49 +00:00
Alexey Bataev 455bdd9234 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
2016-02-19 11:23:28 +00:00
Tobias Grosser 58e585444a 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
2016-02-19 11:07:12 +00:00
Chandler Carruth 567888395e [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
2016-02-19 10:59:43 +00:00
Tamas Berghammer 73bcca5b3d 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
2016-02-19 10:59:25 +00:00
George Rimar f23b23200d [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
2016-02-19 10:45:45 +00:00
Chandler Carruth 31088a9d58 [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
2016-02-19 10:45:18 +00:00
Alexey Bataev 50b3c95992 [OPENMP] Improved layout of CGOpenMPRuntime class, NFC.
llvm-svn: 261315
2016-02-19 10:38:26 +00:00
Pavel Labath 1274474c64 Enable TestUnicodeLiterals
Test should work everywhere except windows now.

llvm-svn: 261314
2016-02-19 10:36:38 +00:00
Pavel Labath b3b8fd3b00 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
2016-02-19 10:36:31 +00:00
David Majnemer c919f5f964 Correct typos after acting on invalid subscript expressions
llvm-svn: 261312
2016-02-19 07:15:33 +00:00
Craig Topper 5eeb41c173 [X86] Remove unused entries from the disassembler type enum.
llvm-svn: 261311
2016-02-19 06:57:40 +00:00
JF Bastien ddb4369ead Add test.
llvm-svn: 261310
2016-02-19 06:54:47 +00:00
JF Bastien 750caef39c 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
2016-02-19 06:54:45 +00:00
David Majnemer 693f13156e Shuffle header file as per the Coding Standards
llvm-svn: 261308
2016-02-19 04:46:48 +00:00
David Majnemer b61fd7fc6d [SjLjEHPrepare] Simplify/cleanup code
No functional change is intended.

llvm-svn: 261307
2016-02-19 04:46:06 +00:00
Matthias Braun 848e79c578 LegalizeDAG: Fix ExpandFCOPYSIGN assuming the same type on both inputs
llvm-svn: 261306
2016-02-19 04:44:19 +00:00
Chandler Carruth 1aff022c9b [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
2016-02-19 04:09:40 +00:00
Easwaran Raman 40ee23dbd2 Add profile summary support for sample profile.
Differential Revision: http://reviews.llvm.org/D17178

llvm-svn: 261304
2016-02-19 03:15:33 +00:00
David Majnemer bd1b8c0889 [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
2016-02-19 03:13:40 +00:00
Chandler Carruth ac07270828 [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
2016-02-19 03:12:14 +00:00
Nico Weber 344abaa026 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
2016-02-19 02:51:07 +00:00