summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
* Move passes that live in lib/CodeGen out of Scalar.hBenjamin Kramer2016-01-271-1/+1
| | | | llvm-svn: 258938
* Make some headers self-contained, remove unused includes that violate layering.Benjamin Kramer2016-01-271-1/+0
| | | | llvm-svn: 258937
* Move MCTargetAsmParser.h to llvm/MC/MCParser where it belongs.Benjamin Kramer2016-01-271-1/+1
| | | | llvm-svn: 258917
* Remove autoconf supportChris Bieneman2016-01-264-61/+0
| | | | | | | | | | | | | | | | Summary: This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html "I felt a great disturbance in the [build system], as if millions of [makefiles] suddenly cried out in terror and were suddenly silenced. I fear something [amazing] has happened." - Obi Wan Kenobi Reviewers: chandlerc, grosbach, bob.wilson, tstellarAMD, echristo, whitequark Subscribers: chfast, simoncook, emaste, jholewinski, tberghammer, jfb, danalbert, srhines, arsenm, dschuff, jyknight, dsanders, joker.eph, llvm-commits Differential Revision: http://reviews.llvm.org/D16471 llvm-svn: 258861
* [ScheduleDAGInstrs] Simplify logic to improve readability. NFC.Chad Rosier2016-01-261-2/+1
| | | | | | The call to isInvariantLoad() already returns false for non-load instructions. llvm-svn: 258841
* tidy up; NFCSanjay Patel2016-01-261-9/+9
| | | | llvm-svn: 258838
* fix formatting; NFCSanjay Patel2016-01-261-2/+1
| | | | llvm-svn: 258825
* LiveIntervalAnalysis: Improve some commentsMatthias Braun2016-01-261-4/+4
| | | | | | As recommended by Justin. llvm-svn: 258771
* LiveIntervalAnalysis: Cleanup handleMove{Down|Up}() functions, NFCMatthias Braun2016-01-261-131/+141
| | | | | | | | | | | | | | | | | | | | | | These two functions are hard to reason about. This commit makes the code more comprehensible: - Use four distinct variables (OldIdxIn, OldIdxOut, NewIdxIn, NewIdxOut) with a fixed value instead of a changing iterator I that points to different things during the function. - Remove the early explanation before the function in favor of more detailed comments inside the function. Should have more/clearer comments now stating which conditions are tested and which invariants hold at different points in the functions. The behaviour of the code was not changed. I hope that this will make it easier to review the changes in http://reviews.llvm.org/D9067 which I will adapt next. Differential Revision: http://reviews.llvm.org/D16379 llvm-svn: 258756
* [SelectionDAG] Use the correct return type for memcpy, memmove, and memset.Dan Gohman2016-01-251-3/+3
| | | | | | | | | | | | | When generating calls to memcpy, memmove, and memset, use void* as the return type rather than void, to match the standard signatures for these functions. This has no practical effect for most targets, since the return values of these calls aren't being used anyway, and most calling conventions tolerate this kind of mismatch. However, this change will help support future optimizations to utilize the return value to avoid holding the argument value live across a call. llvm-svn: 258691
* Fixed few comments.Amjad Aboud2016-01-242-4/+4
| | | | llvm-svn: 258658
* [WinEH] Don't miscompile cleanups which conditionally unwind to callerDavid Majnemer2016-01-231-1/+2
| | | | | | | | | | | | | | | | A cleanup can have paths which unwind or end up in unreachable. If there is an unreachable path *and* a path which unwinds to caller, we would mistakenly inject an unwind path to a catchswitch on the unreachable path. This results in a verifier assertion firing because the cleanup unwinds to two different places: to the caller and to the catchswitch. This occured because we used getCleanupRetUnwindDest to determine if the cleanuppad had no cleanuprets. This is incorrect, getCleanupRetUnwindDest returns null for cleanuprets which unwind to caller. llvm-svn: 258651
* [SelectionDAG] Generalised the CONCAT_VECTORS creation to support ↵Simon Pilgrim2016-01-231-10/+12
| | | | | | BUILD_VECTOR and UNDEF folding. llvm-svn: 258646
* Tidied up TRUNC combine code. NFC.Simon Pilgrim2016-01-231-9/+5
| | | | | | Make use of DAG.getBitcast and use clang-format to reduce number of lines (and make it more readable). llvm-svn: 258644
* Don't check if a list is empty with ilist::size.Benjamin Kramer2016-01-231-1/+1
| | | | | | ilist::size() is O(n) while ilist::empty() is O(1) llvm-svn: 258636
* Remove extra whitespace. NFC.Junmo Park2016-01-231-4/+4
| | | | llvm-svn: 258617
* [WinEH] Let cleanups post-dominated by unreachable get executedDavid Majnemer2016-01-221-0/+112
| | | | | | | | | | | | | | | | | | | | | | | | | Cleanups in C++ are a little weird. They are only guaranteed to be reliably executed if, and only if, there is a viable catch handler which can handle the exception. This means that reachability of a cleanup is lexically determined by it being nested with a try-block which unwinds to a catch. It is *cannot* be reasoned about by examining the control flow edges leaving a cleanup. Usually this is not a problem. It becomes a problem when there are *no* edges out of a cleanup because we believed that code post-dominated by the cleanup is dead. In LLVM's case, this code is what informs the personality routine about the presence of a suitable catch handler. However, the lack of edges to that catch handler makes the handler become unreachable which causes us to remove it. By removing the handler, the cleanup becomes unreachable. Instead, inject a catch-all handler with every cleanup that has no unwind edges. This will allow us to properly unwind the stack. This fixes PR25997. llvm-svn: 258580
* Fix LivePhysRegs::addLiveOutsWeiming Zhao2016-01-221-1/+1
| | | | | | | | | | | | | | Summary: The testing for returnBB was flipped which may cause ARM ld/st opt pass uses callee saved regs in returnBB when shrink-wrap is used. Reviewers: t.p.northover, apazos, MatzeB Subscribers: mcrosier, zzheng, aemerson, llvm-commits, rengolin Differential Revision: http://reviews.llvm.org/D16434 llvm-svn: 258569
* function names start with a lowercase letter; NFCSanjay Patel2016-01-221-8/+8
| | | | llvm-svn: 258552
* [WinEH] Make collectFuncletMembers non-recursiveDavid Majnemer2016-01-221-22/+20
| | | | | | | Use a worklist for the pre-order DFS instead of using recursion. No functionality change is intended. llvm-svn: 258521
* [SelectionDAG] Fold more offsets into GlobalAddressesDan Gohman2016-01-222-75/+123
| | | | | | | | This reapplies r258296 and r258366, and also fixes an existing bug in SelectionDAG.cpp's isMemSrcFromString, neglecting to account for the offset in a GlobalAddressSDNode, which is uncovered by those patches. llvm-svn: 258482
* [opaque pointer types] [NFC] DataLayout::getIndexedOffset: take source ↵Eduard Burtescu2016-01-221-3/+3
| | | | | | | | | | | | | | element type instead of pointer type and rename to getIndexedOffsetInType. Summary: Reviewers: mjacob, dblaikie Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D16282 llvm-svn: 258478
* [opaque pointer types] [NFC] Add an explicit type argument to ↵Eduard Burtescu2016-01-221-1/+1
| | | | | | | | | | | | ConstantFoldLoadFromConstPtr. Reviewers: mjacob, dblaikie Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D16418 llvm-svn: 258472
* Revert "[SelectionDAG] Fold more offsets into GlobalAddresses"Reid Kleckner2016-01-222-120/+73
| | | | | | | | | | | | | | This reverts r258296 and the follow up r258366. With this change, we miscompiled the following program on Windows: #include <string> #include <iostream> static const char kData[] = "asdf jkl;"; int main() { std::string s(kData + 3, sizeof(kData) - 3); std::cout << s << '\n'; } llvm-svn: 258465
* Avoid unnecessary stack realignment in musttail thunks with SSE2 enabledReid Kleckner2016-01-211-1/+2
| | | | | | | | | | | The X86 musttail implementation finds register parameters to forward by running the calling convention algorithm until a non-register location is returned. However, assigning a vector memory location has the side effect of increasing the function's stack alignment. We shouldn't increase the stack alignment when we are only looking for register parameters, so this change conditionalizes it. llvm-svn: 258442
* Partially revert "Add command line options to force function/loop alignments."Chad Rosier2016-01-211-10/+0
| | | | | | This partially reverts r256571 in favor of the solution in r258409. llvm-svn: 258421
* [BlockPlacement] Add option to align all non-fall-through blocks.Geoff Berry2016-01-211-0/+16
| | | | | | | | | | | | Summary: This option is being added for testing purposes. Reviewers: mcrosier Subscribers: mcrosier, llvm-commits Differential Revision: http://reviews.llvm.org/D16410 llvm-svn: 258409
* Introduce ConstantFoldCastOperand function and migrate some callers of ↵Manuel Jacob2016-01-211-8/+8
| | | | | | | | | | | | | | | | | ConstantFoldInstOperands to use it. NFC. Summary: Although this is a slight cleanup on its own, the main motivation is to refactor the constant folding API to ease migration to opaque pointers. This will be follow-up work. Reviewers: eddyb Subscribers: zzheng, dblaikie, llvm-commits Differential Revision: http://reviews.llvm.org/D16380 llvm-svn: 258390
* [GlobalISel] make library an optional componentAndrew Wilkins2016-01-211-1/+1
| | | | | | | | | | | | | | | | | | | Summary: Mark the LLVMGlobalISel library as optional in LLVMBuild.txt, since the library is only built if LLVM_BUILD_GLOBAL_ISEL is set. Without doing this, llvm-config includes the library in the list of components regardless of whether it's built, and then will error out when asked for the library names/paths. Reviewers: qcolombet Subscribers: joker.eph, llvm-commits, vkalintiris Differential Revision: http://reviews.llvm.org/D16386 llvm-svn: 258379
* [SelectionDAG] Fix constant offset folding to avoid commuting ↵Dan Gohman2016-01-201-2/+3
| | | | | | | | | non-commutative operators. This fixes a miscompile in MultiSource/Benchmarks/MiBench/consumer-lame introduced in r258296. llvm-svn: 258366
* MachineScheduler: Add a command line option to disable post scheduler.Chad Rosier2016-01-201-1/+9
| | | | llvm-svn: 258364
* MachineScheduler: Honor optnone functions in the pre-ra scheduler.Chad Rosier2016-01-201-0/+3
| | | | llvm-svn: 258363
* [GlobalISel] Add the proper cmake plumbing.Quentin Colombet2016-01-205-1/+68
| | | | | | | | | | | | | This patch adds the necessary plumbing to cmake to build the sources related to GlobalISel. To build the sources related to GlobalISel, we need to add -DBUILD_GLOBAL_ISEL=ON. By default, this is OFF, thus GlobalISel sources will not impact people that do not explicitly opt-in. Differential Revision: http://reviews.llvm.org/D15983 llvm-svn: 258344
* fix formatting; NFCSanjay Patel2016-01-201-3/+3
| | | | llvm-svn: 258330
* Proper handling of diamond-like cases in if-conversionKrzysztof Parzyszek2016-01-201-15/+52
| | | | | | | | | | | If converter was somewhat careless about "diamond" cases, where there was no join block, or in other words, where the true/false blocks did not have analyzable branches. In such cases, it was possible for it to remove (needed) branches, resulting in a loss of entire basic blocks. Differential Revision: http://reviews.llvm.org/D16156 llvm-svn: 258310
* [SelectionDAG] Fold more offsets into GlobalAddressesDan Gohman2016-01-202-73/+119
| | | | | | | | | | | | | | | | | | SelectionDAG previously missed opportunities to fold constants into GlobalAddresses in several areas. For example, given `(add (add GA, c1), y)`, it would often reassociate to `(add (add GA, y), c1)`, missing the opportunity to create `(add GA+c, y)`. This isn't often visible on targets such as X86 which effectively reassociate adds in their complex address-mode folding logic, however it is currently visible on WebAssembly since it currently has very simple address mode folding code that doesn't reassociate anything. This patch fixes this by making SelectionDAG fold offsets into GlobalAddresses at the same times that it folds constants together, so that it doesn't miss any opportunities to perform such folding. Differential Revision: http://reviews.llvm.org/D16090 llvm-svn: 258296
* [NFC] Replace several manual GEP loops with gep_type_iterator.Eduard Burtescu2016-01-202-31/+13
| | | | | | | | | | Reviewers: dblaikie Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D16335 llvm-svn: 258262
* MachineScheduler: Allow independent scheduling of sub register defsMatthias Braun2016-01-203-55/+194
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Note that this is disabled by default and still requires a patch to handleMove() which is not upstreamed yet. If the TrackLaneMasks policy/strategy is enabled the MachineScheduler will build a schedule graph where definitions of independent subregisters are no longer serialised. Implementation comments: - Without lane mask tracking a sub register def also counts as a use (except for the first one with the read-undef flag set), with lane mask tracking enabled this is no longer the case. - Pressure Diffs where previously maintained per definition of a vreg with the help of the SSA information contained in the LiveIntervals. With lanemask tracking enabled we cannot do this anymore and instead change the pressure diffs for all uses of the vreg as it becomes live/dead. For this changed style to work correctly we ignore uses of instructions that define the same register again: They won't affect register pressure. - With lanemask tracking we remove all read-undef flags from sub register defs when building the graph and re-add them later when all vreg lanes have become dead. Differential Revision: http://reviews.llvm.org/D14969 llvm-svn: 258259
* RegisterPressure: Make liveness tracking subregister awareMatthias Braun2016-01-203-182/+437
| | | | | | Differential Revision: http://reviews.llvm.org/D14968 llvm-svn: 258258
* LiveInterval: Add utility class to rename independent subregister usageMatthias Braun2016-01-202-0/+199
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This renaming is necessary to avoid a subregister aware scheduler accidentally creating liveness "holes" which are rejected by the MachineVerifier. Explanation as found in this patch: Helper class that can divide MachineOperands of a virtual register into equivalence classes of connected components. MachineOperands belong to the same equivalence class when they are part of the same SubRange segment or adjacent segments (adjacent in control flow); Different subranges affected by the same MachineOperand belong to the same equivalence class. Example: vreg0:sub0 = ... vreg0:sub1 = ... vreg0:sub2 = ... ... xxx = op vreg0:sub1 vreg0:sub1 = ... store vreg0:sub0_sub1 The example contains 3 different equivalence classes: - One for the (dead) vreg0:sub2 definition - One containing the first vreg0:sub1 definition and its use, but not the second definition! - The remaining class contains all other operands involving vreg0. We provide a utility function here to rename disjunct classes to different virtual registers. Differential Revision: http://reviews.llvm.org/D16126 llvm-svn: 258257
* [MachineSink] Don't break ImplicitNullsSanjoy Das2016-01-201-0/+49
| | | | | | | | | | | | | | | Summary: This teaches MachineSink to not sink instructions that might break the implicit null check optimization that runs later. This should not affect frontends that do not use implicit null checks. Reviewers: aadg, reames, hfinkel, atrick Subscribers: majnemer, llvm-commits Differential Revision: http://reviews.llvm.org/D14632 llvm-svn: 258254
* [MachineFunction] Constify getter. NFC.Quentin Colombet2016-01-191-1/+1
| | | | llvm-svn: 258207
* Revert 258157Philip Reames2016-01-192-8/+0
| | | | | | According the build bots, clang is using the Registry class somewhere as well. Will reapply with appropriate clang changes at a later point. llvm-svn: 258159
* [GC] Registry initialization and linkage interactionsPhilip Reames2016-01-192-0/+8
| | | | | | | | | | | | | | The Registry class constructs a linked list of nodes whose storage is inside static variables and nodes are added via static initializers. The trick is that those static initializers are in both the LLVM code base, and some random plugin that might get loaded in at runtime. The existing code tries to use C++ templates and their ODR rules to get a single definition of the registry for each type, but, experimentally, this doesn't quite work as designed. (Well, the entire structure doesn't. It might not actually be an ODR problem.) Previously, when I tried moving the GCStrategy class (along with it's registry) from CodeGen to IR, I ran into a problem where asking the GCStrategyRegistry a question would return inconsistent results depending on whether you asked from CodeGen (where the static initializers still were) or Transforms. My best guess is that this is a result of either a) an order of initialization error, or b) we ended up with two copies of the registry being created. I remember at the time having convinced myself it was probably (b), but I don't have any of my notes around from that investigation any more. See http://reviews.llvm.org/rL226311 for the original patch in question. This patch tries to remove the possibility of (b) above. (a) was already fixed in change 258109. Differential Revision: http://reviews.llvm.org/D16170 llvm-svn: 258157
* [opaque pointer types] [NFC] GEP: replace get(Pointer)ElementType uses with ↵Eduard Burtescu2016-01-192-2/+15
| | | | | | | | | | | | | | | | | | get{Source,Result}ElementType. Summary: GEPOperator: provide getResultElementType alongside getSourceElementType. This is made possible by adding a result element type field to GetElementPtrConstantExpr, which GetElementPtrInst already has. GEP: replace get(Pointer)ElementType uses with get{Source,Result}ElementType. Reviewers: mjacob, dblaikie Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D16275 llvm-svn: 258145
* [GC] Consolidate all built in GCs into a single file [NFC]Philip Reames2016-01-198-252/+145
| | | | | | Combine a bunch of small files into a single, still rather small, file. The primary purpose of this is to get all of the static initializers into a single file so as to have a well defined order of initialization. llvm-svn: 258109
* Fixed MSVC warning that not all control paths return a value.Simon Pilgrim2016-01-181-0/+1
| | | | llvm-svn: 258099
* Add to the split module utility an SCC based method which allows not to ↵Sergei Larin2016-01-181-2/+3
| | | | | | | | | | | | | | | | | | globalize any local variables. Summary: Currently llvm::SplitModule as the first step globalizes all local objects, which might not be desirable in some scenarios. This change adds a new flag to llvm::SplitModule that uses SCC approach to search for a balanced partition without the need to externalize symbols. Such partition might not be possible or fully balanced for a given number of partitions, and is a function of the module properties (global/local dependencies within the module). Joint development Tobias Edler von Koch (tobias@codeaurora.org) and Sergei Larin (slarin@codeaurora.org) Subscribers: llvm-commits, joker.eph Differential Revision: http://reviews.llvm.org/D16124 llvm-svn: 258083
* TargetLowering: Improve handling of (setcc ([sz]ext x) 0, cc) in SimplifySetCCTom Stellard2016-01-181-0/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When SimplifySetCC sees a setcc node that compares the result of a value extension operation with a constant, it tries to simplify the setcc node by eliminating the extension and shrinking the constant. If shrinking the inputs to setcc is deemed not desirable by the target (e.g. the target does not want a setcc comparing i1 values), then it is still possible to optimize this sequence in some cases. This patch adds the following combines to SimplifySetCC when shrinking setcc inputs is not desirable: (setcc ([sz]ext (setcc x, y, cc)), 0, setne) -> (setcc (x, y, cc)) (setcc ([sz]ext (setcc x, y, cc)), 0, seteq) -> (setcc (x, Y, !cc)) There are no tests for this yet, but once AMDGPU correctly implements TargetLowering::isTypeDesirableForOp(), this new combine will be exercised by the existing CodeGen/AMDGPU/setcc-opt.ll test. Reviewers: resistor, arsenm Subscribers: jroelofs, arsenm, llvm-commits Differential Revision: http://reviews.llvm.org/D15034 llvm-svn: 258067
* Remove extra whitespace. NFC.Junmo Park2016-01-181-2/+2
| | | | llvm-svn: 258035
OpenPOWER on IntegriCloud