Commit Graph

119845 Commits

Author SHA1 Message Date
Chen Li
5015f9766b [LoopUnswitch] Code refactoring to separate trivial loop unswitch and non-trivial loop unswitch in processCurrentLoop()
Summary: The current code in LoopUnswtich::processCurrentLoop() mixes trivial loop unswitch and non-trivial loop unswitch together. It goes over all basic blocks in the loop and checks if a condition is trivial or non-trivial unswitch condition. However, trivial unswitch condition can only occur in the loop header basic block (where it controls whether or not the loop does something at all). This refactoring separate trivial loop unswitch and non-trivial loop unswitch. Before going over all basic blocks in the loop, it checks if the loop header contains a trivial unswitch condition. If so, unswitch it. Otherwise, go over all blocks like before but don't check trivial condition any more since they are not possible to be in the other blocks. This code has no functionality change.

Reviewers: meheff, reames, broune

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242873 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-22 05:26:29 +00:00
Jingyue Wu
9764983070 [BranchFolding] do not iterate the aliases of virtual registers
Summary:
MCRegAliasIterator only works for physical registers. So, do not run it
on virtual registers.

With this issue fixed, we can resurrect the BranchFolding pass in NVPTX
backend.

Reviewers: jholewinski, bkramer

Subscribers: henryhu, meheff, llvm-commits, jholewinski

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242871 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-22 04:16:52 +00:00
Chandler Carruth
2cf40d1ae5 [SROA] Fix a nasty pile of bugs to do with big-endian, different alloca
types and loads, loads or stores widened past the size of an alloca,
etc.

This started off with a bug report about big-endian behavior with
bitfields and loads and stores to a { i32, i24 } struct. An initial
attempt to fix this was sent for review in D10357, but that didn't
really get to the root of the problem.

The core issue was that canConvertValue and convertValue in SROA were
handling different bitwidth integers by doing a zext of the integer. It
wouldn't do a trunc though, only a zext! This would in turn lead SROA to
form an i24 load from an i24 alloca, zext it to i32, and then use it.
This would at least produce the wrong value for big-endian systems.

One of my many false starts here was to correct the computation for
big-endian systems by shifting. But this doesn't actually work because
the original code has a 64-bit store to the entire 8 bytes, and a 32-bit
load of the last 4 bytes, and because the alloc size is 8 bytes, we
can't lose that last (least significant if bigendian) byte! The real
problem here is that we're forming an i24 load in SROA which is actually
not sufficiently wide to load all of the necessary bits here. The source
has an i32 load, and SROA needs to form that as well.

The straightforward way to do this is to disable the zext logic in
canConvertValue and convertValue, forcing us to actually load all
32-bits. This seems like a really good change, but it in turn breaks
several other parts of SROA.

First in the chain of knock-on failures, we had places where we were
doing integer-widening promotion even though some of the integer loads
or stores extended *past the end* of the alloca's memory! There was even
a comment about preventing this, but it only prevented the case where
the type had a different bit size from its store size. So I added checks
to handle the cases where we actually have a widened load or store and
to avoid trying to special integer widening promotion in those cases.

