Commit Graph

99374 Commits

Author SHA1 Message Date
Chandler Carruth
08be87bdfa [PM] Actually nest pass managers correctly when parsing the pass
pipeline string. Add tests that cover this now that we have execution
dumping in the pass managers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199005 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-11 12:06:47 +00:00
Chandler Carruth
b56749c3b7 [PM] Add names to passes under the new pass manager, and a debug output
mode that can be used to debug the execution of everything.

No support for analyses here, that will come later. This already helps
show parts of the opt commandline integration that isn't working. Tests
of that will start using it as the bugs are fixed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199004 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-11 11:52:05 +00:00
Chandler Carruth
d55b5fe992 [PM] Somehow I missed the header guards on this file. Yikes!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199003 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-11 10:59:00 +00:00
NAKAMURA Takumi
55da404566 LoopVectorize.cpp: Appease MSC16.
Excuse me, I hope msc16 builders would be fine till its end day.
Introduce nullptr then. ;)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199001 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-11 09:59:27 +00:00
NAKAMURA Takumi
e62f38b6b7 llvm/test/Transforms/SampleProfile/syntax.ll: Eliminate locale-sensitive message check.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199000 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-11 09:23:52 +00:00
NAKAMURA Takumi
47eafaa2ab llvm/test/CodeGen/X86/anyregcc.ll: Add explicit -mtriple=x86_64-unknown-unknown.
XMM(s) are really spilling for targeting Win64.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198999 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-11 09:23:44 +00:00
Chandler Carruth
4e728be2bf [PM] Add (very skeletal) support to opt for running the new pass
manager. I cannot emphasize enough that this is a WIP. =] I expect it
to change a great deal as things stabilize, but I think its really
important to get *some* functionality here so that the infrastructure
can be tested more traditionally from the commandline.

The current design is looking something like this:

  ./bin/opt -passes='module(pass_a,pass_b,function(pass_c,pass_d))'

So rather than custom-parsed flags, there is a single flag with a string
argument that is parsed into the pass pipeline structure. This makes it
really easy to have nice structural properties that are very explicit.
There is one obvious and important shortcut. You can start off the
pipeline with a pass, and the minimal context of pass managers will be
built around the entire specified pipeline. This makes the common case
for tests super easy:

  ./bin/opt -passes=instcombine,sroa,gvn

But this won't introduce any of the complexity of the fully inferred old
system -- we only ever do this for the *entire* argument, and we only
look at the first pass. If the other passes don't fit in the pass
manager selected it is a hard error.

The other interesting aspect here is that I'm not relying on any
registration facilities. Such facilities may be unavoidable for
supporting plugins, but I have alternative ideas for plugins that I'd
like to try first. My plan is essentially to build everything without
registration until we hit an absolute requirement.

Instead of registration of pass names, there will be a library dedicated
to parsing pass names and the pass pipeline strings described above.
Currently, this is directly embedded into opt for simplicity as it is
very early, but I plan to eventually pull this into a library that opt,
bugpoint, and even Clang can depend on. It should end up as a good home
for things like the existing PassManagerBuilder as well.

There are a bunch of FIXMEs in the code for the parts of this that are
just stubbed out to make the patch more incremental. A quick list of
what's coming up directly after this:
- Support for function passes and building the structured nesting.
- Support for printing the pass structure, and FileCheck tests of all of
  this code.
- The .def-file based pass name parsing.
- IR priting passes and the corresponding tests.

Some obvious things that I'm not going to do right now, but am
definitely planning on as the pass manager work gets a bit further:
- Pull the parsing into library, including the builders.
- Thread the rest of the target stuff into the new pass manager.
- Wire support for the new pass manager up to llc.
- Plugin support.

