Commit Graph

124855 Commits

Author SHA1 Message Date
Davide Italiano
3aa1034794 [llvm-readobj] report_error() does not return, so we can simplify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254868 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 23:36:52 +00:00
Dan Gohman
9eb92586b2 [WebAssembly] Don't perform the returned-argument optimization on constants.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254866 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 22:12:39 +00:00
Dan Gohman
39f84fda2f [WebAssembly] Replace the fake JUMP_TABLE instruction with a def : Pat. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254864 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 20:46:53 +00:00
Dan Gohman
76e67ade5a [WebAssembly] Implement direct calls to external symbols.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254863 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 20:41:36 +00:00
Sanjay Patel
27951cf8f8 Add vector fmaxnum tests that correspond to the existing fminnum tests
Note: missing 256-bit tests for min and max should also be added.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254862 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 20:27:10 +00:00
Dan Gohman
b975ecb43f [WebAssembly] Support inline asm constraints of type i16 and similar.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254861 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 20:03:44 +00:00
Sanjay Patel
26a006a71e fix typo; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254860 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 19:54:59 +00:00
Dan Gohman
64d85bf50c [WebAssembly] Update a stale comment. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254859 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 19:43:19 +00:00
JF Bastien
1f5f023fe6 WebAssembly: improve readme, add placeholder for tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254857 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 19:36:33 +00:00
Dan Gohman
ecc456747e [WebAssembly] Move useAA() out of line to make it more convenient to experiment with.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254856 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 19:27:18 +00:00
Dan Gohman
e7174bd9a6 [WebAssembly] Call TargetPassConfig base class functions in overriding functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254855 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 19:24:17 +00:00
Dan Gohman
e05c0dfd57 [WebAssembly] Expand frem as a floating point library function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254854 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 19:15:57 +00:00
Craig Topper
5fa397629b [Hexagon] Don't call getNumImplicitDefs and then iterate over the count. getNumImplicitDefs contains a loop so its better to just loop over the null terminated implicit def list. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254852 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 17:34:07 +00:00
Keno Fischer
b2387dc751 [ASAN] Add doFinalization to reset state
Summary: If the same pass manager is used for multiple modules ASAN
complains about GlobalsMD being initialized twice. Fix this by
resetting GlobalsMD in a new doFinalization method to allow this
use case.

