summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
* AsmPrinter: Use DwarfStringPoolEntry in DwarfAccelTable, NFCDuncan P. N. Exon Smith2015-05-243-17/+11
| | | | | | | This is just an API change, but it prepares to stop using `EmitLabelDifference()` when possible. llvm-svn: 238118
* AsmPrinter: Make DIEString smallDuncan P. N. Exon Smith2015-05-242-29/+38
| | | | | | | | | | | | | | | Expose the `DwarfStringPool` entry in a header, and store a pointer to it directly in `DIEString`. Instead of choosing at creation time how to emit it, use the `dwarf::Form` to determine that at emission time. Besides avoiding the other `DIEValue`, this shaves two pointers off of `DIEString`; the data is now a single pointer. This is a nice cleanup on its own -- and drops memory usage from 861 MB down to 853 MB, around 0.9% -- but it's also preparation for passing `DIEValue`s by value. (I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`; see r236629 for details.) llvm-svn: 238117
* AsmPrinter: Extract DwarfStringPoolEntry from DwarfStringPool, NFCDuncan P. N. Exon Smith2015-05-242-14/+14
| | | | | | | | | Extract out `DwarfStringPoolEntry` and `DwarfStringPoolRef` from `DwarfStringPool` so that downstream users can start using `DwarfStringPool::getEntry()` directly. This will allow users to delay the decision between emitting a symbol or an offset until later. llvm-svn: 238116
* AsmPrinter: Emit the DwarfStringPool offset directly when possibleDuncan P. N. Exon Smith2015-05-243-23/+35
| | | | | | | | | | | | | Change `DwarfStringPool` to calculate byte offsets on-the-fly, and update `DwarfUnit::getLocalString()` to use a `DIEInteger` instead of a `DIEDelta` when Dwarf doesn't use relocations (i.e., Mach-O). This eliminates another call to `EmitLabelDifference()`, and drops memory usage from 865 MB down to 861 MB, around 0.5%. (I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`; see r236629 for details.) llvm-svn: 238114
* AsmPrinter: Refactor DwarfStringPool::getEntry(), NFCDuncan P. N. Exon Smith2015-05-242-14/+11
| | | | | | | | Move `DwarfStringPool`'s `getEntry()` to the header (and make it a member function) in preparation for calculating symbol offsets on-the-fly. llvm-svn: 238112
* Add target hook to allow merging stores of nonzero constantsMatt Arsenault2015-05-241-3/+10
| | | | | | | | | | On GPU targets, materializing constants is cheap and stores are expensive, so only doing this for zero vectors was silly. Most of the new testcases aren't optimally merged, and are for later improvements. llvm-svn: 238108
* Silencing a spurious -Wreturn-type warning; NFC.Aaron Ballman2015-05-231-0/+1
| | | | llvm-svn: 238099
* AsmPrinter: Remove the vtable-entry from DIEValueDuncan P. N. Exon Smith2015-05-231-29/+86
| | | | | | | | | | | | | | | | | 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.) llvm-svn: 238084
* CodeGen: Remove redundant DIETypeSignature::dump(), NFCDuncan P. N. Exon Smith2015-05-231-2/+0
| | | | | | We already have this in `DIEValue`; no reason to shadow it. llvm-svn: 238082
* Stop resetting NoFramePointerElim in TargetMachine::resetTargetOptions.Akira Hatanaka2015-05-232-9/+26
| | | | | | | | | | | | | | 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". llvm-svn: 238080
* Simplify and rename function overrideFunctionAttributes. NFC.Akira Hatanaka2015-05-231-0/+20
| | | | | | | This is in preparation to making changes needed to stop resetting NoFramePointerElim in resetTargetOptions. llvm-svn: 238079
* [AArch64][CGP] Sink zext feeding stxr/stlxr into the same block.Ahmed Bougacha2015-05-221-0/+10
| | | | | | | | | | | 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 llvm-svn: 238054
* Compile time improvements to VirtRegRewriter.Puyan Lotfi2015-05-221-4/+7
| | | | | | | | | 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. llvm-svn: 238008
* Revert r237954, "Resubmit r237708 (MIR Serialization: print and parse LLVM ↵NAKAMURA Takumi2015-05-2211-298/+9
| | | | | | | | IR using MIR format)." It brought cyclic dependencies between LLVMCodeGen and LLVMMIR. llvm-svn: 238007
* SDAG: Give SDDbgValues their own allocator (and reset it)Duncan P. N. Exon Smith2015-05-221-3/+4
| | | | | | | | | | | | 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. llvm-svn: 237998
* SDAG: Cleanup initialization of SDDbgValue, NFCDuncan P. N. Exon Smith2015-05-221-9/+7
| | | | | | | | 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). llvm-svn: 237997
* [InlineSpiller] Fix rematerialization for bundles.Quentin Colombet2015-05-211-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to this patch, we could update the operand of another MI in the same bundle. Longer version: Before InlineSpiller rematerializes a vreg, it iterates over operands of each MI in a bundle, collecting all (MI, OpNo) pairs that reference that vreg. Then if it does rematerialize, it goes through the pair list and replaces the operands with the new (rematerialized) vreg. The problem is, it tries to replace all of these operands in the main MI ! This works fine for single MIs. However, if we are processing a bundle of MIs and the list contains multiple pairs - the rematerialization will either crash trying to access a non-existing operand of the main MI, or silently corrupt one of the existing ones. It will also ignore other MIs in the bundle. The obvious fix is to use the MI pointers saved in collected (MI, OpNo) pairs. This must have been the original intent of the pair list but somehow these pointers got lost. Patch by Dmitri Shtilman <dshtilman@icloud.com>! Differential revision: http://reviews.llvm.org/D9904 <rdar://problem/21002163> llvm-svn: 237964
* fix typo in comment; NFCSanjay Patel2015-05-211-1/+1
| | | | llvm-svn: 237962
* Resubmit r237708 (MIR Serialization: print and parse LLVM IR using MIR format).Alex Lorenz2015-05-2111-9/+298
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit is a 2nd attempt at committing the initial MIR serialization patch. The first commit (r237708) made the incremental buildbots unstable and was reverted in r237730. The original commit didn't add a terminating null character to the LLVM IR source which was passed to LLParser, and this sometimes caused the test 'llvmIR.mir' to fail with a parsing error because the LLVM IR source didn't have a null character immediately after the end and thus LLLexer encountered some garbage characters that ultimately caused the error. This commit also includes the other test fixes I committed in r237712 (llc path fix) and r237723 (remove target triple) which also got reverted in r237730. --Original Commit Message-- MIR Serialization: print and parse LLVM IR using MIR format. This commit is the initial commit for the MIR serialization project. It creates a new library under CodeGen called 'MIR'. This new library adds a new machine function pass that prints out the LLVM IR using the MIR format. This pass is then added as a last pass when a 'stop-after' option is used in llc. The new library adds the initial functionality for parsing of MIR files as well. This commit also extends the llc tool so that it can recognize and parse MIR input files. Reviewers: Duncan P. N. Exon Smith, Matthias Braun, Philip Reames Differential Revision: http://reviews.llvm.org/D9616 llvm-svn: 237954
* Move alignment from MCSectionData to MCSection.Rafael Espindola2015-05-2114-88/+76
| | | | | | | | | | | | | | | | | | | | | | | | This starts merging MCSection and MCSectionData. There are a few issues with the current split between MCSection and MCSectionData. * It optimizes the the not as important case. We want the production of .o files to be really fast, but the split puts the information used for .o emission in a separate data structure. * The ELF/COFF/MachO hierarchy is not represented in MCSectionData, leading to some ad-hoc ways to represent the various flags. * It makes it harder to remember where each item is. The attached patch starts merging the two by moving the alignment from MCSectionData to MCSection. Most of the patch is actually just dropping 'const', since MCSectionData is mutable, but MCSection was not. llvm-svn: 237936
* use range-based for-loops; NFCISanjay Patel2015-05-211-4/+2
| | | | llvm-svn: 237918
* use range-based for-loops; NFCISanjay Patel2015-05-211-6/+2
| | | | llvm-svn: 237917
* use range-based for-loopSanjay Patel2015-05-211-3/+2
| | | | llvm-svn: 237914
* use range-based for-loop; NFCISanjay Patel2015-05-211-4/+1
| | | | llvm-svn: 237908
* std::sort must be called with a strict weak ordering.Manuel Klimek2015-05-211-4/+4
| | | | | | Found by a debug enabled stl. llvm-svn: 237906
* [X86][SSE] Improve support for 128-bit vector sign extensionSimon Pilgrim2015-05-212-7/+47
| | | | | | | | | | This patch improves support for sign extension of the lower lanes of vectors of integers by making use of the SSE41 pmovsx* sign extension instructions where possible, and optimizing the sign extension by shifts on pre-SSE41 targets (avoiding the use of i64 arithmetic shifts which require scalarization). It converts SIGN_EXTEND nodes to SIGN_EXTEND_VECTOR_INREG where necessary, that more closely matches the pmovsx* instruction than the default approach of using SIGN_EXTEND_INREG which splits the operation (into an ANY_EXTEND lowered to a shuffle followed by shifts) making instruction matching difficult during lowering. Necessary support for SIGN_EXTEND_VECTOR_INREG has been added to the DAGCombiner. Differential Revision: http://reviews.llvm.org/D9848 llvm-svn: 237885
* AsmPrinter: Compute absolute label difference directlyDuncan P. N. Exon Smith2015-05-211-0/+4
| | | | | | | | | | | | | | | | | | Create a low-overhead path for `EmitLabelDifference()` that emits a emits an absolute number when (1) the output is an object stream and (2) the two symbols are in the same data fragment. This drops memory usage on Mach-O from 975 MB down to 919 MB (5.8%). The only call is when `!doesDwarfUseRelocationsAcrossSections()` -- i.e., on Mach-O -- since otherwise an absolute offset from the start of the section needs a relocation. (`EmitLabelDifference()` is cheaper on ELF anyway, since it creates 1 fewer temp symbol, and it gets called far less often. It's not clear to me if this is even a bottleneck there.) (I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`; see r236629 for details.) llvm-svn: 237876
* Fix build errorAndrew Kaylor2015-05-201-1/+1
| | | | llvm-svn: 237859
* Fix build warningAndrew Kaylor2015-05-201-1/+1
| | | | llvm-svn: 237855
* [WinEH] C++ EH state numbering fixesAndrew Kaylor2015-05-202-106/+364
| | | | | | Differential Revision: http://reviews.llvm.org/D9787 llvm-svn: 237854
* Don't generate comments in the DebugLocStream unless required. NFC.Pete Cooper2015-05-203-10/+22
| | | | | | | | | | | | The ByteStreamer here wasn't taking account of whether the asm streamer was text based and verbose. Only with that combination should we emit comments. This change makes sure that we only actually convert a Twine to a string using Twine::str() if we need the comment. This saves about 10000 small allocations on a test case involving the verify-use_list-order bitcode going through llc with debug info. Note, this is NFC as the comments would ultimately never be emitted unless required. Reviewed by Duncan Exon Smith and David Blaikie. llvm-svn: 237851
* Revert "Add bool to DebugLocDwarfExpression to control emitting comments."Pete Cooper2015-05-204-17/+6
| | | | | | | | This reverts commit 0037b6bcbc874aa1b93d7ce3ad8dba3753ee2d9d (r237827). David Blaikie suggested some alternatives to this which are better. Reverting to apply a better solution later. llvm-svn: 237849
* Add bool to DebugLocDwarfExpression to control emitting comments.Pete Cooper2015-05-204-6/+17
| | | | | | | | | | | DebugLocDwarfExpression::EmitOp was creating temporary strings by concatenating Twine's. When emitting to object files, these comments are thrown away. This commit adds a boolean to the constructor of the DwarfExpression to control whether it will actually emit any comments. This prevents it from even generating the temporary comments which would have been thrown away anyway. llvm-svn: 237827
* DAGCombiner: Continue combining if FoldConstantArithmetic() fails.Matthias Braun2015-05-202-74/+106
| | | | | | | | | | | | DAG.FoldConstantArithmetic() can fail even though both operands are Constants if OpaqueConstants are involved. Continue trying other combine possibilities in tis case. Differential Revision: http://reviews.llvm.org/D6946 Somewhat related to PR21801 / rdar://19211454 llvm-svn: 237822
* Fix icmp loweringPawel Bylica2015-05-201-1/+2
| | | | | | | | | | | | | | | | | | | Summary: During icmp lowering it can happen that a constant value can be larger than expected (see the code around the change). APInt::getMinSignedBits() must be checked again as the shift before can change the constant sign to positive. I'm not sure it is the best fix possible though. Test Plan: Regression test included. Reviewers: resistor, chandlerc, spatel, hfinkel Reviewed By: hfinkel Subscribers: hfinkel, llvm-commits Differential Revision: http://reviews.llvm.org/D9147 llvm-svn: 237812
* Change Function::getIntrinsicID() to return an Intrinsic::ID. NFC.Pete Cooper2015-05-202-2/+2
| | | | | | | | Now that Intrinsic::ID is a typed enum, we can forward declare it and so return it from this method. This updates all users which were either using an unsigned to store it, or had a now unnecessary cast. llvm-svn: 237810
* Revert r237789 - [mips] The naming convention for private labels is ABI ↵Daniel Sanders2015-05-201-1/+0
| | | | | | | | | dependant. It works, but I've noticed that I missed several callers of createMCAsmInfo() and many don't have a TargetMachine to provide. llvm-svn: 237792
* [mips] The naming convention for private labels is ABI dependant.Daniel Sanders2015-05-201-0/+1
| | | | | | | | | | | | | | | | | Summary: For N32/N64, private labels begin with '.L' but for O32 they begin with '$'. MCAsmInfo now has an initializer function which can be used to provide information from the TargetMachine to control the assembly syntax. Reviewers: vkalintiris Reviewed By: vkalintiris Subscribers: jfb, sandeep, llvm-commits, rafael Differential Revision: http://reviews.llvm.org/D9821 llvm-svn: 237789
* [StatepointLowering] Support of the gc.relocates for invoke statepoints.Igor Laevsky2015-05-203-53/+78
| | | | | | | | | | This change implements support for lowering of the gc.relocates tied to the invoke statepoint. This is acomplished by storing frame indices of the lowered values in "StatepointRelocatedValues" map inside FunctionLoweringInfo instead of storing them in per-basic block structure StatepointLowering. After this change StatepointLowering is used only during "LowerStatepoint" call and it is not necessary to store it as a field in SelectionDAGBuilder anymore. Differential Revision: http://reviews.llvm.org/D7798 llvm-svn: 237786
* Add a GCStrategy for CoreCLRSwaroop Sridhar2015-05-202-0/+56
| | | | | | | | | | | | | | This change adds a new GC strategy for supporting the CoreCLR runtime. This strategy is currently identical to Statepoint-example GC, but is necessary for several upcoming changes specific to CoreCLR, such as: 1. Base-pointers not explicitly reported for interior pointers 2. Different format for stack-map encoding 3. Location of Safe-point polls: polls are only needed before loop-back edges and before tail-calls (not needed at function-entry) 4. Runtime specific handshake between calls to managed/unmanaged functions. llvm-svn: 237753
* Remove a stale commentPhilip Reames2015-05-191-3/+0
| | | | | | The todo was implemented a while ago; I just forgot to remove the comment. llvm-svn: 237736
* Revert r237708 (MIR serialization) - incremental buildbots became unstable.Alex Lorenz2015-05-1911-298/+9
| | | | | | | | The incremental buildbots entered a pass-fail cycle where during the fail cycle one of the tests from this commit fails for an unknown reason. I have reverted this commit and will investigate the cause of this problem. llvm-svn: 237730
* MachineInstr: Remove unused parameter.Matthias Braun2015-05-1910-21/+17
| | | | llvm-svn: 237726
* use 'auto *' for pointers; clearer usage, no deep copyingSanjay Patel2015-05-191-2/+2
| | | | llvm-svn: 237719
* tidy upSanjay Patel2015-05-191-5/+5
| | | | | | | | 1. remove duplicate local variable 2. add local variable with name to match comment 3. remove useless comment llvm-svn: 237715
* use range-based for-loopSanjay Patel2015-05-191-7/+4
| | | | llvm-svn: 237711
* MIR Serialization: print and parse LLVM IR using MIR format.Alex Lorenz2015-05-1911-9/+298
| | | | | | | | | | | | | | | | This commit is the initial commit for the MIR serialization project. It creates a new library under CodeGen called 'MIR'. This new library adds a new machine function pass that prints out the LLVM IR using the MIR format. This pass is then added as a last pass when a 'stop-after' option is used in llc. The new library adds the initial functionality for parsing of MIR files as well. This commit also extends the llc tool so that it can recognize and parse MIR input files. Reviewers: Duncan P. N. Exon Smith, Matthias Braun, Philip Reames Differential Revision: http://reviews.llvm.org/D9616 llvm-svn: 237708
* RegisterCoalescer: Improve a comment.Matthias Braun2015-05-191-6/+5
| | | | | | | Explain the relation of the example to the variables in the code, explain what bad behaviour the code avoids in this case. llvm-svn: 237706
* use range-based for loopSanjay Patel2015-05-191-5/+5
| | | | llvm-svn: 237705
* SelectionDAG: Cleanup and simplify FoldConstantArithmeticMatthias Braun2015-05-191-100/+91
| | | | | | | | | | | This cleans up the FoldConstantArithmetic code by factoring out the case of two ConstantSDNodes into an own function. This avoids unnecessary complexity for many callers who already have ConstantSDNode arguments. This also avoids an intermeidate SmallVector datastructure and a loop over that datastructure. llvm-svn: 237651
OpenPOWER on IntegriCloud