Commit Graph

225151 Commits

Author SHA1 Message Date
Justin Lebar 6827de19b2 [LoopUnroll] Respect the convergent attribute.
Summary:
Specifically, when we perform runtime loop unrolling of a loop that
contains a convergent op, we can only unroll k times, where k divides
the loop trip multiple.

Without this change, we'll happily unroll e.g. the following loop

  for (int i = 0; i < N; ++i) {
    if (i == 0) convergent_op();
    foo();
  }

into

  int i = 0;
  if (N % 2 == 1) {
    convergent_op();
    foo();
    ++i;
  }
  for (; i < N - 1; i += 2) {
    if (i == 0) convergent_op();
    foo();
    foo();
  }.

This is unsafe, because we've just added a control-flow dependency to
the convergent op in the prelude.

In general, runtime unrolling loops that contain convergent ops is safe
only if we don't have emit a prelude, which occurs when the unroll count
divides the trip multiple.

Reviewers: resistor

Subscribers: llvm-commits, mzolotukhin

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

llvm-svn: 263509
2016-03-14 23:15:34 +00:00
NAKAMURA Takumi fa99425667 MathExtrasTest.cpp: Use EXPECT_DOUBLE_EQ here, instead of EXPECT_FLOAT_EQ.
llvm-svn: 263508
2016-03-14 23:11:28 +00:00
Marshall Clow 6257b93e69 Missed this file in previous checkin
llvm-svn: 263507
2016-03-14 23:07:58 +00:00
Marshall Clow 0b54e792b7 Implement LWG2577: {shared,unique}_lock</tt> should use std::addressof
llvm-svn: 263506
2016-03-14 23:07:32 +00:00
NAKAMURA Takumi 423ec18cc2 clang/test/CodeGenCXX/virtual-function-attrs.cpp: Appease i686-mingw32 to expect x86_thiscallcc.
llvm-svn: 263505
2016-03-14 23:00:44 +00:00
Rui Ueyama 113819bf8b Object: Add ELF types to ELFType.
These types are defined in ELFFile, so in order to use them, you have
to write ELFFile<ELFT>::SomeType. But there seems to be no reason to have
ELFFile have these types. This patch allows you to write ELFT::SomeType
instead.

This simplifies libObject users.
This is an example: http://reviews.llvm.org/D18129

http://reviews.llvm.org/D18130

llvm-svn: 263504
2016-03-14 22:58:21 +00:00
Amaury Sechet bdb261b4c0 Imporove load to store => memcpy
Summary: This now try to reorder instructions in order to help create the optimizable pattern.

Reviewers: craig.topper, spatel, dexonsmith, Prazek, chandlerc, joker.eph, majnemer

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

llvm-svn: 263503
2016-03-14 22:52:27 +00:00
Rui Ueyama f50e1d8358 Make getAlignment a non-member function. NFC.
This function did not rely on Writer class.

llvm-svn: 263502
2016-03-14 22:41:08 +00:00
Manuel Jacob 6be355961e Re-add ConstantFoldInstOperands form taking opcode and return type.
Summary:
This form was replaced by a form taking an instruction instead of opcode and
return type in r258391.  After committing this change (and some depending,
follow-up changes) it turned out in the review thread to be controversial.  The
discussion didn't come to a conclusion yet.  I'm re-adding the old form to fix
the API regression and to provide a better base for discussion, possibly on
llvm-dev.

A difference to the original function is that it can't be called with GEPs
(similarly to how it was already the case for compares).  In order to support
opaque pointers in the future, folding GEPs needs to be passed the source
element type, which is not possible with the current API.

Reviewers: dberlin, reames

Subscribers: dblaikie, eddyb

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