Reviewers: kcc

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254851 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 14:42:34 +00:00
Simon Pilgrim
092921b3d8 [X86][ADX] Added memory folding patterns and stack folding tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254844 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 07:27:50 +00:00
Craig Topper
79402ee6f9 Replace uint16_t with the MCPhysReg typedef in many places. A lot of physical register arrays already use this typedef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254843 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 07:13:35 +00:00
Craig Topper
83f50fab53 Use std::fill instead of memset to initialize an array to avoid hardcoded count and a multiply. The outputed code is identical.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254842 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 07:13:25 +00:00
Simon Pilgrim
fbbab8b959 [X86][FMA4] Explicitly set the domain of FMA4 float/double scalar instructions
Both were defaulting to the float domain - now matches the packed instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254841 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 07:07:42 +00:00
Xinliang David Li
a8bc4db3b2 [PGO] Add version to getPGOFuncName method
Different version of indexed format may use different
name uniquing schemes for static functions. Pass the
version info to the name interface so that different
schmes can be picked (for profile lookup).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254838 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 05:16:36 +00:00
Cong Hou
c7d0ead45b Normalize successors' probabilities when building MBBs for jump table.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254837 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 05:00:55 +00:00
David Blaikie
2b76269756 [llvm-dwp] Add coverage for both the presence and absence of type units, and fix/remove the emission of a broken tu_index when no type units are present
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254833 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 03:41:53 +00:00
David Blaikie
28683ac9d5 [llvm-dwp] Fix the type_units.test since I renamed its inputs as well
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254830 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 03:11:17 +00:00
David Blaikie
eaf992ce08 [llvm-dwp] Rename the sufficiently-modified test to reflect it's non-simplicity
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254829 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 03:10:05 +00:00
David Blaikie
32ad075fd5 [llvm-dwp] clang-format this to catch anything I've missed along the way
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254828 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 03:06:30 +00:00
David Blaikie
543e02b438 [llvm-dwp] Support debug_tu_index
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254827 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 03:05:45 +00:00
Dan Gohman
8893466777 [WebAssembly] Implement ReverseBranchCondition, and re-enable MachineBlockPlacement
This patch introduces a codegen-only instruction currently named br_unless,
which makes it convenient to implement ReverseBranchCondition and re-enable
the MachineBlockPlacement pass. Then in a late pass, it lowers br_unless
back into br_if.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254826 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 03:03:35 +00:00
Kostya Serebryany
35be75843e [libFuzzer] one more trophie
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254825 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 02:23:49 +00:00
Kostya Serebryany
d33fc70ecf [libFuzzer] don't reload the corpus more than once every second
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254824 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 02:09:22 +00:00
Lang Hames
830355b852 Whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254821 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 01:44:20 +00:00
Keno Fischer
3687382a34 [opt] Fix run-twice option for non-idempotent passes
Cloning the module was supposed to guard against the possibility
that the passes may be non-idempotent. However, for some reason
I decided to put that AFTER the passes had already run on the
module, defeating the point entirely. Fix that by moving up the
CloneModule as is done in llc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254819 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 01:38:12 +00:00
Keno Fischer
517455ae01 [MC] Add a test for state reset in MCMachOStreamer
This was fixed in r254751, but untestable until r254774, which
added the necessary command line flag to llc. Add a test now
to make sure this doesn't regress again.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254814 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 01:02:53 +00:00
Cong Hou
c5cf58b8a7 Fix a typo in LoopVectorize.cpp. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254813 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 01:00:22 +00:00
Dan Gohman
ca526959c1 [WebAssembly] Fix scheduling dependencies in register-stackified code
Add physical register defs to instructions used from stackified
instructions to prevent them from being scheduled into the middle of
a stack sequence. This is a conservative measure which may be loosened
in the future.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254811 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 00:51:40 +00:00
Justin Bogner
83eafdfffc CodeGen: Let the BumpPtrAllocator free the elements of indexList
The indexList's nodes are all allocated on a BumpPtrAllocator, so it's
more efficient to let them be freed when it goes away, rather than
deleting them directly. This is a follow up to r254794.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254808 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 00:39:14 +00:00
Derek Schuff
a9143d4647 [WebAssembly] Support constant offsets on loads and stores
This is just prototype for load/store for i32 types. I'll add them to
the rest of the types if we like this direction.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254807 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 00:26:39 +00:00
Philip Reames
3817e67f7f [EarlyCSE] IsSimple vs IsVolatile naming clarification (NFC)
When the notion of target specific memory intrinsics was introduced to EarlyCSE, the commit confused the notions of volatile and simple memory access.  Since I'm about to start working on this area, cleanup the naming so that patches aren't horribly confusing.  Note that the actual implementation was always bailing if the load or store wasn't simple.  

Reminder:
- "volatile" - C++ volatile, can't remove any memory operations, but in principal unordered
- "ordered" - imposes ordering constraints on other nearby memory operations
- "atomic" - can't be split or sheared.  In LLVM terms, all "ordered" operations are also atomic so the predicate "isAtomic" is often used.
- "simple" - a load which is none of the above.  These are normal loads and what most of the optimizer works with.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254805 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 00:18:33 +00:00
Keno Fischer
357108cbea [opt] Fix sanitizer complaints about r254774
`Out` can be null if no output is requested, so move any access
to it inside the conditional. Thanks to Justin Bogner for finding
this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254804 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 00:06:37 +00:00
Philip Reames
f79b7835d8 [PassManager] Ensure destructors of cached AnalysisUsage objects are run
In 254760, I introduced the usage of a BumpPtrAllocator for the AnalysisUsage instances held by the PassManger.  This turns out to have been incorrect since a BumpPtrAllocator does not run the destructors of objects when deallocating memory.  Since a few of our SmallVector's had grown beyond their small size, we end up with some leaked memory.  We need to use a SpecificBumpPtrAllocator instead.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254803 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 23:48:19 +00:00
Teresa Johnson
5143703795 [ThinLTO] Helper for performing renaming/promotion on a module
Creates a module and performs necessary renaming/promotion of locals
that may be exported to another module.

