summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils
Commit message (Collapse)AuthorAgeFilesLines
* Convert assert(0) to llvm_unreachableCraig Topper2012-02-071-1/+1
| | | | llvm-svn: 149967
* [unwind removal] Remove all of the code for the dead 'unwind' instruction. ThereBill Wendling2012-02-062-51/+4
| | | | | | | were no 'unwind' instructions being generated before this, so this is in effect a no-op. llvm-svn: 149906
* [unwind removal] We no longer have 'unwind' instructions being generated, soBill Wendling2012-02-063-99/+4
| | | | | | remove the code that handles them. llvm-svn: 149901
* SwitchInst refactoring.Stepan Dyatkovskiy2012-02-016-50/+59
| | | | | | | | | | | | | | | | | The purpose of refactoring is to hide operand roles from SwitchInst user (programmer). If you want to play with operands directly, probably you will need lower level methods than SwitchInst ones (TerminatorInst or may be User). After this patch we can reorganize SwitchInst operands and successors as we want. What was done: 1. Changed semantics of index inside the getCaseValue method: getCaseValue(0) means "get first case", not a condition. Use getCondition() if you want to resolve the condition. I propose don't mix SwitchInst case indexing with low level indexing (TI successors indexing, User's operands indexing), since it may be dangerous. 2. By the same reason findCaseValue(ConstantInt*) returns actual number of case value. 0 means first case, not default. If there is no case with given value, ErrorIndex will returned. 3. Added getCaseSuccessor method. I propose to avoid usage of TerminatorInst::getSuccessor if you want to resolve case successor BB. Use getCaseSuccessor instead, since internal SwitchInst organization of operands/successors is hidden and may be changed in any moment. 4. Added resolveSuccessorIndex and resolveCaseIndex. The main purpose of these methods is to see how case successors are really mapped in TerminatorInst. 4.1 "resolveSuccessorIndex" was created if you need to level down from SwitchInst to TerminatorInst. It returns TerminatorInst's successor index for given case successor. 4.2 "resolveCaseIndex" converts low level successors index to case index that curresponds to the given successor. Note: There are also related compatability fix patches for dragonegg, klee, llvm-gcc-4.0, llvm-gcc-4.2, safecode, clang. llvm-svn: 149481
* s/getInnerUnwindDest/getInnerResumeDest/gBill Wendling2012-01-311-4/+4
| | | | llvm-svn: 149328
* Remove ivar which is identical to another ivar.Bill Wendling2012-01-311-10/+6
| | | | llvm-svn: 149323
* Remove unused ivars and s/getOuterUnwindDest/getOuterResumeDest/g.Bill Wendling2012-01-311-9/+4
| | | | llvm-svn: 149322
* Remove more dead functions.Bill Wendling2012-01-311-211/+0
| | | | llvm-svn: 149318
* s/getInnerUnwindDestNewEH/getInnerUnwindDest/gBill Wendling2012-01-311-4/+3
| | | | llvm-svn: 149317
* Remove some unused, old-EH methods.Bill Wendling2012-01-311-116/+3
| | | | llvm-svn: 149316
* Get rid of references to dead intrinsics.Bill Wendling2012-01-311-53/+5
| | | | | | | The eh.selector and eh.resume intrinsics aren't used anymore. Get rid of some calls to them. llvm-svn: 149314
* Formatting cleanups. No functionality change.Bill Wendling2012-01-311-20/+20
| | | | llvm-svn: 149312
* Remove no-longer-useful dyn_casts and pals.Bill Wendling2012-01-311-21/+10
| | | | llvm-svn: 149307
* Gracefully degrade precision in branch probability numbers.Nick Lewycky2012-01-251-17/+72
| | | | llvm-svn: 148946
* Actually, this code handles wrapped sets just fine. Noticed by inspection.Nick Lewycky2012-01-191-3/+1
| | | | llvm-svn: 148487
* Remove unreachable code. (replace with llvm_unreachable to help GCC where ↵David Blaikie2012-01-172-2/+0
| | | | | | necessary) llvm-svn: 148284
* Fix SpeculativelyExecuteBB to either speculate all or none of the phisDan Gohman2012-01-051-140/+148
| | | | | | | | | | | | present in the bottom of the CFG triangle, as the transformation isn't ever valuable if the branch can't be eliminated. Also, unify some heuristics between SimplifyCFG's multiple if-converters, for consistency. This fixes rdar://10627242. llvm-svn: 147630
* Revert r56315. When the instruction to speculate is a load, thisDan Gohman2012-01-051-26/+2
| | | | | | | | code can incorrectly move the load across a store. This never happens in practice today, but only because the current heuristics accidentally preclude it. llvm-svn: 147623
* Demystify this comment.Nick Lewycky2011-12-281-5/+16
| | | | llvm-svn: 147307
* Use false not zero, as a bool.Nick Lewycky2011-12-271-2/+2
| | | | llvm-svn: 147292
* Teach simplifycfg to recompute branch weights when merging some branches, andNick Lewycky2011-12-271-0/+67
| | | | | | | to discard weights when appropriate. Still more to do (and a new TODO), but it's a start! llvm-svn: 147286
* Update the branch weight metadata when reversing the order of a branch.Nick Lewycky2011-12-261-4/+1
| | | | llvm-svn: 147280
* Sort includes, canonicalize whitespace, fix typos. No functionality change.Nick Lewycky2011-12-261-12/+12
| | | | llvm-svn: 147279
* When not destroying the source, the linker is not remapping the types. Added ↵Mon P Wang2011-12-231-2/+4
| | | | | | | | support to CloneFunctionInto to allow remapping for this case. llvm-svn: 147217
* Make some intrinsics safe to speculatively execute.Nick Lewycky2011-12-211-0/+1
| | | | llvm-svn: 147036
* Unweaken vtables as per ↵David Blaikie2011-12-201-0/+2
| | | | | | http://llvm.org/docs/CodingStandards.html#ll_virtual_anch llvm-svn: 146960
* - Use getExitingBlock instead of getExitingBlocks.Jakub Staszak2011-12-181-13/+11
| | | | | | - Remove trailing spaces. llvm-svn: 146854
* Revert r146822 at Pete Cooper's request as it broke clang self hosting.Kevin Enderby2011-12-171-42/+0
| | | | | | Hope I did this correctly :) llvm-svn: 146834
* SimplifyCFG now predicts some conditional branches to true or false ↵Pete Cooper2011-12-171-0/+42
| | | | | | | | | | | | | depending on previous branch on same comparison operands. For example, if (a == b) { if (a > b) // this is false Fixes some of the issues on <rdar://problem/10554090> llvm-svn: 146822
* Refactor code used in InstCombine::FoldAndOfICmps to new file.Pete Cooper2011-12-172-0/+98
| | | | | | This will be used by SimplifyCfg in a later commit. llvm-svn: 146803
* Avoid a confusing assert for silly options: -unroll-runtime -unroll-count=1.Andrew Trick2011-12-161-0/+5
| | | | | | No need for an explicit test case for an unsupported combination of options. llvm-svn: 146721
* [asan] fix a bug (issue 19) where dlclose and the following mmap caused a ↵Kostya Serebryany2011-12-151-4/+12
| | | | | | false positive. compiler part. llvm-svn: 146688
* Make loop preheader insertion in LoopSimplify handle the case where the loop ↵Eli Friedman2011-12-151-16/+34
| | | | | | header is a landing pad correctly (by splitting the landingpad out of the loop header). Make some adjustments to the rest of LoopSimplify to make it clear that the rest of LoopSimplify isn't making bad assumptions about the presence of landing pads. PR11575. llvm-svn: 146621
* Move Instruction::isSafeToSpeculativelyExecute out of VMCore andDan Gohman2011-12-141-2/+2
| | | | | | | | | 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
* LLVMBuild: Remove trailing newline, which irked me.Daniel Dunbar2011-12-121-1/+0
| | | | llvm-svn: 146409
* SplitBlockPredecessors uses ArrayRef instead of Data and Size.Jakub Staszak2011-12-094-21/+12
| | | | llvm-svn: 146277
* Add -unroll-runtime for unrolling loops with run-time trip counts.Andrew Trick2011-12-093-7/+398
| | | | | | | | | | | | | Patch by Brendon Cahoon! This extends the existing LoopUnroll and LoopUnrollPass. Brendon measured no regressions in the llvm test suite with -unroll-runtime enabled. This implementation works by using the existing loop unrolling code to unroll the loop by a power-of-two (default 8). It generates an if-then-else sequence of code prior to the loop to execute the extra iterations before entering the unrolled loop. llvm-svn: 146245
* Simplify common predecessor finding.Benjamin Kramer2011-12-061-24/+10
| | | | | | | | | | | | - Walking over pred_begin/pred_end is an expensive operation. - PHINodes contain a value for each predecessor anyway. - While it may look like we used to save a few iterations with the set, be aware that getIncomingValueForBlock does a linear search on the values of the phi node. - Another -5% on ARMDisassembler.cpp (Release build). This was the last entry in the profile that was obviously wasting time. llvm-svn: 145937
* Add a little heuristic to Value::isUsedInBasicBlock to speed it up for small ↵Benjamin Kramer2011-12-051-8/+1
| | | | | | | | | | basic blocks. - Calling getUser in a loop is much more expensive than iterating over a few instructions. - Use it instead of the open-coded loop in AddrModeMatcher. - 5% speedup on ARMDisassembler.cpp Release builds. llvm-svn: 145810
* Fix quadratic behavior in InlineFunction by fetching the personality ↵Benjamin Kramer2011-12-021-29/+33
| | | | | | | | | | function of the callee once and not for every invoke in the caller. The callee is usually smaller than the caller, too. This reduces the compile time of ARMDisassembler.cpp by 32% (Release build). It still takes ages to compile though. llvm-svn: 145690
* 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
OpenPOWER on IntegriCloud