llvm-svn: 263501
2016-03-14 22:34:17 +00:00
Easwaran Raman f9709ee001 Remove code added for debugging purposes. NFC.
llvm-svn: 263500
2016-03-14 22:23:28 +00:00
Enrico Granata bef55ac8f5 Lots of progress on the CommandAlias refactoring
This cleans things up such CommandAlias essentially can work as its own object; the aliases still live in a separate map, but are now just full-fledged CommandObjectSPs
This patch also cleans up help generation for aliases, allows aliases to vend their own help, and adds a tweak such that "dash-dash aliases", such as po, don't show the list of options for their underlying command, since those can't be provided anyway

I plan to fix up a few more things here, and then add a test case and proclaim victory

llvm-svn: 263499
2016-03-14 22:17:04 +00:00
Justin Bogner 2414c5d46b llvm-shlib: Remove the option to override __cxa_atexit
If anybody is actually using this, it probably doesn't do what they
think it does. This actually causes the dylib to *export* a
__cxa_atexit symbol, so anything that links it probably loses their
exit time destructors as well as disabling LLVM's.

This just removes the option entirely. If somebody does need this
behaviour we should figure out a more principled way to do it.

This is effectively a revert of r223805.

llvm-svn: 263498
2016-03-14 21:54:45 +00:00
Reid Kleckner ecb4090716 llvm-config: fix --libs on Linux
Summary:
llvm-config --libs does not produce correct output since commit r260263
(llvm-config: Add preliminary Windows support) changed naming format of
the libraries. This patch updates llvm-config to recognize new naming
format and output correct linker flags.

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

Patch by Vedran Miletić

Reviewers: ehsan, rnk, pxli168

Subscribers: pxli168

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

llvm-svn: 263497
2016-03-14 21:39:58 +00:00
Rui Ueyama 64bd8df458 Error messages should start with lowercase letters.
llvm-svn: 263496
2016-03-14 21:31:07 +00:00
Amaury Sechet eae09c2c2a Factor out MachineBlockPlacement::fillWorkLists. NFC
Summary: There are places in MachineBlockPlacement where a worklist is filled in pretty much identical way. The code is duplicated. This refactor it so that the same code is used in both scenarii.

Reviewers: chandlerc, majnemer, rafael, MatzeB, escha, silvas

Subscribers: llvm-commits

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

llvm-svn: 263495
2016-03-14 21:24:11 +00:00
Teresa Johnson 376b46128f Revert "[ThinLTO] Clang side of renaming of function index (NFC)"
This reverts commit r263491. Missed a file on the LLVM side.

llvm-svn: 263494
2016-03-14 21:18:17 +00:00
Teresa Johnson cec0cae313 Revert "[ThinLTO] Renaming of function index to module summary index (NFC)"
This reverts commit r263490. Missed a file.

llvm-svn: 263493
2016-03-14 21:18:10 +00:00
Teresa Johnson 9c6cd5df8c [ThinLTO] Clang side of renaming of function index (NFC)
This is the companion to an LLVM patch that renamed the function index
data structures and files to use the more general module summary index.

llvm-svn: 263491
2016-03-14 21:06:06 +00:00
Teresa Johnson 892920b358 [ThinLTO] Renaming of function index to module summary index (NFC)
With the changes in r263275, there are now more than just functions in
the summary. Completed the renaming of data structures (started in
r263275) to reflect the wider scope. In particular, changed the
FunctionIndex* data structures to ModuleIndex*, and renamed related
variables and comments. Also renamed the files to reflect the changes.

A companion clang patch will immediately succeed this patch to reflect
this renaming.

llvm-svn: 263490
2016-03-14 21:05:56 +00:00
Keno Fischer 71b5a81e77 [JITEventListener] Fix some -Wundef warnings
Summary:
This check was added in rL152620, and has started causing downstream warnings in Julia:
```
In file included from /home/tkelman/Julia/julia-0.5/src/codegen.cpp:22:0:
/home/tkelman/Julia/julia-0.5/usr/include/llvm/ExecutionEngine/JITEventListener.h:84:5: warning: "LLVM_USE_INTEL_JITEVENTS" is not defined [-Wundef]
 #if LLVM_USE_INTEL_JITEVENTS
     ^
/home/tkelman/Julia/julia-0.5/usr/include/llvm/ExecutionEngine/JITEventListener.h💯5: warning: "LLVM_USE_OPROFILE" is not defined [-Wundef]
 #if LLVM_USE_OPROFILE
     ^
```