Split out of D15024.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254802 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 23:40:22 +00:00
Hans Wennborg
2174f151dc Add FeatureLAHFSAHF to amdfam10 as well.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254801 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 23:32:19 +00:00
Dan Gohman
16d4cc83c3 [WebAssembly] Initial varargs support.
Full varargs support will depend on prologue/epilogue support, but this patch
gets us started with most of the basic infrastructure.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254799 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 23:22:35 +00:00
Philip Reames
9ac3ec43b3 Address a memory leak in 254760
The issue appears to have been that the copy constructor of the SmallVector was being invoked and this was somehow leading to leaked memory.  This patch avoids the symptom, but likely doesn't address the underlying problem.  I'm still investigating the root cause, but wanted to avoid the memory leak in the mean time.  Even with the underlying fix, avoiding the redundant allocation is worthwhile.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254795 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 23:06:33 +00:00
Justin Bogner
a026cdc11a CodeGen: Move the SlotIndexes BumpPtrAllocator before the list it allocates
When a `SlotIndexes` is destroyed, `ileAllocator` will currently be
destructed before `IndexList`, but all of `IndexList`'s storage has
been allocated by `ileAllocator`. This means we'll call destructors on
garbage data, which is very bad. This can be avoided by putting the
BumpPtrAllocator earlier in the class than anything it allocates.

Unfortunately, I don't know how to test this. It depends very much on
memory layout, and the only evidence I have that this is actually
happening in practice are backtraces that might be explained by this.
By inspection though, the code is obviously dangerous/wrong, and this
is the right thing to do.

I'll follow up later with a patch that calls clearAndLeakNodesUnsafely
on the list, since there isn't much point in destructing them when
they're allocated in a BPA anyway, but I figured it makes sense to
commit the correctness fix separately from that optimization.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254794 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 23:00:54 +00:00
Hans Wennborg
35cba4cf6a X86: Don't emit SAHF/LAHF for 64-bit targets unless explicitly supported
These instructions are not supported by all CPUs in 64-bit mode. Emitting them
causes Chromium to crash on start-up for users with such chips.

(GCC puts these instructions behind -msahf on 64-bit for the same reason.)

This patch adds FeatureLAHFSAHF, enables it by default for 32-bit targets
and modern CPUs, and changes X86InstrInfo::copyPhysReg back to the lowering
from before r244503 when the instructions are not available.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254793 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 23:00:33 +00:00
Derek Schuff
a7a95fed0f Add TransformUtils to list of required libraries for llc
This dependency was added in r254774

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254786 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 22:47:58 +00:00
Kostya Serebryany
3f8065b694 [libFuzzer] compute base64 in-process instead of using an external lib. Since libFuzzer should not depend on anything, just re-implement base64 encoder. PR25746
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254784 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 22:29:39 +00:00
Rafael Espindola
f8e0f06f7c MSVC complains about this being ambiguous.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254782 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 22:26:21 +00:00
Lang Hames
c5aab87e68 [Orc] Move some code up into the JITCompileCallbackManager base class. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254778 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 22:09:19 +00:00
Rafael Espindola
c55f4fb805 Always pass a diagnostic handler to the linker.
Before this patch the diagnostic handler was optional. If it was not
passed, the one in the LLVMContext was used.

That is probably not a pattern we want to follow. If each area has an
optional callback, there is a sea of callbacks and it is hard to follow
which one is called.

Doing this also found cases where the callback is a nice addition, like
testing that no errors or warnings are reported.

The other option is to always use the diagnostic handler in the
LLVMContext. That has a few problems

* To implement the C API we would have to set the diag handler and then
  set it back to the original value.
* Code that creates the context might be far away from code that wants
  the diagnostics.

I do have a patch that implements the second option and will send that as
an RFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254777 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 22:08:53 +00:00
Weiming Zhao
cc87069c31 [SimplifyLibCalls] Optimization for pow(x, n) where n is some constant
Summary:
    In order to avoid calling pow function we generate repeated fmul when n is a
    positive or negative whole number.
    
    For each exponent we pre-compute Addition Chains in order to minimize the no.
    of fmuls.
    Refer: http://wwwhomes.uni-bielefeld.de/achim/addition_chain.html
    
    We pre-compute addition chains for exponents upto 32 (which results in a max of
    7 fmuls).

    For eg:
    4 = 2+2
    5 = 2+3
    6 = 3+3 and so on
    
    Hence,
    pow(x, 4.0) ==> y = fmul x, x
                    x = fmul y, y
                    ret x

    For negative exponents, we simply compute the reciprocal of the final result.
    
    Note: This transformation is only enabled under fast-math.
    
    Patch by Mandeep Singh Grang <mgrang@codeaurora.org>

Reviewers: weimingz, majnemer, escha, davide, scanon, joerg

Subscribers: probinson, escha, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254776 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 22:00:47 +00:00