summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils
Commit message (Collapse)AuthorAgeFilesLines
* Propagate TargetLibraryInfo throughout ConstantFolding.cpp and Chad Rosier2011-12-013-6/+12
| | | | | | | InstructionSimplify.cpp. Other fixups as needed. Part of rdar://10500969 llvm-svn: 145559
* build/CMake: Finish removal of add_llvm_library_dependencies.Daniel Dunbar2011-11-291-8/+0
| | | | llvm-svn: 145420
* Fix a theoretical problem (not seen in the wild): if different instances of aDuncan Sands2011-11-291-0/+4
| | | | | | | | | | | | | | | weak variable are compiled by different compilers, such as GCC and LLVM, while LLVM may increase the alignment to the preferred alignment there is no reason to think that GCC will use anything more than the ABI alignment. Since it is the GCC version that might end up in the final program (as the linkage is weak), it is wrong to increase the alignment of loads from the global up to the preferred alignment as the alignment might only be the ABI alignment. Increasing alignment up to the ABI alignment might be OK, but I'm not totally convinced that it is. It seems better to just leave the alignment of weak globals alone. llvm-svn: 145413
* Refactor code to use new attribute getters on CallSite for NoCapture and ByVal.Nick Lewycky2011-11-201-1/+1
| | | | | | | | Suggested in code review by Eli. That code in InstCombine looks kinda suspicious. llvm-svn: 145013
* Fix an overly general check in SimplifyIndvar to handle useless phi cycles.Andrew Trick2011-11-171-2/+2
| | | | | | | | | | | | | | The right way to check for a binary operation is cast<BinaryOperator>. The original check: cast<Instruction> && numOperands() == 2 would match phi "instructions", leading to an infinite loop in extreme corner case: a useless phi with operands [self, constant] that prior optimization passes failed to remove, being used in the loop by another useless phi, in turn being used by an lshr or udiv. Fixes PR11350: runaway iteration assertion. llvm-svn: 144935
* Add support for custom names for library functions in TargetLibraryInfo. ↵Eli Friedman2011-11-171-6/+12
| | | | | | | | | | Add a custom name for fwrite and fputs on x86-32 OSX. Make SimplifyLibCalls honor the custom names for fwrite and fputs. Fixes <rdar://problem/9815881>. llvm-svn: 144876
* test commit to verify that commit access works (added blank line)Kostya Serebryany2011-11-161-0/+1
| | | | llvm-svn: 144748
* StringRefize and simplify.Benjamin Kramer2011-11-151-11/+9
| | | | llvm-svn: 144675
* Make headers standalone, move a virtual method out of line.Benjamin Kramer2011-11-141-0/+7
| | | | llvm-svn: 144536
* LLVMBuild: Alphabetize required_libraries lists.Daniel Dunbar2011-11-111-1/+1
| | | | llvm-svn: 144416
* Make sure we don't insert instructions before a landingpad instruction.Bill Wendling2011-11-071-2/+2
| | | | | | <rdar://problem/10405911> llvm-svn: 144000
* build: Add initial cut at LLVMBuild.txt files.Daniel Dunbar2011-11-031-0/+23
| | | | llvm-svn: 143634
* Add utility to append a function to the list of global constructors. Devang Patel2011-10-312-0/+56
| | | | | | Patch by Kostya Serebryany. llvm-svn: 143405
* A dead malloc, a free(NULL) and a free(undef) are all trivially deadNick Lewycky2011-10-241-0/+8
| | | | | | | | | | instructions. This doesn't introduce any optimizations we weren't doing before (except potentially due to pass ordering issues), now passes will eliminate them sooner as part of their own cleanups. llvm-svn: 142787
* Remap blockaddress correctly when inlining a function. Fixes PR10162.Eli Friedman2011-10-211-1/+32
| | | | llvm-svn: 142684
* Refactor code from inlining and globalopt that checks whether a function ↵Eli Friedman2011-10-201-2/+2
| | | | | | definition is unused, and enhance it so it can tell that functions which are only used by a blockaddress are in fact dead. This probably doesn't happen much on most code, but the Linux kernel's _THIS_IP_ can trigger this issue with blockaddress. (GlobalDCE can also handle the given tescase, but we only run that at -O3.) Found while looking at PR11180. llvm-svn: 142572
* Add a proper LLVM banner to this file.Chandler Carruth2011-10-161-0/+13
| | | | llvm-svn: 142162
* Add a natural stack alignment field to TargetData, and prevent InstCombine fromLang Hames2011-10-101-2/+6
| | | | | | | | | | | | | | promoting allocas to preferred alignments that exceed the natural alignment. This avoids some potentially expensive dynamic stack realignments. The natural stack alignment is set in target data strings via the "S<size>" option. Size is in bits and must be a multiple of 8. The natural stack alignment defaults to "unspecified" (represented by a zero value), and the "unspecified" value does not prevent any alignment promotions. Target maintainers that care about avoiding promotions should explicitly add the "S<size>" option to their target data strings. llvm-svn: 141599
* LSR should avoid redundant edge splitting.Andrew Trick2011-10-041-2/+3
| | | | | | | | This handles the case in which LSR rewrites an IV user that is a phi and splits critical edges originating from a switch. Fixes <rdar://problem/6453893> LSR is not splitting edges "nicely" llvm-svn: 141059
* whitespaceAndrew Trick2011-10-041-18/+18
| | | | llvm-svn: 141058
* Enhance a couple places where we were doing constant folding of instructions,Nick Lewycky2011-10-021-6/+2
| | | | | | but not load instructions. Noticed by inspection. llvm-svn: 140966
* Clean up uses of switch instructions so they are not dependent on the ↵Eli Friedman2011-09-291-2/+2
| | | | | | operand ordering. Patch by Stepan Dyatkovskiy. llvm-svn: 140803
* Stop emitting instructions with the name "tmp" they eat up memory and have ↵Benjamin Kramer2011-09-271-2/+1
| | | | | | | | to be uniqued, without any benefit. If someone prefers %tmp42 to %42, run instnamer. llvm-svn: 140634
* Relax this condition.Bill Wendling2011-09-201-2/+1
| | | | | | | Some passes require breaking critical edges before they're called. Don't segfault because of that. llvm-svn: 140196
* Use ArrayRef instead of an explicit 'const std::vector &'.Bill Wendling2011-09-201-3/+3
| | | | llvm-svn: 140172
* Use ArrayRef instead of 'const std::vector' to pass around the list of basic ↵Bill Wendling2011-09-201-8/+10
| | | | | | blocks to extract. llvm-svn: 140168
* Fix comments.Bill Wendling2011-09-201-4/+4
| | | | llvm-svn: 140164
* Revert r140083 and r140084 until buildbots can be fixed.Bill Wendling2011-09-191-8/+1
| | | | llvm-svn: 140094
* If we are extracting a basic block that ends in an invoke call, we must alsoBill Wendling2011-09-191-1/+8
| | | | | | | | | | extract the landing pad block. Otherwise, there will be a situation where the invoke's unwind edge lands on a non-landing pad. We also forbid the user from extracting the landing pad block by itself. Again, this is not a valid transformation. llvm-svn: 140083
* [indvars] Fix PR10946: SCEV cannot handle Vector IVs.Andrew Trick2011-09-191-0/+6
| | | | llvm-svn: 140026
* Delete trivial landing pads that just continue unwinding the caughtDuncan Sands2011-09-051-0/+49
| | | | | | exception. llvm-svn: 139117
* Address review comments.Benjamin Kramer2011-08-261-9/+8
| | | | | | | | - Reword comments. - Allow undefined behavior interfering with undefined behavior. - Add address space checks. llvm-svn: 138619
* SimplifyCFG: If we have a PHI node that can evaluate to NULL and do a load ↵Benjamin Kramer2011-08-261-0/+69
| | | | | | | | | | or store to the address returned by the PHI node then we can consider this incoming value as dead and remove the edge pointing there, unless there are instructions that can affect control flow executed in between. In theory this could be extended to other instructions, eg. division by zero, but it's likely that it will "miscompile" some code because people depend on div by zero not trapping. NULL pointer dereference usually leads to a crash so we should be on the safe side. This shrinks the size of a Release clang by 16k on x86_64. llvm-svn: 138618
* When inserting new instructions, use getFirstInsertionPt instead ofBill Wendling2011-08-251-4/+4
| | | | | | getFirstNonPHI so that it will skip over the landingpad instructions as well. llvm-svn: 138537
* Fix a crashing bug in SplitBlock when it is called on a block with noRafael Espindola2011-08-241-5/+6
| | | | | | | | dominator information even though dominators were previously computed. Patch by Nick Sumner. llvm-svn: 138449
* If we're splitting the landing pad block and assigning it only one predecessor,Bill Wendling2011-08-191-26/+40
| | | | | | then don't split it a second time, since that block will be dead. llvm-svn: 138153
* Intelligently split the landing pad block.Bill Wendling2011-08-191-5/+16
| | | | | | | | | | We have to be careful when splitting the landing pad block, because the landingpad instruction is required to remain as the first non-PHI of an invoke's unwind edge. To retain this, we split the block into two blocks, moving the predecessors within the loop to one block and the remaining predecessors to the other. The landingpad instruction is cloned into the new blocks. llvm-svn: 138015
* Add SplitLandingPadPredecessors().Bill Wendling2011-08-191-1/+95
| | | | | | | | | | | | | | | | SplitLandingPadPredecessors is similar to SplitBlockPredecessors in that it splits the current block and attaches a set of predecessors to the new basic block. However, it differs from SplitBlockPredecessors in that it's specifically designed to handle landing pad blocks. Two new basic blocks are created: one that is has the vector of predecessors as its predecessors and one that has the remaining predecessors as its predecessors. Those two new blocks then receive a cloned copy of the landingpad instruction from the original block. The landingpad instructions are joined in a PHI, etc. Like SplitBlockPredecessors, it updates the LLVM IR, AliasAnalysis, DominatorTree, DominanceFrontier, LoopInfo, and LCCSA analyses. llvm-svn: 138014
* Revert r137871. The loop simplify pass should require all exits from a loop thatBill Wendling2011-08-181-15/+3
| | | | | | aren't from an indirect branch need to be dominated by the loop header. llvm-svn: 137981
* Split out the updating of PHI nodes after splitting the BB into a separateBill Wendling2011-08-181-43/+53
| | | | | | function. llvm-svn: 137979
* Use this fantzy ArrayRef thing to pass in the list of predecessors.Bill Wendling2011-08-181-9/+14
| | | | llvm-svn: 137978
* Use static instead of anonymous namespace.Bill Wendling2011-08-181-7/+4
| | | | llvm-svn: 137959
* Split out the analysis updating code into a helper function. No intendedBill Wendling2011-08-181-63/+78
| | | | | | functionality change. llvm-svn: 137926
* Increment the insertion iterator to beyond the landingpad instruction.Bill Wendling2011-08-171-1/+1
| | | | llvm-svn: 137872
* Don't optimize the landing pad exit block.Bill Wendling2011-08-171-4/+18
| | | | | | | | One way to exit the loop is through an unwind edge. However, that may involve splitting the critical edge of the landing pad, which is non-trivial. Prevent the transformation from rewriting the landing pad exit loop block. llvm-svn: 137871
* Assert that we aren't trying to split the critical edge of a landing pad. DoingBill Wendling2011-08-171-0/+5
| | | | | | so requires more care than this generic algorithm should handle. llvm-svn: 137866
* I think there was some confusion about what I meant. :-) Replacing the comment.Bill Wendling2011-08-161-1/+4
| | | | llvm-svn: 137743
* After talking with Bill, it seems like the LandingPad handling here is likelyEli Friedman2011-08-161-4/+1
| | | | | | to be wrong (or at least somewhat suspect). Leave a FIXME for Bill. llvm-svn: 137694
* Minor comment fixes.Eli Friedman2011-08-161-1/+1
| | | | llvm-svn: 137693
* Update SimplifyCFG for atomic operations.Eli Friedman2011-08-151-10/+26
| | | | | | | | This commit includes a mention of the landingpad instruction, but it's not changing the behavior around it. I think the current behavior is correct, though. Bill, can you double-check that? llvm-svn: 137691
OpenPOWER on IntegriCloud