summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/Analysis.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Move shouldAssumeDSOLocal to Target.Rafael Espindola2016-06-271-42/+0
| | | | | | Should fix the shared library build. llvm-svn: 273958
* Teach shouldAssumeDSOLocal about tls.Rafael Espindola2016-06-271-20/+19
| | | | | | Fixes a fixme about handling other visibilities. llvm-svn: 273921
* IR: Introduce local_unnamed_addr attribute.Peter Collingbourne2016-06-141-16/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a local_unnamed_addr attribute is attached to a global, the address is known to be insignificant within the module. It is distinct from the existing unnamed_addr attribute in that it only describes a local property of the module rather than a global property of the symbol. This attribute is intended to be used by the code generator and LTO to allow the linker to decide whether the global needs to be in the symbol table. It is possible to exclude a global from the symbol table if three things are true: - This attribute is present on every instance of the global (which means that the normal rule that the global must have a unique address can be broken without being observable by the program by performing comparisons against the global's address) - The global has linkonce_odr linkage (which means that each linkage unit must have its own copy of the global if it requires one, and the copy in each linkage unit must be the same) - It is a constant or a function (which means that the program cannot observe that the unique-address rule has been broken by writing to the global) Although this attribute could in principle be computed from the module contents, LTO clients (i.e. linkers) will normally need to be able to compute this property as part of symbol resolution, and it would be inefficient to materialize every module just to compute it. See: http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160509/356401.html http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160516/356738.html for earlier discussion. Part of the fix for PR27553. Differential Revision: http://reviews.llvm.org/D20348 llvm-svn: 272709
* Use shouldAssumeDSOLocal on AArch64.Rafael Espindola2016-05-261-0/+43
| | | | | | This reduces code duplication and now AArch64 also handles PIE. llvm-svn: 270844
* One more batch of self-containing headers.Benjamin Kramer2016-01-271-1/+0
| | | | llvm-svn: 258974
* [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
* Don't try to check all uses if lazy loading.Rafael Espindola2016-01-151-0/+5
| | | | | | | | | | | This means that LTO_SYMBOL_SCOPE_DEFAULT_CAN_BE_HIDDEN will not be set in a few cases. This should have no impact in ld64 since it doesn't use lazy loading when merging modules and that is when it checks LTO_SYMBOL_SCOPE_DEFAULT_CAN_BE_HIDDEN. llvm-svn: 257915
* Remove assert(false) in favor of asserting the if conditional it is ↵David Blaikie2015-10-261-8/+5
| | | | | | | | contained within. Also adjust the code to avoid 3 redundant map lookups. llvm-svn: 251327
* CodeGen: Remove implicit conversions from Analysis and BranchFoldingDuncan P. N. Exon Smith2015-10-091-2/+2
| | | | | | | | | | | | Remove a few more implicit ilist iterator conversions, this time from Analysis.cpp and BranchFolding.cpp. I added a few overloads for `remove()` and `erase()`, which quite naturally take pointers as well as iterators as parameters. This will reduce the churn at least in the short term, but I don't really have a problem with these existing for longer. llvm-svn: 249867
* [WinEH] Update CATCHRET's operand to match its successorDavid Majnemer2015-10-051-7/+21
| | | | | | | | | | | | The CATCHRET operand did not match the MachineFunction's CFG. This mismatch happened because FrameLowering created a new MachineBasicBlock and updated the CFG but forgot to update the CATCHRET operand. Let's make sure this doesn't happen again by strengthing the funclet membership analysis: it can now reason about the membership of all basic blocks, not just those inside of funclets. llvm-svn: 249344
* [WinEH] Permit branch folding in the face of funcletsDavid Majnemer2015-10-041-0/+85
| | | | | | | | Track which basic blocks belong to which funclets. Permit branch folding to fire but only if it can prove that doing so will not cause code in one funclet to be reused in another. llvm-svn: 249257
* Revert r246232 and r246304.David Majnemer2015-08-281-10/+12
| | | | | | | | | This reverts isSafeToSpeculativelyExecute's use of ReadNone until we split ReadNone into two pieces: one attribute which reasons about how the function reasons about memory and another attribute which determines how it may be speculated, CSE'd, trap, etc. llvm-svn: 246331
* [CodeGen] isInTailCallPosition didn't consider readnone tailcallsDavid Majnemer2015-08-281-12/+10
| | | | | | | | | | A readnone tailcall may still have a chain of computation which follows it that would invalidate a tailcall lowering. Don't skip the analysis in such cases. This fixes PR24613. llvm-svn: 246304
* Make TargetLowering::getPointerTy() taking DataLayout as an argumentMehdi Amini2015-07-091-10/+13
| | | | | | | | | | | | | | | | Summary: This change is part of a series of commits dedicated to have a single DataLayout during compilation by using always the one owned by the module. Reviewers: echristo Subscribers: jholewinski, ted, yaron.keren, rafael, llvm-commits Differential Revision: http://reviews.llvm.org/D11028 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 241775
* Redirect DataLayout from TargetMachine to Module in ComputeValueVTs()Mehdi Amini2015-07-091-6/+6
| | | | | | | | | | | | | | | | | | | | Summary: Avoid using the TargetMachine owned DataLayout and use the Module owned one instead. This requires passing the DataLayout up the stack to ComputeValueVTs(). This change is part of a series of commits dedicated to have a single DataLayout during compilation by using always the one owned by the module. Reviewers: echristo Subscribers: jholewinski, yaron.keren, rafael, llvm-commits Differential Revision: http://reviews.llvm.org/D11019 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 241773
* CodeGen: move over-zealous assert into actual if statement.Tim Northover2015-05-061-3/+2
| | | | | | | | | | | | | | | It's quite possible to encounter an insertvalue instruction that's more deeply nested than the value we're looking for, but when that happens we really mustn't compare beyond the end of the index array. Since I couldn't see any guarantees about what comparisons std::equal makes, we probably need to directly check the size beforehand. In practice, I suspect most std::equal implementations would probably bail early, which would be OK. But just in case... rdar://20834485 llvm-svn: 236635
* CodeGen: match up correct insertvalue indices when assessing tail calls.Tim Northover2015-05-041-1/+2
| | | | | | | | | | | | When deciding whether a value comes from the aggregate or inserted value of an insertvalue instruction, we compare the indices against those of the location we're interested in. One of the lists needs reversing because the input data is backwards (so that modifications take place at the end of the SmallVector), but we were reversing both before leading to incorrect results. Should fix PR23408 llvm-svn: 236457
* Replace std::copy with a back inserter with vector append where feasibleBenjamin Kramer2015-02-281-6/+3
| | | | | | | | | All of the cases were just appending from random access iterators to a vector. Using insert/append can grow the vector to the perfect size directly and moves the growing out of the loop. No intended functionalty change. llvm-svn: 230845
* Get the function specific subtarget.Eric Christopher2015-02-201-1/+2
| | | | llvm-svn: 230038
* Add assertions for out of bound index in ComputeLinearIndexMehdi Amini2015-01-141-2/+3
| | | | llvm-svn: 225951
* Fold a loop for array processing in ComputeLinearIndexMehdi Amini2015-01-141-8/+13
| | | | | | | | | | When processing an array, every Elt has the same layout, it is useless to recursively call each ComputeLinearIndex on each element. Just do it once and multiply by the number of elements. Differential Revision: http://reviews.llvm.org/D6832 llvm-svn: 225949
* Allow the use of functions as typeinfo in landingpad clausesReid Kleckner2014-11-141-6/+7
| | | | | | This is one step towards supporting SEH filter functions in LLVM. llvm-svn: 221954
* Remove the TargetMachine forwards for TargetSubtargetInfo basedEric Christopher2014-08-041-2/+4
| | | | | | information and update all callers. No functional change. llvm-svn: 214781
* Refactor duplicated code.Rafael Espindola2014-07-301-0/+27
| | | | llvm-svn: 214328
* 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
OpenPOWER on IntegriCloud