summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* CodeGen: Refactor renameDisconnectedComponents() as a passMatthias Braun2016-05-318-292/+460
| | | | | | | | | | | | | | | | | | Refactor LiveIntervals::renameDisconnectedComponents() to be a pass. Also change the name to "RenameIndependentSubregs": - renameDisconnectedComponents() worked on a MachineFunction at a time so it is a natural candidate for a machine function pass. - The algorithm is testable with a .mir test now. - This also fixes a problem where the lazy renaming as part of the MachineScheduler introduced IMPLICIT_DEF instructions after the number of a nodes in a region were counted leading to a mismatch. Differential Revision: http://reviews.llvm.org/D20507 llvm-svn: 271345
* [CodeGen] Promote FMINNAN/FMAXNAN like other binops.Ahmed Bougacha2016-05-311-0/+2
| | | | | | | | We think it's OK to generate half fminnan because it's legal for the transform-to type (f32; r245196). However, PromoteFloatRes was missing the case; simply promote like the other binops, including minnum. llvm-svn: 271317
* [CodeGen] Don't mark FMINNUM/FMAXNUM Expand twice. NFC.Ahmed Bougacha2016-05-311-2/+0
| | | | | | They're already in the all_valuetypes() loop above. llvm-svn: 271316
* [codeview] Improve readability of type record assemblyReid Kleckner2016-05-311-15/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds the method MCStreamer::EmitBinaryData, which is usually an alias for EmitBytes. In the MCAsmStreamer case, it is overridden to emit hex dump output like this: .byte 0x0e, 0x00, 0x08, 0x10 .byte 0x03, 0x00, 0x00, 0x00 .byte 0x00, 0x00, 0x00, 0x00 .byte 0x00, 0x10, 0x00, 0x00 Also, when verbose asm comments are enabled, this patch prints the dump output for each comment before its record, like this: # ArgList (0x1000) { # TypeLeafKind: LF_ARGLIST (0x1201) # NumArgs: 0 # Arguments [ # ] # } .byte 0x06, 0x00, 0x01, 0x12 .byte 0x00, 0x00, 0x00, 0x00 This should make debugging easier and testing more convenient. Reviewers: aaboud Subscribers: majnemer, zturner, amccarth, aaboud, llvm-commits Differential Revision: http://reviews.llvm.org/D20711 llvm-svn: 271313
* X86: permit using SjLj EH on x86 targets as an optionSaleem Abdulrasool2016-05-311-0/+3
| | | | | | | | | | | This adds support to the backed to actually support SjLj EH as an exception model. This is *NOT* the default model, and requires explicitly opting into it from the frontend. GCC supports this model and for MinGW can still be enabled via the `--using-sjlj-exceptions` options. Addresses PR27749! llvm-svn: 271244
* Add RelaxELFRelocations to TargetOptions.h.Rafael Espindola2016-05-291-0/+2
| | | | | | It will be used in clang. llvm-svn: 271161
* Update the stack coloring pass to remove lifetime intrinsics in the ↵Andrew Kaylor2016-05-271-4/+2
| | | | | | | | optnone/opt-bisect skip case. Differential Revision: http://reviews.llvm.org/D20453 llvm-svn: 271068
* MachineScheduler: Introduce ONLY1 reason to improve debug outputMatthias Braun2016-05-271-6/+13
| | | | llvm-svn: 271058
* [X86] Detect SAD patterns and emit psadbw instructions.Michael Kuperstein2016-05-271-7/+11
| | | | | | | | This recommits r267649 with a fix for PR27539. Differential Revision: http://reviews.llvm.org/D20598 llvm-svn: 271033
* Disable lifetime-start-on-first-use analysis.Than McIntosh2016-05-271-2/+2
| | | | | | | | | | | | | | | | Summary: Turn off lifetime-start-on-first-use enhancement for the moment pending a fix for bug 27903. Bug: 27903 Reviewers: tejohnson, wmi, qcolombet, gbiv Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D20731 llvm-svn: 271003
* Apply clang-tidy's misc-move-constructor-init throughout LLVM.Benjamin Kramer2016-05-275-16/+25
| | | | | | No functionality change intended, maybe a tiny performance improvement. llvm-svn: 270997
* Recommit 270977 - [llvm-mc] - Teach llvm-mc to generate zlib styled ↵George Rimar2016-05-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | compression sections. Fix: updated clang code which was not updated by mistake. Original commit message: [llvm-mc] - Teach llvm-mc to generate zlib styled compression sections. This patch is strongly based on previously reverted D20331. (because of gnuutils < 2.26 does not support compressed debug sections in non zlib-gnu style) Difference that this patch supports both zlib and zlib-gnu styles. -compress-debug-sections option now supports next values: -compress-debug-sections=zlib-gnu -compress-debug-sections=zlib -compress-debug-sections=none Previously specifying -compress-debug-sections enabled zlib-gnu compression, so anyone can put "-compress-debug-sections=zlib-gnu" to restore the behavior that was before this patch for case when compression was enabled. Differential revision: http://reviews.llvm.org/D20676 llvm-svn: 270987
* Apply clang-tidy's misc-static-assert where it makes sense.Benjamin Kramer2016-05-271-4/+6
| | | | | | | Also fold conditions into assert(0) where it makes sense. No functional change intended. llvm-svn: 270982
* Revert r270977 ([llvm-mc] - Teach llvm-mc to generate zlib styled ↵George Rimar2016-05-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | compression sections.) It broke buildbot: http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/13585/steps/build/logs/stdio Initial commit message: [llvm-mc] - Teach llvm-mc to generate zlib styled compression sections. This patch is strongly based on previously reverted D20331. (because of gnuutils < 2.26 does not support compressed debug sections in non zlib-gnu style) Difference that this patch supports both zlib and zlib-gnu styles. -compress-debug-sections option now supports next values: -compress-debug-sections=zlib-gnu -compress-debug-sections=zlib -compress-debug-sections=none Previously specifying -compress-debug-sections enabled zlib-gnu compression, so anyone can put "-compress-debug-sections=zlib-gnu" to restore the behavior that was before this patch for case when compression was enabled. Differential revision: http://reviews.llvm.org/D20676 llvm-svn: 270978
* [llvm-mc] - Teach llvm-mc to generate zlib styled compression sections.George Rimar2016-05-271-1/+1
| | | | | | | | | | | | | | | | | | | | This patch is strongly based on previously reverted D20331. (because of gnuutils < 2.26 does not support compressed debug sections in non zlib-gnu style) Difference that this patch supports both zlib and zlib-gnu styles. -compress-debug-sections option now supports next values: -compress-debug-sections=zlib-gnu -compress-debug-sections=zlib -compress-debug-sections=none Previously specifying -compress-debug-sections enabled zlib-gnu compression, so anyone can put "-compress-debug-sections=zlib-gnu" to restore the behavior that was before this patch for case when compression was enabled. Differential revision: http://reviews.llvm.org/D20676 llvm-svn: 270977
* [CodeGen] Fix problem with X86 byte registers in CriticalAntiDepBreakerMitch Bodart2016-05-261-4/+6
| | | | | | | | | | | | CriticalAntiDepBreaker was not correctly tracking defs of the high X86 byte registers, leading to incorrect use of a busy register to break an antidependence. Fixes pr27681, and its duplicates pr27580, pr27804. Differential Revision: http://reviews.llvm.org/D20456 llvm-svn: 270935
* SDAG: Use an Optional<> instead of a sigil value. NFCJustin Bogner2016-05-261-6/+6
| | | | | | | This just makes it a bit more clear that we don't intend to use a deleted node for anything here. llvm-svn: 270931
* PR26055: Speed up LiveDebugValues::transferDebugValue()Adrian Prantl2016-05-261-43/+85
| | | | | | | | | | | | | | | | | | | | | | | | | This patch builds upon r270776 and speeds up LiveDebugValues::transferDebugValue() by adding an index that maps each DebugVariable to its open VarLoc. The transferDebugValue() function needs to close all open ranges for a given DebugVariable. Iterating over the set bits of OpenRanges is prohibitively slow in practice. I experimented with using the sorted map of VarLocs in the UniqueVector to iterate only over the range of VarLocs with a given DebugVariable, but the binary search turned out to be even more expensive than just iterating over the set bits in OpenRanges. Instead, this patch exploits the fact that there can only be one open location for each DebugVariable and redundantly stores this location in a DenseMap. This patch brings the time spent in the LiveDebugValues pass down to an almost neglectiable amount. http://llvm.org/bugs/show_bug.cgi?id=26055 http://reviews.llvm.org/D20636 rdar://problem/24091200 llvm-svn: 270923
* Do not rename registers that do not start an independent live rangeKrzysztof Parzyszek2016-05-261-0/+25
| | | | llvm-svn: 270885
* Undo a suboptimal clang-format decision. NFCAdrian Prantl2016-05-261-4/+2
| | | | llvm-svn: 270861
* Use shouldAssumeDSOLocal on AArch64.Rafael Espindola2016-05-261-0/+43
| | | | | | This reduces code duplication and now AArch64 also handles PIE. llvm-svn: 270844
* [codeview] Use comdats for debug info describing comdat functionsReid Kleckner2016-05-252-12/+57
| | | | | | | | | | | | | | | | | | Summary: This allows the linker to discard unused symbol information for comdat functions that were discarded during the link. Before this change, searching for the name of an inline function in the debugger would return multiple results, one per symbol subsection in the object file. After this change, there is only one result, the result for the function chosen by the linker. Reviewers: zturner, majnemer Subscribers: aaboud, amccarth, llvm-commits Differential Revision: http://reviews.llvm.org/D20642 llvm-svn: 270792
* Work around an MSVC compiler issue in r270776.Adrian Prantl2016-05-251-3/+3
| | | | llvm-svn: 270783
* PR26055: Speed up LiveDebugValues by replacing lists with bitvectors.Adrian Prantl2016-05-251-143/+183
| | | | | | | | | | | | | | | | | | | | | This patch modifies the LiveDebugValues pass to use more efficient set data structures as outlined in PR26055. Both VarLocSet and VarLocList are now SparseBitVectors which allows us to perform much faster bitvector arithmetic on them. The speedup can be in the order of minutes especially on ASANified code. The change is not NFC in the assembler output because the inserted DBG_VALUEs are now sorted by variable and location. Many thanks to Daniel Berlin for helping design the improved algorithm and reviewing the patch. https://llvm.org/bugs/show_bug.cgi?id=26055 http://reviews.llvm.org/D20178 rdar://problem/24091200 llvm-svn: 270776
* [MBB] Early exit to reduce indentation, per coding guidelines. NFC.Chad Rosier2016-05-251-59/+62
| | | | llvm-svn: 270773
* Simplify std::all_of predicate (to one line) by using llvm::all_of. NFCI.Simon Pilgrim2016-05-251-2/+1
| | | | llvm-svn: 270749
* Simplify std::all_of predicate (to one line) by using llvm::all_of. NFCI.Simon Pilgrim2016-05-251-3/+1
| | | | llvm-svn: 270747
* [SelectionDAG] Add smarts for BSWAP in computeKnownBits.Chad Rosier2016-05-251-0/+6
| | | | llvm-svn: 270738
* [SDAG] Add a fallback multiplication expansionHal Finkel2016-05-251-1/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | LegalizeIntegerTypes does not have a way to expand multiplications for large integer types (i.e. larger than twice the native bit width). There's no standard runtime call to use in that case, and so we'd just assert. Unfortunately, as it turns out, it is possible to hit this case from standard-ish C code in rare cases. A particular case a user ran into yesterday involved an __int128 induction variable and a loop with a quadratic (not linear) recurrence which triggered some backend logic using SCEVExpander. In this case, the BinomialCoefficient code in SCEV generates some i129 variables, which get widened to i256. At a high level, this is not actually good (i.e. the underlying optimization, PPCLoopPreIncPrep, should not be transforming the loop in question for performance reasons), but regardless, the backend shouldn't crash because of cost-modeling issues in the optimizer. This is a straightforward implementation of the multiplication expansion, based on the algorithm in Hacker's Delight. I validated it against the code for the mul256b function from http://locklessinc.com/articles/256bit_arithmetic/ using random inputs. There should be no functional change for previously-working code (the new expansion code only replaces an assert). Fixes PR19797. llvm-svn: 270720
* Clarify that we match BSwap in InstCombine and BitReverse in CGP. NFC.Chad Rosier2016-05-251-1/+1
| | | | | | | | Also, rename recognizeBitReverseOrBSwapIdiom to recognizeBSwapOrBitReverseIdiom, so the ordering of the MatchBSwaps and MatchBitReversals arguments are consistent with the function name. llvm-svn: 270715
* ScheduleDAGInstrs: Fix memory corruptionMatthias Braun2016-05-251-2/+2
| | | | | | | | We have to modify V2SU before inserting new elements into the CurrentVRegDefs set because that may move V2SU in memory invalidating the reference. llvm-svn: 270644
* [MBP] Factor out the optimizations on branch conditions and unanalyzable ↵Haicheng Wu2016-05-241-44/+49
| | | | | | | | | | | | | | | | | | | | | branches. NFCI. The benefits of this patch are -- We call AnalyzeBranch() to optimize unanalyzable branches, but the result of AnalyzeBranch() is not used. Now the result is useful. -- Before the layout of all the MBBs is set, the result of AnalyzeBranch() is not correct and needs to be fixed before using it to optimize the branch conditions. Now this optimization is called after the layout, the code used to fix the result of AnalyzeBranch() is not needed. -- The branch condition of the last block is not optimized before. Now it is optimized. Differential Revision: http://reviews.llvm.org/D20177 llvm-svn: 270623
* LiveIntervalAnalysis: Fix handleMove() re-using the wrong value numberMatthias Braun2016-05-241-7/+3
| | | | | | This fixes http://llvm.org/PR27856 llvm-svn: 270619
* DWARF: Omit DW_AT_APPLE attributes (except ObjC ones) when not targeting LLDBDavid Blaikie2016-05-244-13/+25
| | | | | | | | | | | | | | | These attributes aren't used by other debuggers (& may be confused with other DWARF extensions) so they just waste space (about 1.5% on .dwo file size on a random large program I tested). We could remove the ObjC property ones too, but I figured they were probably more necessary when trying to understand ObjC (I could be wrong though) & so any debugger interested in working with ObjC would use them, perhaps? (also, there are some legacy tests in Clang that test for them - making it one of those annoying cross-project commits and/or cleanup to refactor those tests) llvm-svn: 270613
* Rework/enhance stack coloring data flow analysis.Than McIntosh2016-05-241-108/+413
| | | | | | | | | | | | | | Replace bidirectional flow analysis to compute liveness with forward analysis pass. Treat lifetimes as starting when there is a first reference to the stack slot, as opposed to starting at the point of the lifetime.start intrinsic, so as to increase the number of stack variables we can overlap. Reviewers: gbiv, qcolumbet, wmi Differential Revision: http://reviews.llvm.org/D18827 Bug: 25776 llvm-svn: 270559
* PrologEpilogInserter: Avoid an infinite loop when MinCSFrameIndex == 0Justin Bogner2016-05-231-3/+3
| | | | | | | | | | | | | | Before r269750 we did the comparisons in this loop in signed ints so that it DTRT when MinCSFrameIndex was 0. This was changed because it's now possible for MinCSFrameIndex to be UINT_MAX, but that introduced a bug when we were comparing `>= 0` - this is tautological in unsigned. Rework the comparisons here to avoid issues with unsigned wrapping. No test. I couldn't find a way to get any of the StackGrowsUp in-tree targets to reach the code that sets MinCSFrameIndex. llvm-svn: 270492
* Modify emitTypeInformation to use MemoryTypeTableBuilder, take 2Reid Kleckner2016-05-232-87/+64
| | | | | | | | | | | | | | This effectively revers commit r270389 and re-lands r270106, but it's almost a rewrite. The behavior change in r270106 was that we could no longer assume that each LF_FUNC_ID record got its own type index. This patch adds a map from DINode* to TypeIndex, so we can stop making that assumption. This change also emits padding bytes between type records similar to the way MSVC does. The size of the type record includes the padding bytes. llvm-svn: 270485
* InsertPointAnalysis: Move current live interval from being a class memberWei Mi2016-05-233-24/+22
| | | | | | | | to query interfaces argument; NFC Differential Revision: http://reviews.llvm.org/D20532 llvm-svn: 270481
* Fix DEBUG logs in MachineLICM.Justin Lebar2016-05-231-7/+5
| | | | | | | | | | | | | | | Summary: MBBs don't necessarily have a name (in my experience, they almost never do), in which case this logging is quite unhelpful. The number seems to work well. Reviewers: iteratee Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D20533 llvm-svn: 270477
* [codeview] Refactor symbol records to use same pattern as types.Zachary Turner2016-05-231-11/+11
| | | | | | | | | | | This will pave the way to introduce a full fledged symbol visitor similar to how we have a type visitor, thus allowing the same dumping code to be used in llvm-readobj and llvm-pdbdump. Differential Revision: http://reviews.llvm.org/D20384 Reviewed By: rnk llvm-svn: 270475
* Revert "Modify emitTypeInformation to use MemoryTypeTableBuilder"David Majnemer2016-05-232-19/+42
| | | | | | | This reverts commit r270106. It results in certain function types omitted in the output. llvm-svn: 270389
* [LiveIntervalAnalysis] Don't dereference an end iterator in ↵Hal Finkel2016-05-211-1/+1
| | | | | | | | | | | | | | | | repairIntervalsInRange This fixes a bug introduced in: r262115 - CodeGen: Take MachineInstr& in SlotIndexes and LiveIntervals, NFC The iterator End here might == MBB->end(), and so we can't unconditionally dereference it. This often goes unnoticed (I don't have a test case that always crashes, and ASAN does not catch it either) because the function call arguments are turned right back into iterators. MachineInstrBundleIterator's constructor, however, does have an assert which might randomly fire. llvm-svn: 270323
* [RegBankSelect] Compute the repairing cost for copies.Quentin Colombet2016-05-211-15/+40
| | | | | | | Prior to this patch, we were using 1 for all the repairing costs. Now, we use the information from the target to get this information. llvm-svn: 270304
* LiveIntervalAnalysis: Rework constructMainRangeFromSubranges()Matthias Braun2016-05-204-246/+40
| | | | | | | | | | | | | | | | | | | | | We now use LiveRangeCalc::extendToUses() instead of a specially designed algorithm in constructMainRangeFromSubranges(): - The original motivation for constructMainRangeFromSubranges() were differences between the main liverange and subranges because of hidden dead definitions. This case however cannot happen anymore with the DetectDeadLaneMasks pass in place. - It simplifies the code. - This fixes a longstanding bug where we did not properly create new SSA values on merging control flow (the MachineVerifier missed most of these cases). - Move constructMainRangeFromSubranges() to LiveIntervalAnalysis and LiveRangeCalc to better match the implementation/available helper functions. This re-applies r269016. The fixes from r270290 and r270259 should avoid the machine verifier problems this time. llvm-svn: 270291
* MachineVerifier: subregs so not require defs/valnos on every pathMatthias Braun2016-05-201-2/+3
| | | | | | | | | | | It is fine for subregister ranges to be undefined on some CFG paths as we may have a "vregX:other_subreg<read-undef> =" def on that path. We do not (and should not) have live segments for the subregister ranges. The MachineVerifier should not complain about this. This is a slight variant of http://llvm.org/PR27705 llvm-svn: 270290
* Use report_fatal_error after allKrzysztof Parzyszek2016-05-201-1/+1
| | | | | | | | Depending on the compiler used to build LLVM, llvm_unreachable can either expand to a call to abort(), or to a __builtin_unreachable. The latter does not have a predictable behavior at runtime. llvm-svn: 270260
* LiveIntervalAnalysis: Fix missing defs in renameDisconnectedComponents().Matthias Braun2016-05-203-15/+60
| | | | | | | | | | | | | | Fix renameDisconnectedComponents() creating vreg uses that can be reached from function begin withouthaving a definition (or explicit live-in). Fix this by inserting IMPLICIT_DEF instruction before control-flow joins as necessary. Removes an assert from MachineScheduler because we may now get additional IMPLICIT_DEF when preparing the scheduling policy. This fixes the underlying problem of http://llvm.org/PR27705 llvm-svn: 270259
* CodeGen: Move the call to DwarfDebug::beginModule() out of the constructor.Peter Collingbourne2016-05-202-5/+2
| | | | | | | | | This gives AsmPrinter a chance to initialize its DD field before we call beginModule(), which is about to start using it. Differential Revision: http://reviews.llvm.org/D20413 llvm-svn: 270258
* CodeGen: Do not require a MachineFunction just to create a DIEDwarfExpression.Peter Collingbourne2016-05-206-41/+49
| | | | | | | | | We are about to start using DIEDwarfExpression to create global variable DIEs, which happens before we generate code for functions. Differential Revision: http://reviews.llvm.org/D20412 llvm-svn: 270257
* [RegBankSelect] Look for the best mapping in greedy mode.Quentin Colombet2016-05-201-10/+38
| | | | | | | | | The Fast mode takes the first mapping, the greedy mode loops over all the possible mapping for an instruction and choose the cheaper one. Test case will come with target specific code, since we currently do not have instructions that have several mappings. llvm-svn: 270249
OpenPOWER on IntegriCloud