summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/Analysis.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove TLI from isInTailCallPosition's arguments. NFC.Juergen Ributzka2014-07-161-3/+3
| | | | | | | There is no need to pass on TLI separately to the function. As Eric pointed out the Target Machine already provides everything we need. llvm-svn: 213108
* [FastISel] Make isInTailCallPosition independent of SelectionDAG.Juergen Ributzka2014-07-111-5/+4
| | | | | | | Break out the arguemnts required from SelectionDAG, so that this function can also be used by FastISel. llvm-svn: 212844
* The includes were sorted. Revert r210578.Eric Christopher2014-06-251-1/+1
| | | | llvm-svn: 211737
* Have isInTailCallPosition take the DAG so that we can use theEric Christopher2014-06-101-4/+5
| | | | | | | version of TargetLowering/Machine from there on the way to avoiding TargetMachine in TargetLowering. llvm-svn: 210579
* Reorder includes to be sorted.Eric Christopher2014-06-101-1/+1
| | | | llvm-svn: 210578
* Fix typos.Eric Christopher2014-06-101-1/+1
| | | | llvm-svn: 210571
* [C++11] More 'nullptr' conversion. In some cases just using a boolean check ↵Craig Topper2014-04-141-3/+3
| | | | | | instead of comparing to nullptr. llvm-svn: 206142
* [C++11] Replace llvm::next and llvm::prior with std::next and std::prev.Benjamin Kramer2014-03-021-2/+1
| | | | | | Remove the old functions. llvm-svn: 202636
* [stackprotector] Refactor out the end of isInTailCallPosition into the ↵Michael Gottesman2013-08-201-1/+8
| | | | | | | | | | function returnTypeIsEligibleForTailCall. This allows me to use returnTypeIsEligibleForTailCall in the stack protector pass. rdar://13935163 llvm-svn: 188765
* Allow compatible extension attributes for tail callsTim Northover2013-08-121-14/+36
| | | | | | | | If the tail-callee and caller give the same bits via the same signext/zeroext attribute then a tail-call should be allowed, since the extension has already been done by the callee. llvm-svn: 188159
* Make helper static and fix formatting.Benjamin Kramer2013-08-091-5/+4
| | | | llvm-svn: 188074
* Refactor isInTailCallPosition handlingTim Northover2013-08-061-134/+287
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change came about primarily because of two issues in the existing code. Niether of: define i64 @test1(i64 %val) { %in = trunc i64 %val to i32 tail call i32 @ret32(i32 returned %in) ret i64 %val } define i64 @test2(i64 %val) { tail call i32 @ret32(i32 returned undef) ret i32 42 } should be tail calls, and the function sameNoopInput is responsible. The main problem is that it is completely symmetric in the "tail call" and "ret" value, but in reality different things are allowed on each side. For these cases: 1. Any truncation should lead to a larger value being generated by "tail call" than needed by "ret". 2. Undef should only be allowed as a source for ret, not as a result of the call. Along the way I noticed that a mismatch between what this function treats as a valid truncation and what the backends see can lead to invalid calls as well (see x86-32 test case). This patch refactors the code so that instead of being based primarily on values which it recurses into when necessary, it starts by inspecting the type and considers each fundamental slot that the backend will see in turn. For example, given a pathological function that returned {{}, {{}, i32, {}}, i32} we would consider each "real" i32 in turn, and ask if it passes through unchanged. This is much closer to what the backend sees as a result of ComputeValueVTs. Aside from the bug fixes, this eliminates the recursion that's going on and, I believe, makes the bulk of the code significantly easier to understand. The trade-off is the nasty iterators needed to find the real types inside a returned value. llvm-svn: 187787
* [stackprotector] Changed isNoopBitcast/sameNoopInput to take ↵Michael Gottesman2013-07-221-2/+2
| | | | | | | | | | TargetLoweringBase instead of TargetLowering. Both functions only use functionality from TargetLoweringBase. rdar://13935163 llvm-svn: 186874
* Only pass 'returned' to target-specific lowering code when the value of ↵Stephen Lin2013-04-301-4/+0
| | | | | | entire register is guaranteed to be preserved. llvm-svn: 180825
* Add some constraints to use of 'returned':Stephen Lin2013-04-231-0/+4
| | | | | | | | | 1) Disallow 'returned' on parameter that is also 'sret' (no sensible semantics, as far as I can tell). 2) Conservatively disallow tail calls through 'returned' parameters that also are 'zext' or 'sext' (for consistency with treatment of other zero-extending and sign-extending operations in tail call position detection...can be revised later to handle situations that can be determined to be safe). This is a new attribute that is not yet used, so there is no impact. llvm-svn: 180118
* Add CodeGen support for functions that always return arguments via a new ↵Stephen Lin2013-04-201-0/+26
| | | | | | parameter attribute 'returned', which is taken advantage of in target-independent tail call opportunity detection and in ARM call lowering (when placed on an integral first parameter). llvm-svn: 179925
* Allow tail call opportunity detection through nested and/or multiple ↵Stephen Lin2013-04-201-73/+126
| | | | | | iterations of extractelement/insertelement indirection llvm-svn: 179924
* Remove unused #includes.Bill Wendling2013-03-051-1/+0
| | | | llvm-svn: 176467
* Remove unused parameter. Also use the AttributeSet query methods instead of ↵Bill Wendling2013-01-181-7/+8
| | | | | | the Attribute query methods. llvm-svn: 172852
* Sink a function that refers to the SelectionDAG into that library in theChandler Carruth2013-01-081-21/+0
| | | | | | | | | | | | | | one file where it is called as a static function. Nuke the declaration and the definition in lib/CodeGen, along with the include of SelectionDAG.h from this file. There is no dependency edge from lib/CodeGen to lib/CodeGen/SelectionDAG, so it isn't valid for a routine in lib/CodeGen to reference the DAG. There is a dependency from lib/CodeGen/SelectionDAG on lib/CodeGen. This breaks one violation of this layering. llvm-svn: 171842
* Move all of the header files which are involved in modelling the LLVM IRChandler Carruth2013-01-021-7/+7
| | | | | | | | | | | | | | | | | | | | | into their new header subdirectory: include/llvm/IR. This matches the directory structure of lib, and begins to correct a long standing point of file layout clutter in LLVM. There are still more header files to move here, but I wanted to handle them in separate commits to make tracking what files make sense at each layer easier. The only really questionable files here are the target intrinsic tablegen files. But that's a battle I'd rather not fight today. I've updated both CMake and Makefile build systems (I think, and my tests think, but I may have missed something). I've also re-sorted the includes throughout the project. I'll be committing updates to Clang, DragonEgg, and Polly momentarily. llvm-svn: 171366
* Rename the 'Attributes' class to 'Attribute'. It's going to represent a ↵Bill Wendling2012-12-191-10/+10
| | | | | | single attribute in the future. llvm-svn: 170502
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-031-5/+5
| | | | | | | | | | | | | | | | | Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] llvm-svn: 169131
* Move the Attributes::Builder outside of the Attributes class and into its ↵Bill Wendling2012-10-151-3/+3
| | | | | | own class named AttrBuilder. No functionality change. llvm-svn: 165960
* Remove the bitwise XOR operator from the Attributes class. Replace it with ↵Bill Wendling2012-10-141-2/+2
| | | | | | the equivalent from the builder class. llvm-svn: 165893
* Remove the final bits of Attributes being declared in the AttributeBill Wendling2012-10-101-2/+4
| | | | | | | namespace. Use the attribute's enum value instead. No functionality change intended. llvm-svn: 165610
* Create enums for the different attributes.Bill Wendling2012-10-091-2/+4
| | | | | | | We use the enums to query whether an Attributes object has that attribute. The opaque layer is responsible for knowing where that specific attribute is stored. llvm-svn: 165488
* Move TargetData to DataLayout.Micah Villmow2012-10-081-3/+3
| | | | llvm-svn: 165402
* Convert some attribute existence queries over to use the predicate methods.Bill Wendling2012-09-191-2/+2
| | | | llvm-svn: 164268
* quick fix for PR13006, will check in testcase later.Chris Lattner2012-06-011-1/+3
| | | | llvm-svn: 157813
* enhance the logic for looking through tailcalls to look through transparent ↵Chris Lattner2012-06-011-1/+21
| | | | | | | | | casts in multiple-return value scenarios, like what happens on X86-64 when returning small structs. llvm-svn: 157800
* enhance getNoopInput to know about vector<->vector bitcasts of legalChris Lattner2012-06-011-10/+38
| | | | | | | | types, as well as int<->ptr casts. This allows us to tailcall functions with some trivial casts between the call and return (i.e. because the return types disagree). llvm-svn: 157798
* rearrange some logic, no functionality change.Chris Lattner2012-06-011-24/+32
| | | | llvm-svn: 157796
* Fix a long standing tail call optimization bug. When a libcall is emittedEvan Cheng2012-04-101-2/+2
| | | | | | | | | | | | | legalizer always use the DAG entry node. This is wrong when the libcall is emitted as a tail call since it effectively folds the return node. If the return node's input chain is not the entry (i.e. call, load, or store) use that as the tail call input chain. PR12419 rdar://9770785 rdar://11195178 llvm-svn: 154370
* More dead code removal (using -Wunreachable-code)David Blaikie2012-01-201-6/+2
| | | | llvm-svn: 148578
* Extend Attributes to 64 bitsKostya Serebryany2012-01-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Problem: LLVM needs more function attributes than currently available (32 bits). One such proposed attribute is "address_safety", which shows that a function is being checked for address safety (by AddressSanitizer, SAFECode, etc). Solution: - extend the Attributes from 32 bits to 64-bits - wrap the object into a class so that unsigned is never erroneously used instead - change "unsigned" to "Attributes" throughout the code, including one place in clang. - the class has no "operator uint64 ()", but it has "uint64_t Raw() " to support packing/unpacking. - the class has "safe operator bool()" to support the common idiom: if (Attributes attr = getAttrs()) useAttrs(attr); - The CTOR from uint64_t is marked explicit, so I had to add a few explicit CTOR calls - Add the new attribute "address_safety". Doing it in the same commit to check that attributes beyond first 32 bits actually work. - Some of the functions from the Attribute namespace are worth moving inside the class, but I'd prefer to have it as a separate commit. Tested: "make check" on Linux (32-bit and 64-bit) and Mac (10.6) built/run spec CPU 2006 on Linux with clang -O2. This change will break clang build in lib/CodeGen/CGCall.cpp. The following patch will fix it. llvm-svn: 148553
* Move Instruction::isSafeToSpeculativelyExecute out of VMCore andDan Gohman2011-12-141-2/+3
| | | | | | | | | into Analysis as a standalone function, since there's no need for it to be in VMCore. Also, update it to use isKnownNonZero and other goodies available in Analysis, making it more precise, enabling more aggressive optimization. llvm-svn: 146610
* Move global variables in TargetMachine into new TargetOptions class. As an APINick Lewycky2011-12-021-27/+35
| | | | | | | | | | | | change, now you need a TargetOptions object to create a TargetMachine. Clang patch to follow. One small functionality change in PTX. PTX had commented out the machine verifier parts in their copy of printAndVerify. That now calls the version in LLVMTargetMachine. Users of PTX who need verification disabled should rely on not passing the command-line flag to enable it. llvm-svn: 145714
* land David Blaikie's patch to de-constify Type, with a few tweaks.Chris Lattner2011-07-181-8/+8
| | | | llvm-svn: 135375
* Minor code re-structuring.Evan Cheng2011-03-191-1/+1
| | | | llvm-svn: 127952
* Enable sibling call optimization of libcalls which are expanded duringEvan Cheng2010-11-301-0/+18
| | | | | | | | | | | legalization time. Since at legalization time there is no mapping from SDNode back to the corresponding LLVM instruction and the return SDNode is target specific, this requires a target hook to check for eligibility. Only x86 and ARM support this form of sibcall optimization right now. rdar://8707777 llvm-svn: 120501
* Inline asm multiple alternative constraints development phase 2 - improved ↵John Thompson2010-10-291-1/+1
| | | | | | basic logic, added initial platform support. llvm-svn: 117667
* ComputeLinearIndex doesn't need its TLI argument.Dan Gohman2010-10-061-5/+5
| | | | llvm-svn: 115792
* Using llvm.eh.catch.all.value instead of .llvm.eh.catch.all.value.Bill Wendling2010-07-261-1/+1
| | | | llvm-svn: 109462
* Split -enable-finite-only-fp-math to two options:Evan Cheng2010-07-151-1/+1
| | | | | | -enable-no-nans-fp-math and -enable-no-infs-fp-math. All of the current codegen fp math optimizations only care whether the fp arithmetics arguments and results can never be NaN. llvm-svn: 108465
* Move several SelectionDAG-independent utility functions out of theDan Gohman2010-04-211-0/+285
SelectionDAG directory and into a new Analysis.cpp file. llvm-svn: 101975
OpenPOWER on IntegriCloud