Second, we actually rely on the ability to promote in the face of loads
past the end of an alloca! This is important so that we can (for
example) speculate loads around PHI nodes to do more promotion. The bits
loaded are garbage, but as long as they aren't used and the alignment is
suitable high (which it wasn't in the test case!) this is "fine". And we
can't stop promoting here, lots of things stop working well if we do. So
we need to add specific logic to handle the extension (and truncation)
case, but *only* where that extension or truncation are over bytes that
*are outside the alloca's allocated storage* and thus totally bogus to
load or store.

And of course, once we add back this correct handling of extension or
truncation, we need to correctly handle bigendian systems to avoid
re-introducing the exact bug that started us off on this chain of misery
in the first place, but this time even more subtle as it only happens
along speculated loads atop a PHI node.

I've ported an existing test for PHI speculation to the big-endian test
file and checked that we get that part correct, and I've added several
more interesting big-endian test cases that should help check that we're
getting this correct.

Fun times.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242869 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-22 03:32:42 +00:00
Richard Smith
54b8d4eaf8 SetVector: add reverse_iterator support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242865 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-22 01:30:58 +00:00
Alexey Samsonov
3dee92c907 [Fuzzer] Rely on $PATH expansion instead of hardcoding paths in tests. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242851 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 22:51:55 +00:00
Alexey Samsonov
bb577748c0 [Fuzzer] Clearly separate regular and DFSan tests. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242850 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 22:51:49 +00:00
Frederic Riss
309fcf84b8 [dsymutil] Implement ODR uniquing for C++ code.
This optimization allows the DWARF linker to reuse definition of
types it has emitted in previous CUs rather than reemitting them
in each CU that references them. The size and link time gains are
huge. For example when linking the DWARF for a debug build of
clang, this generates a ~150M dwarf file instead of a ~700M one
(the numbers date back a bit and must not be totally accurate
these days).

As with all the other parts of the llvm-dsymutil codebase, the
goal is to keep bit-for-bit compatibility with dsymutil-classic.
The code is littered with a lot of FIXMEs that should be
addressed once we can get rid of the compatibilty goal.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242847 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 22:41:43 +00:00
Alex Lorenz
1b75dd2bc2 MIR Serialization: Start serializing the CFI operands with .cfi_def_cfa_offset.
This commit begins serialization of the CFI index machine operands by
serializing one kind of CFI instruction - the .cfi_def_cfa_offset instruction.

Reviewers: Duncan P. N. Exon Smith


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242845 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 22:28:27 +00:00
Nick Lewycky
f17fb8d947 Fix a performance problem in memcpyopt by removing a linear scan over ranges when inserting a new range. No functionality change intended. Patch by Anthony Pesch!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242843 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 21:56:26 +00:00
Jingyue Wu
0a6b8b7be0 [MDA] change BlockScanLimit into a command line option.
Summary:
In the benchmark (https://github.com/vetter/shoc) we are researching,
the duplicated load is not eliminated because MemoryDependenceAnalysis
hit the BlockScanLimit. This patch change it into a command line option
instead of a hardcoded value.

Patched by Xuetian Weng. 

Test Plan: test/Analysis/MemoryDependenceAnalysis/memdep-block-scan-limit.ll

Reviewers: jingyue, reames

Subscribers: reames, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242842 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 21:50:39 +00:00
Bruno Cardoso Lopes
a14dff356b [AsmPrinter] Check for valid constants in handleIndirectSymViaGOTPCRel
Check whether BaseCst is valid before extracting a GlobalValue.
This fixes PR24163.

Patch by David Majnemer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242840 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 21:45:42 +00:00
Michael J. Spencer
3f6881efa5 [Object][ELF] Handle files with no section header string table.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242839 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 21:40:33 +00:00
Bill Schmidt
68a4b41648 [PPC64LE] More vector swap optimization TLC
This makes one substantive change and a few stylistic changes to the
VSX swap optimization pass.

The substantive change is to permit LXSDX and LXSSPX instructions to
participate in swap optimization computations.  The previous change to
insert a swap following a SUBREG_TO_REG widening operation makes this
almost trivial.

I experimented with also permitting STXSDX and STXSSPX instructions.
This can be done using similar techniques:  we could insert a swap
prior to a narrowing COPY operation, and then permit these stores to
participate.  I prototyped this, but discovered that the pattern of a
narrowing COPY followed by an STXSDX does not occur in any of our
test-suite code.  So instead, I added commentary indicating that this
could be done.

Other TLC:
 - I changed SH_COPYSCALAR to SH_COPYWIDEN to more clearly indicate
 the direction of the copy.
 - I factored the insertion of swap instructions into a separate
 function.

Finally, I added a new test case to check that the scalar-to-vector
loads are working properly with swap optimization.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242838 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 21:40:17 +00:00
Alex Lorenz
5938be0e84 MIR Parser: Reuse the function 'lexName' when lexing global value tokens. NFC.
This commit refactors the function 'maybeLexGlobalValue' so that now it reuses
the function 'lexName' when lexing a named global value token.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242837 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 21:23:08 +00:00
Sanjoy Das
52509c07e5 [SCEV][NFC] Fix a typo in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242834 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 20:59:22 +00:00
Rafael Espindola
c22eb2bea6 Don't iterate over the program headers in the constructor of ELFFile.
Not every program needs this information.

In particular, it is necessary and sufficient for a static linker to scan the
section table.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242833 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 20:50:53 +00:00
Tanya Lattner
85223309d7 Remove oversight group. Replace with LLVM Foundation Board of Directors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242830 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 20:14:20 +00:00
Rafael Espindola
ca7fac9a29 Make printValue a member function.
We were already passing 3 values it can get from ELFDumper.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242829 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 19:57:43 +00:00
Rafael Espindola
961b7c2b52 Remove always null argument.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242828 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 19:38:32 +00:00
Philip Reames
4ccee6b377 [RewriteStatepointsForGC] minor style cleanup
Use a named lambda for readability, common some code, remove a stale comments, and use llvm style variable names.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242827 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 19:04:38 +00:00
David Blaikie
2f6af0e277 Add some utilities to iterator_range for trimming a range and constructing one from a container.
To be used in clang in a follow-up commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242823 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 18:37:12 +00:00
Rafael Espindola
d8a62d931e Remove getDynamicSymbolName.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242821 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 18:20:17 +00:00
Rafael Espindola
9ed0d629ce Remove getStaticSymbolName.
Every user now keeps track of the correct string table to use.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242818 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 18:04:29 +00:00
Chad Rosier
d0a4c8888f Follow up to r242810. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242812 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 17:47:56 +00:00
Chad Rosier
6d235f7be0 [AArch64] Simplify the passing of arguments. NFC.
This is setup for future work planned for the AArch64 Load/Store Opt pass.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242810 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 17:42:04 +00:00
Reid Kleckner
90a1b93e9f Re-land 242726 to use RAII to do cleanup
The LooksLikeCodeInBug11395() codepath was returning without clearing
the ProcessedAllocas cache.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242809 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 17:40:14 +00:00
Philip Reames
d0db907e73 [RewriteStatepointsForGC] Hoist some code out of a loop
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242808 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 17:18:03 +00:00
Arnold Schwaighofer
a5aae48d17 MergeFunc: Transfer the callee's attributes when replacing a direct caller
We insert a bitcast which obfuscates the getCalledFunction for the utility
function which looks up attributes from the called function. Loosing ABI
changing parameter attributes is a bad thing.

rdar://21516488

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242807 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 17:07:07 +00:00
Alex Lorenz
65671bf628 MIR Serialization: Serialize the external symbol machine operands.
Reviewers: Duncan P. N. Exon Smith


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242806 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 16:59:53 +00:00
Philip Reames
5769e19790 [RewriteStatepointsForGC] Delete trivial code
A bit more code cleanup: delete some a trivial true assertion and supporting code, remove a redundant cast, and use count in assertions where feasible.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242805 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 16:51:17 +00:00
Rafael Espindola
746609067c Remove dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242804 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 16:50:57 +00:00
Alex Lorenz
476706ed94 IR: Extract a function 'printLLVMNameWithoutPrefix' from 'PrintLLVMName'. NFC.
This commit extracts the code that prints out a name of an LLVM value without a
prefix from a function 'PrintLLVMName' into a publicly accessible function named
'printLLVMNameWithoutPrefix'.

This change would be useful for MIR serialization, as it would allow the MIR
printer to reuse this function to print out the names of the external symbol
machine operands.

Reviewers: Duncan P. N. Exon Smith


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242803 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 16:50:35 +00:00
Rafael Espindola
a33feabe7a Remove always false parameter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242802 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 16:42:01 +00:00
Rafael Espindola
51ac821430 Use range loop. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242801 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 16:40:14 +00:00
Rafael Espindola
7eeb71ddc3 Replace the last uses of ELF::getSymbolName in llvm-readobj.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242798 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 16:26:21 +00:00
Sanjay Patel
cc3246a567 fix formatting; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242796 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 16:09:58 +00:00
Rafael Espindola
9ea117379c Use helper function. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242795 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 16:05:53 +00:00
Rafael Espindola
fcadda639e llvm-readobj: use the associated string table to print symbols. NFI.
This just removes some cases that require ELFFile to eagerly parse the ELF
file.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242794 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 16:02:10 +00:00
Chris Bieneman
791500fa0d [CMake] Projects supported via LLVM_EXTERNAL_*_SOURCE_DIR need to be explicitly specified.
One part of my refactoring from r242705 is untenable due to how CMake caches variables. There is no way other than caching to allow variables to be set in one directory and globally readable, but we really don't want to cache the temporary value marking that a directory has already been included.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242793 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 15:53:09 +00:00
Nico Weber
4a3c9fcd83 Revert 242726, it broke ASan on OS X.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242792 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 15:48:53 +00:00
Rafael Espindola
ab466de617 Remove unused variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242789 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 14:45:56 +00:00
Rafael Espindola
71e35258cb Simplify printing the soname. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242786 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 13:48:41 +00:00
Rafael Espindola
ed3c543ddb Add missing c++ marker to .h file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242784 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 13:42:38 +00:00
Karthik Bhat
c721349466 Constfold trunc,rint,nearbyint,ceil and floor using APFloat
A patch by Chakshu Grover!
This patch allows constfolding of trunc,rint,nearbyint,ceil and floor intrinsics using APFloat class.
Differential Revision: http://reviews.llvm.org/D11144


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242763 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 08:52:23 +00:00
Igor Breger
7d40c4215d AVX512 : Implemented VPMADDUBSW and VPMADDWD instruction ,
Added tests for intrinsics and encoding.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242761 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 07:11:28 +00:00
Eric Fiselier
40e186ac0e [LIT] Fix discovery.py test once again
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242758 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 04:25:13 +00:00
Akira Hatanaka
27ac0fae47 [ARM] Define subtarget feature "reserve-r9", which is used to decide
whether register r9 should be reserved.

This recommits r242737, which broke bots because the number of subtarget
features went over the limit of 64.

This change is needed because we cannot use a backend option to set
cl::opt "arm-reserve-r9" when doing LTO.

Out-of-tree projects currently using cl::opt option "-arm-reserve-r9" to
reserve r9 should make changes to add subtarget feature "reserve-r9" to
the IR.

rdar://problem/21529937

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242756 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 01:42:02 +00:00
Akira Hatanaka
16cb7fc21c Bump the size of FeatureBitset up to 96-bits.
This should avoid exceeding the maximum size when I add another subtarget
feature to ARM's subtarget.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242754 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 01:39:22 +00:00
Rafael Espindola
04d208815c Don't do a walk over the dynamic table just to find DT_SONAME.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242752 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 01:01:29 +00:00
Philip Reames
052b66199d [RewriteStatepointsForGC] Minor code cleanup [NFC]
We can use builders to simplify part of the code and we only check for the existance of the metadata value; this enables us to delete some redundant code.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242751 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 00:49:55 +00:00