summaryrefslogtreecommitdiffstats
path: root/llvm/lib
Commit message (Collapse)AuthorAgeFilesLines
* Update function name and add some helpful comments.Eric Christopher2014-01-111-3/+4
| | | | llvm-svn: 198979
* Extend and simplify the sample profile input file.Diego Novillo2014-01-101-106/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 198973
* Propagation of profile samples through the CFG.Diego Novillo2014-01-101-67/+605
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 198972
* Use the simpler version of sys::fs::remove when possible.Rafael Espindola2014-01-104-18/+10
| | | | llvm-svn: 198958
* Remove remove_all. A compiler has no need for recursively deleting a directory.Rafael Espindola2014-01-101-39/+0
| | | | llvm-svn: 198955
* LTO: whitespace changesDuncan P. N. Exon Smith2014-01-101-4/+3
| | | | llvm-svn: 198954
* LoopVectorizer: Handle strided memory accesses by versioningArnold Schwaighofer2014-01-101-83/+408
| | | | | | | | | | | | | | | 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 llvm-svn: 198950
* Must not produce Tag_CPU_arch_profile for pre-ARMv7 cores (e.g. cortex-m0)Artyom Skrobov2014-01-102-10/+13
| | | | llvm-svn: 198945
* ARM: fix regression caused by r198914Saleem Abdulrasool2014-01-101-8/+17
| | | | | | | | 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. llvm-svn: 198944
* Silence unused variable warning for non-asserting builds that was introduced ↵Kristof Beyls2014-01-101-2/+2
| | | | | | in r198937. llvm-svn: 198941
* Use 'w' instead of 'c' to represent the win32 mangling.Rafael Espindola2014-01-101-5/+5
| | | | | | | This change was requested to avoid confusion if we ever support non windows coff systems. llvm-svn: 198938
* Make sure -use-init-array has intended effect on all AArch64 ELF targets, ↵Kristof Beyls2014-01-103-11/+7
| | | | | | not just linux. llvm-svn: 198937
* ARM IAS: support #:{lower,upper}16: for GNU compatibilitySaleem Abdulrasool2014-01-101-0/+4
| | | | | | | | 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. llvm-svn: 198916
* ARM IAS: support GNU extension for ldrd, strdSaleem Abdulrasool2014-01-102-1/+34
| | | | | | | | | 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. llvm-svn: 198915
* ARM IAS: support implicit immediate 0s for {LD,ST}R{B,}TSaleem Abdulrasool2014-01-101-27/+45
| | | | | | | | | | | | | | | | 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! llvm-svn: 198914
* [Sparc] Emit retl/ret instead of jmp instruction. It improves the ↵Venkatraman Govindaraju2014-01-101-0/+6
| | | | | | readability of the assembly generated. llvm-svn: 198910
* [Sparc] Add support for parsing jmpl instruction and make indirect call and ↵Venkatraman Govindaraju2014-01-106-22/+70
| | | | | | jmp instructions as aliases to jmpl. llvm-svn: 198909
* Revert "Revert r198851, "Prototype of skeleton type units for fission""David Blaikie2014-01-104-6/+30
| | | | | | | | | This reverts commit r198865 which reverts r198851. ASan identified a use-of-uninitialized of the DwarfTypeUnit::Ty variable in skeleton type units. llvm-svn: 198908
* Fix a bug with the ARM thumb2 CBNZ and CBNZ instructions thatKevin Enderby2014-01-101-1/+20
| | | | | | | | | branch to the next instruction. This can not be encoded but can be turned into a NOP. rdar://15062072 llvm-svn: 198904
* [Sparc] Multiclass for loads/stores. No functionality change intended.Venkatraman Govindaraju2014-01-092-140/+46
| | | | llvm-svn: 198893
* Clean up an inconsistency in v7s feature default.Evan Cheng2014-01-091-2/+2
| | | | llvm-svn: 198889
* Re-remove dead code.Nadav Rotem2014-01-091-45/+0
| | | | | | This reverts r198854. llvm-svn: 198879
* Revert r198851, "Prototype of skeleton type units for fission"NAKAMURA Takumi2014-01-094-29/+6
| | | | | | It caused undefined behavior. DwarfTypeUnit::Ty might not be initialized properly, I guess. llvm-svn: 198865
* Fixed old typo in ScalarEvolution, that caused wrong SCEVs zext operation.Stepan Dyatkovskiy2014-01-091-1/+1
| | | | | | | | | Detailed description is here: http://llvm.org/bugs/show_bug.cgi?id=18000#c16 For participation in bugfix process special thanks to David Wiberg. llvm-svn: 198863
* [SystemZ] Fix RNSBG bug introduced by r197802Richard Sandiford2014-01-091-8/+10
| | | | | | | | The zext handling added in r197802 wasn't right for RNSBG. This patch restricts it to ROSBG, RXSBG and RISBG. (The tests for RISBG were added in r197802 since RISBG was the motivating example.) llvm-svn: 198862
* Handle masked rotate amountsRichard Sandiford2014-01-091-16/+72
| | | | | | | | | | | | | | At the moment we expect rotates to have the form: (or (shl X, Y), (shr X, Z)) where Y == bitsize(X) - Z or Z == bitsize(X) - Y. This form means that the (or ...) is undefined for Y == 0 or Z == 0. This undefinedness can be avoided by using Y == (C * bitsize(X) - Z) & (bitsize(X) - 1) or Z == (C * bitsize(X) - Y) & (bitsize(X) - 1) for any integer C (including 0, the most natural choice). llvm-svn: 198861
* Match the InstCombine form of rotates by X+CRichard Sandiford2014-01-091-12/+39
| | | | | | | | | | | | | | | | | InstCombine converts (sub 32, (add X, C)) into (sub 32-C, X), so a rotate left of a 32-bit Y by X+C could appear as either: (or (shl Y, (add X, C)), (shr Y, (sub 32, (add X, C)))) without InstCombine or: (or (shl Y, (add X, C)), (shr Y, (sub 32-C, X))) with it. We already matched the first form. This patch handles the second too. llvm-svn: 198860
* Revert r198819 - "Remove dead code."Nadav Rotem2014-01-091-0/+45
| | | | llvm-svn: 198854
* Prototype of skeleton type units for fissionDavid Blaikie2014-01-094-6/+29
| | | | llvm-svn: 198851
* llvm-dwarfdump: type unit dwo supportDavid Blaikie2014-01-092-3/+60
| | | | llvm-svn: 198850
* DwarfDebug: Refactor out common skeleton construction code to be reused for ↵David Blaikie2014-01-092-17/+25
| | | | | | type unit skeletons. llvm-svn: 198846
* Reformatting for r198842David Blaikie2014-01-091-3/+2
| | | | llvm-svn: 198843
* DwarfUnit: Rename "Node" to "CUNode" and propagate it through DwarfTypeUnit ↵David Blaikie2014-01-094-22/+18
| | | | | | | | | | as well. Since we'll now also need the split dwarf file name along with the language in DwarfTypeUnits, just use the whole DICompileUnit rather than explicitly handling each field needed. llvm-svn: 198842
* Revert "DwarfUnit: Move the DICompileUnit Node to the DwarfCompileUnit only"David Blaikie2014-01-092-12/+12
| | | | | | | | This reverts commit r198830. Decided to go a different way with this... llvm-svn: 198841
* [PM] Rename this source file to something a bit more generic beforeChandler Carruth2014-01-092-2/+2
| | | | | | I add support for the new pass manager to it. llvm-svn: 198838
* Put the functionality for printing a value to a raw_ostream as anChandler Carruth2014-01-0937-134/+89
| | | | | | | | | | | | operand into the Value interface just like the core print method is. That gives a more conistent organization to the IR printing interfaces -- they are all attached to the IR objects themselves. Also, update all the users. This removes the 'Writer.h' header which contained only a single function declaration. llvm-svn: 198836
* DwarfUnit: Move the DICompileUnit Node to the DwarfCompileUnit onlyDavid Blaikie2014-01-092-12/+12
| | | | | | It's unused in DwarfTypeUnit, as is expected. llvm-svn: 198830
* Remove dead code.Rafael Espindola2014-01-091-45/+0
| | | | llvm-svn: 198819
* llvm.experimental.stackmap: fix encoding of large constants.Andrew Trick2014-01-091-1/+4
| | | | | | | | | | In the stackmap format we advertise the constant field as signed. However, we were determining whether to promote to a 64-bit constant pool based on an unsigned comparison. This fix allows -1 to be encoded as a small constant. llvm-svn: 198816
* Simplify/collapse/denest a conditions/blocks.David Blaikie2014-01-091-32/+31
| | | | llvm-svn: 198813
* llvm-dwarfdump: reorder dwo sections to immediately proceed their non-dwo ↵David Blaikie2014-01-081-27/+27
| | | | | | | | | equivalents This makes it easier to write a test that's mostly shared between fission and non-fission (using FileCheck's multiple prefix support). llvm-svn: 198806
* Remove vestigal bits of MC from the mangler. It no longer uses this, andChandler Carruth2014-01-081-1/+0
| | | | | | | having the include could cause weird layering problems between the IR and MC libraries. llvm-svn: 198796
* Conservatively handle multiple MMOs in MIsNeedChainEdgeHal Finkel2014-01-081-4/+4
| | | | | | | | | | | | | | | | | | | | | | MIsNeedChainEdge, which is used by -enable-aa-sched-mi (AA in misched), had an llvm_unreachable when -enable-aa-sched-mi is enabled and we reach an instruction with multiple MMOs. Instead, return a conservative answer. This allows testing -enable-aa-sched-mi on x86. Also, this moves the check above the isUnsafeMemoryObject checks. isUnsafeMemoryObject is currently correct only for instructions with one MMO (as noted in the comment in isUnsafeMemoryObject): // We purposefully do no check for hasOneMemOperand() here // in hope to trigger an assert downstream in order to // finish implementation. The problem with this is that, had the candidate edge passed the "!MIa->mayStore() && !MIb->mayStore()" check, the hoped-for assert would never happen (which could, in theory, lead to incorrect behavior if one of these secondary MMOs was volatile, for example). llvm-svn: 198795
* Move declaration of variables down to first use.Matt Arsenault2014-01-081-6/+4
| | | | llvm-svn: 198794
* [AArch64][NEON] Added UXTL and UXTL2 instruction aliasesAna Pazos2014-01-081-11/+22
| | | | llvm-svn: 198791
* Force emit a relocation for @gnu_indirect_function symbols so that the indirectRoman Divacky2014-01-081-1/+1
| | | | | | resolution works. llvm-svn: 198780
* [x86] Remove OpSize16 flag from MOV32r0David Woodhouse2014-01-081-2/+1
| | | | | | It's not a real instruction any more and doesn't need encoding information. llvm-svn: 198778
* Teach the DAGCombiner how to fold 'vselect' dag nodes accordingAndrea Di Biagio2014-01-081-0/+7
| | | | | | | | to the following two rules: 1) fold (vselect (build_vector AllOnes), A, B) -> A 2) fold (vselect (build_vector AllZeros), A, B) -> B llvm-svn: 198777
* [DAGCombiner] Factor duplicated rotate code into a separate functionRichard Sandiford2014-01-081-66/+70
| | | | | | No functional change intended. llvm-svn: 198768
* [x86] Support R_386_PC8, R_386_PC16 and R_X86_64_PC8David Woodhouse2014-01-081-0/+23
| | | | llvm-svn: 198763
OpenPOWER on IntegriCloud