summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG
Commit message (Collapse)AuthorAgeFilesLines
* CodeGen: Stop using DIDescriptor::is*() and auto-castingDuncan P. N. Exon Smith2015-04-066-17/+9
| | | | | | Same as r234255, but for lib/CodeGen and lib/Target. llvm-svn: 234258
* Use sext in fast isel.Rafael Espindola2015-04-061-1/+1
| | | | | | | | | | | | | | | | | | Fast isel used to zero extends immediates to 64 bits. This normally goes unnoticed because the value is truncated to 32 bits for output. Two cases were it is noticed: * We fail to use smaller encodings. * If the original constant was smaller than i32. In the tests using i1 constants, codegen would change to use -1, which is fine (and matches what regular isel does) since only the lowest bit is then used. Instead, this patch then changes the ir to use i8 constants, which looks more like what clang produces. llvm-svn: 234249
* [WinEH] Don't sink allocas into child handlersReid Kleckner2015-04-061-2/+4
| | | | | | | | | | The uselist isn't enough to infer anything about the lifetime of such allocas. If we want to re-add this optimization, we will need to leverage lifetime markers to do it. Fixes PR23122. llvm-svn: 234196
* [DAGCombiner] Add support for FCEIL, FFLOOR and FTRUNC vector constant foldingSimon Pilgrim2015-04-062-6/+7
| | | | | | Differential Revision: http://reviews.llvm.org/D8715 llvm-svn: 234179
* [DAGCombiner] Merge FMUL Scalar and Vector constant canonicalization to RHS. ↵Simon Pilgrim2015-04-051-8/+2
| | | | | | NFCI. llvm-svn: 234118
* less space; NFCSanjay Patel2015-04-041-1/+0
| | | | llvm-svn: 234106
* [DAGCombiner] Canonicalize vector constants for ADD/MUL/AND/OR/XOR ↵Simon Pilgrim2015-04-041-6/+11
| | | | | | | | re-association Scalar integers are commuted to move constants to the RHS for re-association - this ensures vectors do the same. llvm-svn: 234092
* [WinEH] Fill out CatchHigh in the TryBlockMapDavid Majnemer2015-04-031-4/+2
| | | | | | Now all fields in the WinEH xdata have been filled out. llvm-svn: 234067
* [WinEH] Fill out .xdata for catch objectsDavid Majnemer2015-04-032-7/+5
| | | | | | | This add support for catching an exception such that an exception object available to the catch handler will be initialized by the runtime. llvm-svn: 234062
* [WinEH] Sink UnwindHelp completely out of IRDavid Majnemer2015-04-031-11/+0
| | | | | | | | We don't need to represent UnwindHelp in IR. Instead, we can use the knowledge that we are emitting the parent function to decide if we should create the UnwindHelp stack object. llvm-svn: 234061
* [WinEH] Handle nested landing pads in outlined catch handlersAndrew Kaylor2015-04-031-28/+0
| | | | | | Differential Revision: http://reviews.llvm.org/D8596 llvm-svn: 234041
* CodeGen: Assert that inlined-at locations agreeDuncan P. N. Exon Smith2015-04-036-15/+36
| | | | | | | | | | | | | | | | | As a follow-up to r234021, assert that a debug info intrinsic variable's `MDLocalVariable::getInlinedAt()` always matches the `MDLocation::getInlinedAt()` of its `!dbg` attachment. The goal here is to get rid of `MDLocalVariable::getInlinedAt()` entirely (PR22778), but I'll let these assertions bake for a while first. If you have an out-of-tree backend that just broke, you're probably attaching the wrong `DebugLoc` to a `DBG_VALUE` instruction. The one you want is the location that was attached to the corresponding `@llvm.dbg.declare` or `@llvm.dbg.value` call that you started with. llvm-svn: 234038
* SelectionDAG: Use specialized metadata nodes in EmitFuncArgumentDbgValue(), NFCDuncan P. N. Exon Smith2015-04-032-14/+12
| | | | | | | Use `MDLocalVariable` and `MDExpression` directly for the arguments of `EmitFuncArgumentDbgValue()` to simplify a follow-up patch. llvm-svn: 234026
* [DAGCombiner] Combine shuffles of BUILD_VECTOR and SCALAR_TO_VECTORSimon Pilgrim2015-04-031-0/+37
| | | | | | | | This patch attempts to fold the shuffling of 'scalar source' inputs - BUILD_VECTOR and SCALAR_TO_VECTOR nodes - if the shuffle node is the only user. This folds away a lot of unnecessary shuffle nodes, and allows quite a bit of constant folding that was being missed. Differential Revision: http://reviews.llvm.org/D8516 llvm-svn: 234004
* [WinEH] Implement support for catch-allDavid Majnemer2015-04-011-8/+13
| | | | | | | A catch (...) doesn't have a type descriptor. Instead, the 'adjectives' field has bit six set. llvm-svn: 233788
* Fix PR23065. Avoid optimizing bitcast of build_vector with constant input to ↵Jiangning Liu2015-04-011-5/+0
| | | | | | scalar_to_vector. llvm-svn: 233778
* [WinEH] ExitingScope is vacuously true if !PoppedCatches.empty()David Majnemer2015-03-311-2/+1
| | | | | | Remove a redundant condition, no functional change intended. llvm-svn: 233770
* [WinEH] Generate .xdata for catch handlersDavid Majnemer2015-03-312-42/+105
| | | | | | | | | | | | | | This lets us catch exceptions in simple cases. N.B. Things that do not work include (but are not limited to): - Throwing from within a catch handler. - Catching an object with a named catch parameter. - 'CatchHigh' is fictitious, we aren't sure of its purpose. - We aren't entirely efficient with regards to the number of EH states that we generate. - IP-to-State tables are sensitive to the order of emission. llvm-svn: 233767
* [SDAG] Handle non-integer preferred memset types for non-constant valuesHal Finkel2015-03-311-2/+17
| | | | | | | | | | | | | | The existing code in getMemsetValue only handled integer-preferred types when the fill value was not a constant. Make this more robust in two ways: 1. If the preferred type is a floating-point value, do the mul-splat trick on the corresponding integer type and then bitcast. 2. If the preferred type is a vector, do the mul-splat trick on one vector element, and then build a vector out of them. Fixes PR22754 (although, we should also turn off use of vector types at -O0). llvm-svn: 233749
* typos; NFCSanjay Patel2015-03-311-5/+5
| | | | llvm-svn: 233701
* [SDAG] Move TRUNCATE splitting logic into a helper, and useJames Molloy2015-03-312-11/+26
| | | | | | | | | | | it more liberally. SplitVecOp_TRUNCATE has logic for recursively splitting oversize vectors that need more than one round of splitting to become legal. There are many other ISD nodes that could benefit from this logic, so factor it out and use it for FP_TO_UINT,FP_TO_SINT,SINT_TO_FP,UINT_TO_FP and FTRUNC. llvm-svn: 233681
* Silence an unused variable warning.David Majnemer2015-03-301-0/+2
| | | | | | No functional change intended. llvm-svn: 233639
* [WinEH] Run cleanup handlers when an exception is thrownDavid Majnemer2015-03-304-6/+166
| | | | | | | | Generate tables in the .xdata section representing what actions to take when an exception is thrown. This currently fills in state for cleanups, catch handlers are still unfinished. llvm-svn: 233636
* CodeGen: Use the new DebugLoc API, NFCDuncan P. N. Exon Smith2015-03-303-16/+7
| | | | | | Update lib/CodeGen (and lib/Target) to use the new `DebugLoc` API. llvm-svn: 233582
* SelectionDAG: Reflow code to use early returns, NFCDuncan P. N. Exon Smith2015-03-301-15/+19
| | | | llvm-svn: 233577
* Use SDValue bool check to tidyup some possible vector folding ops. NFC.Simon Pilgrim2015-03-291-40/+35
| | | | llvm-svn: 233498
* Use SDValue bool check to tidyup some possible ReassociateOps. NFC.Simon Pilgrim2015-03-291-10/+5
| | | | llvm-svn: 233495
* [DAGCombiner] Fixed incorrect test for buildvector of constant integers.Simon Pilgrim2015-03-281-14/+8
| | | | | | DAGCombiner::ReassociateOps was correctly testing for an constant integer scalar but failed to correctly test for constant integer vectors (it was testing for any constant vector). llvm-svn: 233482
* fix typo and 80-col; NFCSanjay Patel2015-03-271-2/+2
| | | | llvm-svn: 233427
* [CodeGen] Don't attempt a tail-call with a non-forwarded explicit sret.Ahmed Bougacha2015-03-271-0/+5
| | | | | | | | | | | | Tailcalls are only OK with forwarded sret pointers. With explicit sret, one approximation is to check that the pointer isn't an Instruction, as in that case it might point into some local memory (alloca). That's not OK with tailcalls. Explicit sret counterpart to r233409. Differential Revison: http://reviews.llvm.org/D8510 llvm-svn: 233410
* [CodeGen] Don't attempt a tail-call with implicit sret.Ahmed Bougacha2015-03-271-0/+4
| | | | | | | | | Tailcalls are only OK with forwarded sret pointers. With sret demotion, they're not, as we'd have a pointer into a soon-to-be-dead stack frame. Differential Revison: http://reviews.llvm.org/D8510 llvm-svn: 233409
* Remove superfluous .str() and replace std::string concatenation with Twine.Yaron Keren2015-03-271-2/+2
| | | | llvm-svn: 233392
* Require a GC strategy be specified for functions which use gc.statepointPhilip Reames2015-03-271-23/+19
| | | | | | This was discussed a while back and I left it optional for migration. Since it's been far more than the 'week or two' that was discussed, time to actually make this manditory. llvm-svn: 233357
* Allow explicit spill slots to be specified for a gc.statepointPhilip Reames2015-03-271-4/+20
| | | | | | | | | | This patch adds support for explicitly provided spill slots in the GC arguments of a gc.statepoint. This is somewhat analogous to gcroot, but leverages the STATEPOINT MI node and StackMap infrastructure. The motivation for this is: 1) The stack spilling code for gc.statepoints hasn't advanced as fast as I'd like. One major option is to give up on doing spilling in the backend and do it at the IR level instead. We'd give up the ability to have gc values in registers, but that's a minor cost in practice. We are not neccessarily moving in that direction, but having the ability to prototype such a thing cheaply is interesting. 2) I want to port the gcroot lowering to use the statepoint infastructure. Given the metadata printers for gcroot expect a fixed set of stack roots, it's easiest to just reuse the explicit stack slots and pass them directly to the underlying statepoint. I'm holding off on the documentation for the new feature until I'm reasonable sure this is going to stick around. llvm-svn: 233356
* WinEH: Create a parent frame alloca for HandlerType xdata tablesDavid Majnemer2015-03-271-1/+11
| | | | | | | | We don't have any logic to emit those tables yet, so the SDAG lowering of this intrinsic is just a stub. We can see the intrinsic in the prepared IR, though. llvm-svn: 233354
* Fix a bug in SelectionDAG scheduling backtracking code: PR22304.Andrew Trick2015-03-271-1/+2
| | | | | | | | | | | | | | | It can happen (by line CurSU->isPending = true; // This SU is not in AvailableQueue right now.) that a SUnit is mark as available but is not in the AvailableQueue. For SUnit being selected for scheduling both conditions must be met. This patch mainly defensively protects from invalid removing a node from a queue. Sometimes nodes are marked isAvailable but are not in the queue because they have been defered due to some hazard. Patch by Pawel Bylica! llvm-svn: 233351
* [CodeGen] Report error rather than crash when unable to makeLibCall.Ahmed Bougacha2015-03-261-0/+2
| | | | | | Also, make the assumption explicit in the header. llvm-svn: 233329
* revert inadvertent changeSanjay Patel2015-03-261-2/+0
| | | | llvm-svn: 233294
* comment cleanup; NFCSanjay Patel2015-03-261-0/+2
| | | | llvm-svn: 233293
* fix indent; NFCSanjay Patel2015-03-261-1/+1
| | | | llvm-svn: 233288
* [DAGCombiner] Add support for TRUNCATE + FP_EXTEND vector constant foldingSimon Pilgrim2015-03-252-55/+50
| | | | | | | | | | This patch adds supports for the vector constant folding of TRUNCATE and FP_EXTEND instructions and tidies up the SINT_TO_FP and UINT_TO_FP instructions to match. It also moves the vector constant folding for the FNEG and FABS instructions to use the DAG.getNode() functionality like the other unary instructions. Differential Revision: http://reviews.llvm.org/D8593 llvm-svn: 233224
* WinEH: Create an unwind help alloca for __CxxFrameHandler3 xdata tablesReid Kleckner2015-03-251-0/+10
| | | | | | | | We don't have any logic to emit those tables yet, so the sdag lowering of this intrinsic is just a stub. We can see the intrinsic in the prepared IR, though. llvm-svn: 233209
* 'optnone' should not disable DAG combiner.Paul Robinson2015-03-251-5/+0
| | | | | | | | | Reverts the code change from r221168 and the relevant test. It was a mistake to disable the combiner, and based on the ultimate definition of 'optnone' we shouldn't have considered the test case as failing in the first place. llvm-svn: 233153
* [SelectionDAG] Fixed issue with uitofp vector constant folding being treated ↵Simon Pilgrim2015-03-231-4/+2
| | | | | | | | | | | | | | | | | | | | | | | as sitofp While the uitofp scalar constant folding treats an integer as an unsigned value (from lang ref): %X = sitofp i8 -1 to double ; yields double:-1.0 %Y = uitofp i8 -1 to double ; yields double:255.0 The vector constant folding was always using sitofp: %X = sitofp <2 x i8> <i8 -1, i8 -1> to <2 x double> ; yields <double -1.0, double -1.0> %Y = uitofp <2 x i8> <i8 -1, i8 -1> to <2 x double> ; yields <double -1.0, double -1.0> This patch fixes this so that the correct opcode is used for sitofp and uitofp. %X = sitofp <2 x i8> <i8 -1, i8 -1> to <2 x double> ; yields <double -1.0, double -1.0> %Y = uitofp <2 x i8> <i8 -1, i8 -1> to <2 x double> ; yields <double 255.0, double 255.0> Differential Revision: http://reviews.llvm.org/D8560 llvm-svn: 233033
* Re-sort includes with sort-includes.py and insert raw_ostream.h where it's used.Benjamin Kramer2015-03-232-0/+2
| | | | llvm-svn: 232998
* Move private classes into anonymous namespacesBenjamin Kramer2015-03-231-0/+2
| | | | | | NFC. llvm-svn: 232944
* Fix sign extension for MIPS64 in makeLibCall functionPetar Jovanovic2015-03-231-3/+4
| | | | | | | | | | | | Fixing sign extension in makeLibCall for MIPS64. In MIPS64 architecture all 32 bit arguments (int, unsigned int, float 32 (soft float)) must be sign extended. This fixes test "MultiSource/Applications/oggenc/". Patch by Strahinja Petrovic. Differential Revision: http://reviews.llvm.org/D7791 llvm-svn: 232943
* [SDAG] Don't widen VSETCC during type legalization for split operandsHal Finkel2015-03-231-0/+10
| | | | | | | | | | | | Because the operands of a vector SETCC node can be of a different type from the result (and often are), it can happen that even if we'd prefer to widen the result type of the SETCC, the operands have been split instead. In this case, the SETCC result also must be split. This mirrors what is done in WidenVecRes_SELECT, and should be NFC elsewhere because if the operands are not widened the following calls to GetWidenedVector will assert (which is what was happening in the test case). llvm-svn: 232935
* SelectionDAGBuilder: Rangeify a loop. NFC.Hans Wennborg2015-03-201-8/+6
| | | | llvm-svn: 232831
* SelectionDAGBuilder::handleJTSwitchCase, simplify loop; NFCHans Wennborg2015-03-201-9/+4
| | | | llvm-svn: 232830
OpenPOWER on IntegriCloud