Patch by Tony Kelman.
Reviewers: loladiro
Differential Revision: http://reviews.llvm.org/D17254

llvm-svn: 263487
2016-03-14 20:49:06 +00:00
Ed Maste 7d1eb1de74 Shuffle an #undef to avoid a warning on FreeBSD
On FreeBSD _LIBCPP_EXTERN_TEMPLATE is being defined from something
included by lldb/lldb-private.h. Undefine it after the #include to avoid
the redefinition warning.

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

llvm-svn: 263486
2016-03-14 20:39:08 +00:00
Adam Nemet bb45810e4f Revert "Turn LoopLoadElimination on again"
This reverts commit r263472.

There is an LNT failure on clang-ppc64be-linux-lnt.  Turn this off,
while I am investigating.

llvm-svn: 263485
2016-03-14 20:38:55 +00:00
Chris Bieneman cc2aded1ff [CMake] Updating Apple Clang CMake caches
This is a big update that gets the public configurations more in line with the ones we're actually using internally to ship Clang in Xcode.

From here forward I expect most of the changes in these files to be incremental as the changes get made internally.

llvm-svn: 263483
2016-03-14 20:23:21 +00:00
Sanjay Patel ee52b6e77d allow branch weight metadata on select instructions (PR26636)
As noted in:
https://llvm.org/bugs/show_bug.cgi?id=26636

This doesn't accomplish anything on its own. It's the first step towards preserving 
and using branch weights with selects.

The next step would be to make sure we're propagating the info in all of the other
places where we create selects (SimplifyCFG, InstCombine, etc). I don't think there's
an easy fix to make this happen; we have to look at each transform individually to 
determine how to correctly propagate the weights.

Along with that step, we need to then use the weights when making subsequent transform
decisions such as discussed in http://reviews.llvm.org/D16836.

The inliner test is independent but closely related. It verifies that metadata is
preserved when both branches and selects are cloned.

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

llvm-svn: 263482
2016-03-14 20:18:59 +00:00
Justin Lebar 9d94397859 [attrs] Handle convergent CallSites.
Summary:
Previously we had a notion of convergent functions but not of convergent
calls.  This is insufficient to correctly analyze calls where the target
is unknown, e.g. indirect calls.

Now a call is convergent if it targets a known-convergent function, or
if it's explicitly marked as convergent.  As usual, we can remove
convergent where we can prove that no convergent operations are
performed in the call.

Originally landed as r261544, then reverted in r261544 for (incidental)
build breakage.  Re-landed here with no changes.

Reviewers: chandlerc, jingyue

Subscribers: llvm-commits, tra, jhen, hfinkel

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

llvm-svn: 263481
2016-03-14 20:18:54 +00:00
Justin Lebar ca35b090f8 [docs] "Straightforward" is one word.
llvm-svn: 263480
2016-03-14 20:18:51 +00:00
Justin Lebar 20adbdd2c0 [docs] Fix typo in docs/CodeGenerator.rst.
llvm-svn: 263479
2016-03-14 20:17:08 +00:00
Ulrich Weigand 52aa7fba3f [SystemZ] Add missing isBranch flags to certain instruction
Some instructions were missing isBranch, isCall, or isTerminator
flags.  This didn't really affect code generation since most of
the affected patterns were used only for the AsmParser and/or
disassembler.

However, it could affect tools using the MC layer to disassemble
and parse binary code (e.g. via MCInstrDesc::mayAffectControlFlow).

llvm-svn: 263478
2016-03-14 20:16:30 +00:00
Peter Collingbourne e609197a64 Relax test introduced in r263464 to accept ARM ABI output.
Should fix ARM bots.

