Commit Graph

117621 Commits

Author SHA1 Message Date
Kostya Serebryany
762dbd0574 [lib/Fuzzer] doxygen-ify the comments for the user interface
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238086 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-23 02:12:05 +00:00
Duncan P. N. Exon Smith
b5f8c9b2ec AsmPrinter: Remove the vtable-entry from DIEValue
Remove all virtual functions from `DIEValue`, dropping the vtable
pointer from its layout.  Instead, create "impl" functions on the
subclasses, and use the `DIEValue::Type` to implement the dynamic
dispatch.

This is necessary -- obviously not sufficient -- for passing `DIEValue`s
around by value.  However, this change stands on its own: we make tons
of these.  I measured a drop in memory usage from 888 MB down to 860 MB,
or around 3.2%.

(I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`;
see r236629 for details.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238084 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-23 01:45:07 +00:00
Duncan P. N. Exon Smith
804c199b75 CodeGen: Remove redundant DIETypeSignature::dump(), NFC
We already have this in `DIEValue`; no reason to shadow it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238082 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-23 01:26:26 +00:00
Kostya Serebryany
d434a0a1b2 [lib/Fuzzer] fully get rid of std::cerr in libFuzzer
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238081 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-23 01:22:35 +00:00
Akira Hatanaka
01461204b3 Stop resetting NoFramePointerElim in TargetMachine::resetTargetOptions.
This is part of the work to remove TargetMachine::resetTargetOptions.

In this patch, instead of updating global variable NoFramePointerElim in
resetTargetOptions, its use in DisableFramePointerElim is replaced with a call
to TargetFrameLowering::noFramePointerElim. This function determines on a
per-function basis if frame pointer elimination should be disabled.

There is no change in functionality except that cl:opt option "disable-fp-elim"
can now override function attribute "no-frame-pointer-elim". 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238080 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-23 01:14:08 +00:00
Akira Hatanaka
c17da7166d Simplify and rename function overrideFunctionAttributes. NFC.
This is in preparation to making changes needed to stop resetting
NoFramePointerElim in resetTargetOptions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238079 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-23 01:12:26 +00:00
Kostya Serebryany
4ea4cb3197 [lib/Fuzzer] start getting rid of std::cerr. Sadly, these parts of C++ library used in libFuzzer badly interract with the same code used in the target function and also with dfsan. It's easier to just not use std::cerr than to defeat these issues.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238078 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-23 01:07:46 +00:00
Akira Hatanaka
9484f5764c Remove unnecessary command line option "-disable-fp-elim".
This option currently has no effect as function attribute
"no-frame-pointer-elim=false" overrides it.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238077 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-23 00:31:56 +00:00
Rafael Espindola
58bf2827d3 Revert "make reciprocal estimate code generation more flexible by adding command-line options"
This reverts commit r238051.

It broke some bots:

http://lab.llvm.org:8011/builders/llvm-ppc64-linux1/builds/18190

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238075 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-23 00:22:44 +00:00
Philip Reames
4e5aa77b3d Correct a mistaken comment from 238071 [NFC]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238074 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-23 00:05:43 +00:00
Rafael Espindola
7c4f3dcc5e Produce a single string table in a ELF .o
Normally an ELF .o has two string tables, one for symbols, one for section
names.

With the scheme of naming sections like ".text.foo" where foo is a symbol,
there is a big potential saving in using a single one.

Building llvm+clang+lld with master and with this patch the results were:

master:                          193,267,008 bytes
patch:                           186,107,952 bytes
master non unique section names: 183,260,192 bytes
patch non unique section names:  183,118,632 bytes

So using non usique saves 10,006,816 bytes, and the patch saves 7,159,056 while
still using distinct names for the sections.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238073 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 23:58:30 +00:00
Philip Reames
e00c0df2c4 Extend EarlyCSE to handle basic cases from JumpThreading and CVP
This patch extends EarlyCSE to take advantage of the information that a controlling branch gives us about the value of a Value within this and dominated basic blocks. If the current block has a single predecessor with a controlling branch, we can infer what the branch condition must have been to execute this block. The actual change to support this is downright simple because EarlyCSE's existing scoped hash table logic deals with most of the complexity around merging.

The patch actually implements two optimizations.
1) The first is analogous to JumpThreading in that it enables EarlyCSE's CSE handling to fold branches which are exactly redundant due to a previous branch to branches on constants. (It doesn't actually replace the branch or change the CFG.) This is pretty clearly a win since it enables substantial CFG simplification before we start trying to inline.
2) The second is analogous to CVP in that it exploits the knowledge gained to replace dominated *uses* of the original value. EarlyCSE does not otherwise reason about specific uses, so this is the more arguable one. It does enable further simplication and constant folding within the rest of the visit by EarlyCSE.

In both cases, the added code only handles the easy dominance based case of each optimization. The general case is deferred to the existing passes.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238071 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 23:53:24 +00:00
David Majnemer
12baade498 [InstCombine] Don't eagerly propagate nsw for A*B+A*C => A*(B+C)
InstCombine transforms A *nsw B +nsw A *nsw C to A *nsw (B + C).
This is incorrect -- e.g. if A = -1, B = 1, C = INT_SMAX. Then
nothing in the LHS overflows, but the multiplication in RHS overflows.

We need to first make sure that we won't multiple by INT_SMAX + 1.

Test case `add_of_mul` contributed by Sanjoy Das.

This fixes PR23635.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238066 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 23:02:11 +00:00
Kostya Serebryany
464deacf05 [lib/Fuzzer] remove -use_coverage_pairs=1, an experimental feature that is unlikely to ever scale
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238063 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 22:47:03 +00:00
Kostya Serebryany
b3fdcb3739 [lib/Fuzzer] mention the user-supplied mutators
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238062 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 22:43:05 +00:00
Kostya Serebryany
ebada2c2bc [lib/Fuzzer] extend the fuzzer interface to allow user-supplied mutators
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238059 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 22:35:31 +00:00
Ahmed Bougacha
d8319655f2 [AArch64][CGP] Sink zext feeding stxr/stlxr into the same block.
The usual CodeGenPrepare trickery, on a target-specific intrinsic.
Without this, the expansion of atomics will usually have the zext
be hoisted out of the loop, defeating the various patterns we have
to catch this precise case.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238054 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 21:37:17 +00:00
Rafael Espindola
6af60ebd57 Relax these tests a bit.
It is not relevant where in the string table the name is located.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238053 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 21:37:13 +00:00
Ahmed Bougacha
bde8616229 [AArch64] Robustize atomic cmpxchg test a little more. NFC.
We changed the test to test non-constant values in r238049.
We can also use CHECK-NEXT to be a little stricter.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238052 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 21:35:14 +00:00
Sanjay Patel
7e80a67d35 make reciprocal estimate code generation more flexible by adding command-line options
This patch adds a class for processing many recip codegen possibilities.
The TargetRecip class is intended to handle both command-line options to llc as well
as options passed in from a front-end such as clang with the -mrecip option.

The x86 backend is updated to use the new functionality.
Only -mcpu=btver2 with -ffast-math should see a functional change from this patch.
All other CPUs continue to *not* use reciprocal estimates by default with -ffast-math.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238051 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 21:10:06 +00:00
Ahmed Bougacha
d3244b7749 [AArch64] Robustize atomic cmpxchg test. NFC.
Constants are easy to get right the wrong way.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238049 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 21:08:15 +00:00
Renato Golin
0ceb20d6f4 Reinforce ARMTargetParser::getCanonicalArchName validation
Before, getCanonicalArchName was relying on parseArch() to validate the arch
name, which was a problem when other methods, that also needed to call it,
were duplicating the steps.

But to dissociate getCanonicalArchName from parseArch, we needed to make
getCanonicalArchName more robust in detecting valid arch names. It's still
not perfect, but will do for the time being, until we merge Triple with
TargetParser into a TargetDescription mega class.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238047 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 20:43:30 +00:00
Chad Rosier
157fbac534 Use new MachineInstr mayLoadOrStore() API. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238044 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 20:07:34 +00:00
Alexei Starovoitov
1fd101c86d [bpf] emit jmp fixups in little endian
The 'off' field of 'struct bpf_insn' is in cpu-endianness,
since the rest is emitted as little endian, make sure
that 'off' field is little endian as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238038 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 18:47:33 +00:00
Renato Golin
84b1a805bb Adding profile and version parsers to ARMTargetParser
This allows us to match armv6m to default to thumb, but will also be used by
Clang's driver and remove the current incomplete copy in it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238036 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 18:17:55 +00:00
Quentin Colombet
57cc146595 Reapply r238011 with a fix for the trap instruction.
The problem was that I slipped a change required for shrink-wrapping, namely I
used getFirstTerminator instead of the getLastNonDebugInstr that was here before
the refactoring, whereas the surrounding code is not yet patched for that.

Original message:
[X86] Refactor the prologue emission to prepare for shrink-wrapping.

- Add a late pass to expand pseudo instructions (tail call and EH returns).
 Instead of doing it in the prologue emission.
- Factor some static methods in X86FrameLowering to ease code sharing.

NFC.

Related to <rdar://problem/20821487>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238035 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 18:10:47 +00:00
Chandler Carruth
15fe7cf70f [Unroll] Separate the logic for testing each iteration of the loop,
accumulating estimated cost, and other loop-centric logic from the logic
used to analyze instructions in a particular iteration.

This makes the visitor very narrow in scope -- all it does is visit
instructions, update a map of simplified values, and return whether it
is able to optimize away a particular instruction.

The two cost metrics are now returned as an optional struct. When the
optional is left unengaged, there is no information about the unrolled
cost of the loop, when it is engaged the cost metrics are available to
run against the thresholds.

No functionality changed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238033 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 17:41:35 +00:00
Bill Schmidt
490d207be4 [PPC64] Add support for clrbhrb, mfbhrbe, rfebb.
This patch adds support for the ISA 2.07 additions involving the
branch history rolling buffer and event-based branching.  These will
not be used by typical applications, so built-in support is not
required.  They will only be available via inline assembly.

Assembly/disassembly tests are included in the patch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238032 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 16:44:10 +00:00
Rafael Espindola
7b677dd986 Stop inventing symbol sizes.
MachO and COFF quite reasonably only define the size for common symbols.

We used to try to figure out the "size" by computing the gap from one symbol to
the next.

This would not be correct in general, since a part of a section can belong to no
visible symbol (padding, private globals).

It was also really expensive, since we would walk every symbol to find the size
of one.

If a caller really wants this, it can sort all the symbols once and get all the
gaps ("size") in O(n log n) instead of O(n^2).

On MachO this also has the advantage of centralizing all the checks for an
invalid n_sect.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238028 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 15:43:00 +00:00
Sanjay Patel
08bac7b901 remove names from comments, fix typos; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238027 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 15:38:24 +00:00
Sanjay Patel
3e785f0ec1 fix typo, 80-col; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238026 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 15:32:33 +00:00
Sanjay Patel
27b0e0b7de fix typo in comment; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238025 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 15:31:47 +00:00
Rafael Espindola
cc3f1db34c Detect invalid section indexes when we first read them.
We still detect the same errors, but now we do it earlier.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238024 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 14:59:27 +00:00
John Brawn
8a95a5095d [ARM] Fix typo in subtarget feature list for 7em triple
The list of subtarget features for the 7em triple contains 't2xtpk',
which actually disables that subtarget feature. Correct that to
'+t2xtpk' and test that the instructions enabled by that feature do
actually work.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238022 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 14:16:22 +00:00
Rafael Espindola
05f7d4f508 Fix llvm-nm -S option.
It is explicitly documented to have no effect on object formats where symbols
don't have sizes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238019 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 13:28:35 +00:00
Rafael Espindola
c6174adb16 Make this test stricter. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238018 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 13:17:31 +00:00
NAKAMURA Takumi
25103832b2 Reapply part of r237975, "Fix Clang -Wmissing-override warning", except for DIContext.h, to apease g++-4.7.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238012 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 10:11:07 +00:00
Tamas Berghammer
c189633586 Revert "[X86] Fix a variable name for r237977 so that it works with every compilers."
Revert "[X86] Refactor the prologue emission to prepare for shrink-wrapping."

This reverts commit 6b3b93fc8b.
This reverts commit ab0b15dff8.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238011 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 10:01:56 +00:00
Puyan Lotfi
d9a08b08ac Compile time improvements to VirtRegRewriter.
This change to VirtRegRewriter::addMBBLiveIns adds live-in registers for each
MachineBasicBlock's LiveIns set without isLiveIn checks as they are being added
because doing so is expensive. After all live-in registers are added, the LiveIn
vectors are sorted and uniqued.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238008 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 08:11:26 +00:00
NAKAMURA Takumi
b6b98c12d5 Revert r237954, "Resubmit r237708 (MIR Serialization: print and parse LLVM IR using MIR format)."
It brought cyclic dependencies between LLVMCodeGen and LLVMMIR.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238007 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 07:17:07 +00:00
Duncan P. N. Exon Smith
f5e0674d06 MC: Shave a pointer off of MCSymbol::Name
Shave a pointer off of `MCSymbolName` by storing `StringMapEntry<bool>*`
instead of `StringRef`.  This brings `sizeof(MCSymbol)` down to 64 on
64-bit platforms, a nice round number.  My profile showed memory
dropping from 914 MB down to 908 MB, roughly 0.7%.  Other than memory
usage, no functionality change here.

(I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`;
see r236629 for details.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238005 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 06:04:42 +00:00
Tobias Grosser
b7888bd5ea Revert "Fix Clang -Wmissing-override warning"
This reverts commit r237975. This seems also to break with gcc 4.7

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238004 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 06:01:04 +00:00
Duncan P. N. Exon Smith
005bf5f8b0 MC: Pack MCSymbol::Index in with the bitfield in MCSymbol
Save a pointer for each `MCSymbol`, bringing `llc` memory usage down
from 920 MB to 914 MB, around ~0.6%.

(I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`;
see r236629 for details.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238003 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 05:59:05 +00:00
Duncan P. N. Exon Smith
6c3a7cbe54 MC: Lift MCSymbolData::Index up to MCSymbol::Index, NFC
Lift `MCSymbolData::Index` up a level to `MCSymbol`, as preparation for
packing it into the bitfield in `MCSymbol`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238001 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 05:54:01 +00:00
NAKAMURA Takumi
117f3a66e8 Revert part of r237975, "Fix Clang -Wmissing-override warning" in DIContext.h, to appease g++-4.7.
llvm/include/llvm/DebugInfo/DIContext.h:144:11: error:   overriding ‘virtual llvm::LoadedObjectInfo::~LoadedObjectInfo() noexcept (true)’

It seems the destructor in the base class may not be "default".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238000 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 05:52:50 +00:00
Duncan P. N. Exon Smith
ec8c491a06 SDAG: Give SDDbgValues their own allocator (and reset it)
Previously `SDDbgValue`s used the general allocator that lives for all
of `SelectionDAG`.  Instead, give them their own allocator, and reset it
whenever `SDDbgInfo::clear()` is called, plugging a spiritual leak.

This drops `SelectionDAGBuilder::visitIntrinsicCall()` off of my heap
profile (was at around 2% of `llc` for codegen of `-flto -g`).  Thanks
to Pete Cooper for spotting the problem and suggesting the fix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237998 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 05:45:19 +00:00
Duncan P. N. Exon Smith
73993abb6c SDAG: Cleanup initialization of SDDbgValue, NFC
Cleanup how `SDDbgValue` is initialized, and rearrange the fields to
save two pointers in the struct layout.  No real functionality change
though (and I doubt the memory savings would show up in a profile).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237997 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 05:35:53 +00:00
Tobias Grosser
82967c0bcd Revert "unique_ptrify LoadedObjectInfo::clone"
This reverts commit r237976, which seems to break existing gcc 4.7 buildbots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237996 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 05:33:54 +00:00
David Majnemer
fe0d65bcc6 [InstSimplify] Handle some overflow intrinsics in InstSimplify
This change does a few things:
- Move some InstCombine transforms to InstSimplify
- Run SimplifyCall from within InstCombine::visitCallInst
- Teach InstSimplify to fold [us]mul_with_overflow(X, undef) to 0.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237995 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 03:56:46 +00:00
Chandler Carruth
edcdc5cb6a [Unroll] Replace a hand-wavy FIXME with a FIXME that explains the actual
problem instead of suggesting doing something that is trivial to do but
incorrect given the current design of the libraries.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237994 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 03:07:28 +00:00