Some things that I'd like to have, but are significantly lower on my
priority list. I'll get to these eventually, but they may also be places
where others want to contribute:
- Adding nice error reporting for broken pass pipeline descriptions.
- Typo-correction for pass names.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198998 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-11 08:16:35 +00:00
Juergen Ributzka
4ab3e6c164 [anyregcc] Fix callee-save mask for anyregcc
Use separate callee-save masks for XMM and YMM registers for anyregcc on X86 and
select the proper mask depending on the target cpu we compile for.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198985 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-11 01:00:27 +00:00
Eric Christopher
babad8b46e Revert r198979 - accidental commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198981 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-11 00:28:12 +00:00
Eric Christopher
fae2ba0303 Reformat.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198980 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-11 00:23:18 +00:00
Eric Christopher
708166f4d2 Update function name and add some helpful comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198979 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-11 00:23:16 +00:00
Eric Christopher
050d29c5a7 Fix odd whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198978 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-11 00:23:11 +00:00
Diego Novillo
4b2b2da9c7 Extend and simplify the sample profile input file.
1- Use the line_iterator class to read profile files.

2- Allow comments in profile file. Lines starting with '#'
   are completely ignored while reading the profile.

3- Add parsing support for discriminators and indirect call samples.

   Our external profiler can emit more profile information that we are
   currently not handling. This patch does not add new functionality to
   support this information, but it allows profile files to provide it.

   I will add actual support later on (for at least one of these
   features, I need support for DWARF discriminators in Clang).

   A sample line may contain the following additional information:

   Discriminator. This is used if the sampled program was compiled with
   DWARF discriminator support
   (http://wiki.dwarfstd.org/index.php?title=Path_Discriminators). This
   is currently only emitted by GCC and we just ignore it.

   Potential call targets and samples. If present, this line contains a
   call instruction. This models both direct and indirect calls. Each
   called target is listed together with the number of samples. For
   example,

                    130: 7  foo:3  bar:2  baz:7

   The above means that at relative line offset 130 there is a call
   instruction that calls one of foo(), bar() and baz(). With baz()
   being the relatively more frequent call target.

   Differential Revision: http://llvm-reviews.chandlerc.com/D2355

4- Simplify format of profile input file.

   This implements earlier suggestions to simplify the format of the
   sample profile file. The symbol table is not necessary and function
   profiles do not need to know the number of samples in advance.

   Differential Revision: http://llvm-reviews.chandlerc.com/D2419

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198973 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 23:23:51 +00:00
Diego Novillo
0de8cecb84 Propagation of profile samples through the CFG.
This adds a propagation heuristic to convert instruction samples
into branch weights. It implements a similar heuristic to the one
implemented by Dehao Chen on GCC.

The propagation proceeds in 3 phases:

1- Assignment of block weights. All the basic blocks in the function
   are initial assigned the same weight as their most frequently
   executed instruction.

2- Creation of equivalence classes. Since samples may be missing from
   blocks, we can fill in the gaps by setting the weights of all the
   blocks in the same equivalence class to the same weight. To compute
   the concept of equivalence, we use dominance and loop information.
   Two blocks B1 and B2 are in the same equivalence class if B1
   dominates B2, B2 post-dominates B1 and both are in the same loop.

3- Propagation of block weights into edges. This uses a simple
   propagation heuristic. The following rules are applied to every
   block B in the CFG:

   - If B has a single predecessor/successor, then the weight
     of that edge is the weight of the block.

   - If all the edges are known except one, and the weight of the
     block is already known, the weight of the unknown edge will
     be the weight of the block minus the sum of all the known
     edges. If the sum of all the known edges is larger than B's weight,
     we set the unknown edge weight to zero.

   - If there is a self-referential edge, and the weight of the block is
     known, the weight for that edge is set to the weight of the block
     minus the weight of the other incoming edges to that block (if
     known).

Since this propagation is not guaranteed to finalize for every CFG, we
only allow it to proceed for a limited number of iterations (controlled
by -sample-profile-max-propagate-iterations). It currently uses the same
GCC default of 100.

Before propagation starts, the pass builds (for each block) a list of
unique predecessors and successors. This is necessary to handle
identical edges in multiway branches. Since we visit all blocks and all
edges of the CFG, it is cleaner to build these lists once at the start
of the pass.

Finally, the patch fixes the computation of relative line locations.
The profiler emits lines relative to the function header. To discover
it, we traverse the compilation unit looking for the subprogram
corresponding to the function. The line number of that subprogram is the
line where the function begins. That becomes line zero for all the
relative locations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198972 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 23:23:46 +00:00
Tom Roeder
69051578c7 Space formatting fix for r198966.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198971 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 23:17:39 +00:00
Roman Divacky
af43b47c5a Constant propagate MachineInstrClassName.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198969 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 22:59:49 +00:00
Tom Roeder
48324ba825 Fixing build break: should be in the if statement, not outside.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198966 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 22:55:25 +00:00
Tom Roeder
b2c6a6c0bd Restore the library dependency of LLVMgold on LTO; this was removed recently but
is needed for LLVMgold to load in ld.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198965 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 22:48:35 +00:00
Rafael Espindola
28cd4b91a5 Add a note about the old asm printer being removed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198960 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 22:06:26 +00:00
Rafael Espindola
dd86e54b61 All backends use MC now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198959 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 21:49:27 +00:00
Rafael Espindola
2dc1d6666b Use the simpler version of sys::fs::remove when possible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198958 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 21:40:29 +00:00
Rafael Espindola
217c714a67 Remove remove_all. A compiler has no need for recursively deleting a directory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198955 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 20:36:42 +00:00
Duncan P. N. Exon Smith
d91c160b0a LTO: whitespace changes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198954 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 20:24:35 +00:00
Arnold Schwaighofer
ee3f7de62e LoopVectorizer: Handle strided memory accesses by versioning
for (i = 0; i < N; ++i)
   A[i * Stride1] += B[i * Stride2];

We take loops like this and check that the symbolic strides 'Strided1/2' are one
and drop to the scalar loop if they are not.

This is currently disabled by default and hidden behind the flag
'enable-mem-access-versioning'.

radar://13075509

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198950 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 18:20:32 +00:00
Arnold Schwaighofer
db81071b34 SCEVRewriter: Optionally interpret constants in value map as SCEVConstant
An upcoming loop vectorizer commit will want to replace a SCEVUnknown(Value*)
by a SCEVConstant. This commit modifies the SCEVParameterRewriter to support
this. The SCEVParameterRewriter constructor can optionally specify to follow
this behavior.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198949 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 18:20:29 +00:00
Artyom Skrobov
3dbf2472fd Amending test/MC/ARM/thumb2-mclass.s to match its apparent original purpose (to test the ARMv6M/ARMv7M commonality), and creating a new test case for the differences between ARMv6M and ARMv7M
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198946 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 16:49:49 +00:00
Artyom Skrobov
6099123db8 Must not produce Tag_CPU_arch_profile for pre-ARMv7 cores (e.g. cortex-m0)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198945 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 16:42:55 +00:00
Saleem Abdulrasool
793e2aaa73 ARM: fix regression caused by r198914
The disassembler would no longer be able to disambiguage between the two
variants (explicit immediate #0 vs implicit, omitted #0) for the ldrt, strt,
ldrbt, strbt mnemonics as both versions indicated the disassembler routine.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198944 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 16:22:47 +00:00
Kristof Beyls
a9608f7f0e Silence unused variable warning for non-asserting builds that was introduced in r198937.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198941 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 14:20:45 +00:00
Rafael Espindola
a9ad60c412 Use 'w' instead of 'c' to represent the win32 mangling.
This change was requested to avoid confusion if we ever support non windows coff
systems.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198938 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 13:42:12 +00:00
Kristof Beyls
ac843ff018 Make sure -use-init-array has intended effect on all AArch64 ELF targets, not just linux.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198937 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 13:41:49 +00:00
NAKAMURA Takumi
095f4c451c Whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198934 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 11:12:01 +00:00
NAKAMURA Takumi
f1a1e4a723 Sink add_llvm_library(gtest_main) to UnitTestMain/CMakeLists.txt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198933 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 11:02:26 +00:00
NAKAMURA Takumi
53b22f17c4 llvm/test/ExecutionEngine/MCJIT/load-object-a.ll: Remove "REQUIRES:shell". This doesn't depend on shell's behavior.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198931 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 10:38:52 +00:00
NAKAMURA Takumi
4b13e3ca2c llvm/test/ExecutionEngine/MCJIT/lit.local.cfg: Add "AMD64" in the host_arch list.
FIXME: We should not take CMake's ${CMAKE_SYSTEM_PROCESSOR}...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198930 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 10:38:46 +00:00
NAKAMURA Takumi
744f816bc1 lli: Tweak CacheName not to contain DOS driveletter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198929 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 10:38:40 +00:00
NAKAMURA Takumi
32712c7614 lli: LLIObjectCache: Use llvm::sys::path to get dirname.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198928 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 10:38:34 +00:00
NAKAMURA Takumi
9f456a9451 Whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198927 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 10:38:28 +00:00
NAKAMURA Takumi
929ae46f5d llvm/test/ExecutionEngine/MCJIT/load-object-a.ll: Fix not to use %t.cachedir/%p.
%p is like X:\foo\bar.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198926 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 10:38:23 +00:00
Kostya Serebryany
ab39685c77 reapply r198858: Disable LeakSanitizer in TableGen binaries, see PR18325; this time LeakSanitizerIsTurnedOffForTheCurrentProcess is used instead of __lsan_is_turned_off
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198922 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 08:05:42 +00:00
Saleem Abdulrasool
7ff05025b0 ARM IAS: support #:{lower,upper}16: for GNU compatibility
The GNU assembler supports prefixing the expression with a '#' to indiciate that
the value that is being moved is infact a constant.  This improves the
compatibility of the integrated assembler's parser for this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198916 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 04:38:40 +00:00
Saleem Abdulrasool
003132d48c ARM IAS: support GNU extension for ldrd, strd
The GNU assembler has an extension that allows for the elision of the paired
register (dt2) for the LDRD and STRD mnemonics.  Add support for this in the
assembly parser.  Canonicalise the usage during the instruction parsing from
the specified version.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198915 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 04:38:35 +00:00
Saleem Abdulrasool
4eeee88e91 ARM IAS: support implicit immediate 0s for {LD,ST}R{B,}T
The ARM ARM indicates the mnemonics as follows:

  ldrbt{<c>}{<q>} <Rt>, [<Rn>], {, #+/-<imm>}
  ldrt{<c>}{<q>} <Rt>, [<Rn>] {, #+/-<imm>}
  strbt{<c>}{<q>} <Rt>, [<Rn>] {, #<imm>}
  strt{<c>}{<q>} <Rt>, [<Rn>] {, #+/-<imm>}

This improves the parser to deal with the implicit immediate 0 for the mnemonics
as per the specification.

Thanks to Joerg Sonnenberger for the tests!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198914 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 04:38:31 +00:00
Venkatraman Govindaraju
d0a796e5dd [Sparc] Emit retl/ret instead of jmp instruction. It improves the readability of the assembly generated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198910 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 02:55:27 +00:00
Venkatraman Govindaraju
8ce28c812b [Sparc] Add support for parsing jmpl instruction and make indirect call and jmp instructions as aliases to jmpl.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198909 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 01:48:17 +00:00
David Blaikie
0f09c9f5ac Revert "Revert r198851, "Prototype of skeleton type units for fission""
This reverts commit r198865 which reverts r198851.

ASan identified a use-of-uninitialized of the DwarfTypeUnit::Ty variable
in skeleton type units.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198908 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 01:38:41 +00:00
Kevin Enderby
d9615670b7 Fix a bug with the ARM thumb2 CBNZ and CBNZ instructions that
branch to the next instruction.  This can not be encoded but can be
turned into a NOP.

rdar://15062072


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198904 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 00:43:32 +00:00
Chandler Carruth
36c48cad0d Update the developer policy to more clearly spell out the steps for
contributors to submit patches to the LLVM project. Thanks to Danny,
Chris, Alp, and others for reviewing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198901 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 00:08:34 +00:00
Justin Bogner
1c5033a4bb Bitcode: Fix a typo in an assert
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198894 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-09 22:02:05 +00:00
Venkatraman Govindaraju
3102565082 [Sparc] Multiclass for loads/stores. No functionality change intended.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198893 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-09 21:49:18 +00:00