llvm-svn: 263477
2016-03-14 20:13:59 +00:00
Keno Fischer a91ae8336b [SLPVectorizer] Fix dependency list
Summary:
DemandedBits was added to the requirements of SLPVectorizer in rL261212
(and various earlier version of it), but the appropriate initialization
statement was accidentally forgotten.

Ref [[ https://github.com/JuliaLang/julia/issues/14998 | JuliaLang/julia#14998 ]].

Patch by Yichao Yu.
Reviewers: mssimpso
Differential Revision: http://reviews.llvm.org/D18152

llvm-svn: 263476
2016-03-14 20:04:24 +00:00
Aaron Ballman be57dfa75d Reverting r263474; it turns out there are uses of the public interface, but MSVC wasn't caring about them.
http://lab.llvm.org:8080/green//job/clang-stage1-cmake-RA-incremental_build/21475/consoleFull#-45876453249ba4694-19c4-4d7e-bec5-911270d8a58c
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/8879

llvm-svn: 263475
2016-03-14 20:03:15 +00:00
Aaron Ballman 1a57daf314 The file header of TrailingObjects.h suggests that TrailingObjects be inherited privately because the public APIs it exposes are not meant as part of the interface. There's no functional change because nothing currently relied on these being inherited publicly.
llvm-svn: 263474
2016-03-14 19:57:48 +00:00
Rui Ueyama 27a3f01deb ELF: Update the document.
llvm-svn: 263473
2016-03-14 19:53:52 +00:00
Adam Nemet 5a19ae917b Turn LoopLoadElimination on again
The two issues that were discovered got fixed (r263058, r263173).

The pass can be disabled with -mllvm -enable-loop-load-elim=0

llvm-svn: 263472
2016-03-14 19:40:25 +00:00
Rui Ueyama 71a8686244 Revert r263366: Cosmetic change to reduce repetitions. NFC.
This reverts commit r263366 because it caused link errors in some linkers.

llvm-svn: 263471
2016-03-14 19:37:58 +00:00
Daniel Jasper 1dcbbcfc5c clang-format: [JS] Handle certain cases of ASI.
Automatic Semicolon Insertion can only be properly handled by parsing
source code. However conservatively catching just a few, common
situations prevents breaking code during development, which greatly
improves usability.

JS code should still use semicolons, and ASI code should be flagged by
a compiler or linter.

Patch by Martin Probst. Thank you.

llvm-svn: 263470
2016-03-14 19:21:36 +00:00
Peter Collingbourne 4e6a540024 CodeGen: Use 32-bit gep offsets to address vtable address points.
The relative vtable ABI will use a struct rather than an array as the type
of a vtable. LLVM only allows 32-bit integers as struct indices, so we need
to use 32-bit integers to get addresses of address points. In order to keep
the code simple, we might as well do that unconditionally.

It's probably a reasonable implementation limit to support no more than 2
billion virtual functions per class.

This change causes quite a bit of churn in the test suite, so I'm making
it separately.

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

llvm-svn: 263469
2016-03-14 19:07:10 +00:00
Enrico Granata 3e271af415 More of the alias refactoring work! CommandAlias is now a CommandObject
llvm-svn: 263468
2016-03-14 19:00:21 +00:00
Ed Maste 5af4d20372 Enable expectedFailure for all Clang versions in TestRegisterVariables
In r262970 this was changed from xfail Clang < 3.5 to > 3.5, but it
still fails on FreeBSD 10's system Clang 3.4.1 so assume it fails on
all versions.

llvm.org/pr26937

llvm-svn: 263467
2016-03-14 18:59:44 +00:00
Rui Ueyama 88daab9174 ELF: Add a few numbers to the document.
llvm-svn: 263466
2016-03-14 18:43:01 +00:00
Peter Collingbourne 0446e7cfae CodeGen: Mark functions used in vtables as unnamed_addr.
This marks virtual function declarations, as well as runtime library functions
__cxa_pure_virtual, __cxa_deleted_virtual and _purecall, as unnamed_addr. This
will allow us to correctly form relative references to them from vtables in
the relative vtable ABI.

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

llvm-svn: 263464
2016-03-14 18:41:59 +00:00
Michael Kuperstein b7860fedd4 [AliasSetTracker] Do not strip pointer casts when processing MemSetInst
This fixes PR26843.

llvm-svn: 263462
2016-03-14 18:34:29 +00:00
Chad Rosier 27c352d26d [AArch64] Refactor AArch64FrameLowering::emitPrologue. NFC.
http://reviews.llvm.org/D18125
Patch by Aditya Kumar.

llvm-svn: 263461
2016-03-14 18:24:34 +00:00
Quentin Colombet 40ce25b68b [SpillPlacement] Fix a quadratic behavior in spill placement.
The bad behavior happens when we have a function with a long linear chain of
basic blocks, and have a live range spanning most of this chain, but with very
few uses.
Let say we have only 2 uses.
The Hopfield network is only seeded with two active blocks where the uses are,
and each iteration of the outer loop in `RAGreedy::growRegion()` only adds two
new nodes to the network due to the completely linear shape of the CFG.
Meanwhile, `SpillPlacer->iterate()` visits the whole set of discovered nodes,
which adds up to a quadratic algorithm.

This is an historical accident effect from r129188.

When the Hopfield network is expanding, most of the action is happening on the
frontier where new nodes are being added. The internal nodes in the network are
not likely to be flip-flopping much, or they will at least settle down very
quickly. This means that while `SpillPlacer->iterate()` is recomputing all the
nodes in the network, it is probably only the two frontier nodes that are
changing their output.

Instead of recomputing the whole network on each iteration, we can maintain a
SparseSet of nodes that need to be updated:

- `SpillPlacement::activate()` adds the node to the todo list.
- When a node changes value (i.e., `update()` returns true), its neighbors are
  added to the todo list.
- `SpillPlacement::iterate()` only updates the nodes in the list.

The result of Hopfield iterations is not necessarily exact. It should converge
to a local minimum, but there is no guarantee that it will find a global
minimum. It is possible that updating nodes in a different order will cause us
to switch to a different local minimum. In other words, this is not NFC, but
although I saw a few runtime improvements and regressions when I benchmarked
this change, those were side effects and actually the performance change is in
the noise as expected.

Huge thanks to Jakob Stoklund Olesen <stoklund@2pi.dk> for his feedbacks,
guidance and time for the review.

llvm-svn: 263460
2016-03-14 18:21:25 +00:00
Chad Rosier 6d98655070 [AArch64] Break the dependency between FP and SP when possible.
When the SP in not changed because of realignment/VLAs etc., we restore the SP
by using the previous value of SP and not the FP. Breaking the dependency will
help in cases when the epilog of a callee is close to the epilog of the caller;
for then "sub sp, fp, #" depends on the load restoring the FP in the epilog of
the callee.

http://reviews.llvm.org/D18060
Patch by Aditya Kumar and Evandro Menezes.

llvm-svn: 263458
2016-03-14 18:17:41 +00:00
Quentin Colombet de89d5f81f [ADT] Add a pop_back_val method to the SparseSet container.
The next commit will use it.

llvm-svn: 263455
2016-03-14 18:10:41 +00:00
Chad Rosier 7a21bb196b [Mips] Fix -Wunused-private-field warning after r263444.
llvm-svn: 263454
2016-03-14 18:10:20 +00:00
Sanjay Patel 7506852709 [DAG] use !isUndef() ; NFCI
llvm-svn: 263453
2016-03-14 18:09:43 +00:00
Marshall Clow bb9f50014c Add failing tests that I forgot to add to the last commit
llvm-svn: 263451
2016-03-14 17:58:54 +00:00
Marshall Clow c1fe2c4329 Implement LWG#2566: Requirements on the first template parameter of container adaptors
llvm-svn: 263450
2016-03-14 17:58:11 +00:00