summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Make use of the exact bit when optimizing '(X >>exact 3) << 1' to eliminate theNick Lewycky2011-12-311-5/+11
| | | | | | | 'and' that would zero out the trailing bits, and to produce an exact shift ourselves. llvm-svn: 147391
* Change CaptureTracking to pass a Use* instead of a Value* when a value isNick Lewycky2011-12-281-5/+222
| | | | | | | | | | | | | | captured. This allows the tracker to look at the specific use, which may be especially interesting for function calls. Use this to fix 'nocapture' deduction in FunctionAttrs. The existing one does not iterate until a fixpoint and does not guarantee that it produces the same result regardless of iteration order. The new implementation builds up a graph of how arguments are passed from function to function, and uses a bottom-up walk on the argument-SCCs to assign nocapture. This gets us nocapture more often, and does so rather efficiently and independent of iteration order. llvm-svn: 147327
* 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
* Turn cos(-x) into cos(x). Patch by Alexander Malyshev!Nick Lewycky2011-12-271-5/+27
| | | | llvm-svn: 147291
* 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
* Fix warning.Rafael Espindola2011-12-261-1/+2
| | | | llvm-svn: 147284
* 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
* InstCombine: Add a combine that turns (2^n)-1 ^ x back into (2^n)-1 - x iff ↵Benjamin Kramer2011-12-241-0/+13
| | | | | | | | | x is smaller than 2^n and it fuses with a following add. This was intended to undo the sub canonicalization in cases where it's not profitable, but it also finds some cases on it's own. llvm-svn: 147256
* InstCombine: Canonicalize (2^n)-1 - x into (2^n)-1 ^ x iff x is known to be ↵Benjamin Kramer2011-12-242-0/+14
| | | | | | | | | | | smaller than 2^n. This has the obvious advantage of being commutable and is always a win on x86 because const - x wastes a register there. On less weird architectures this may lead to a regression because other arithmetic doesn't fuse with it anymore. I'll address that problem in a followup. llvm-svn: 147254
* Fix typo "infinte".Nick Lewycky2011-12-231-1/+2
| | | | llvm-svn: 147226
* 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
* Add the actual code for r147175.Chad Rosier2011-12-221-11/+82
| | | | llvm-svn: 147176
* Speculatively revert r146578 to determine if it is the cause of a number ofChad Rosier2011-12-221-82/+11
| | | | | | | | | | | performance regressions (both execution-time and compile-time) on our nightly testers. Original commit message: Fix for bug #11429: Wrong behaviour for switches. Small improvement for code size heuristics. llvm-svn: 147131
* Fix a copy+pasto. No testcase, because the symptoms of dereferencingDan Gohman2011-12-211-1/+1
| | | | | | an invalid iterator aren't reproducible. rdar://10614085. llvm-svn: 147098
* 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-173-72/+109
| | | | | | This will be used by SimplifyCfg in a later commit. llvm-svn: 146803
* The powers that be have decided that LLVM IR should now support 16-bitDan Gohman2011-12-172-1/+6
| | | | | | | | "half precision" floating-point with a first-class type. This patch adds basic IR support (but not codegen support). llvm-svn: 146786
* 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] add the name of the module to the description of a global variable. ↵Kostya Serebryany2011-12-151-1/+5
| | | | | | This improves the readability of global-buffer-overflow reports. llvm-svn: 146698
* [asan] fix a bug (issue 19) where dlclose and the following mmap caused a ↵Kostya Serebryany2011-12-152-5/+32
| | | | | | false positive. compiler part. llvm-svn: 146688
* Added InstCombine for "select cond, ~cond, x" type patternsPete Cooper2011-12-151-0/+7
| | | | | | These can be reduced to "~cond & x" or "~cond | x" llvm-svn: 146624
* 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-143-4/+6
| | | | | | | | | 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
* Fix for bug #11429: Wrong behaviour for switches. Small improvement for code ↵Stepan Dyatkovskiy2011-12-141-11/+82
| | | | | | size heuristics. llvm-svn: 146578
* It turns out that clang does use pointer-to-function types toDan Gohman2011-12-141-2/+6
| | | | | | point to ARC-managed pointers sometimes. This fixes rdar://10551239. llvm-svn: 146577
* [asan] remove .preinit_array from the compiler module (it breaks .so ↵Kostya Serebryany2011-12-141-16/+0
| | | | | | builds). This should be done in the run-time. llvm-svn: 146527
* [asan] report an error if blacklist file contains a malformed regex. fixes ↵Kostya Serebryany2011-12-131-5/+13
| | | | | | asan issue 17 llvm-svn: 146503
* Cleanup. Clarify LSRInstance public methods.Andrew Trick2011-12-131-1/+1
| | | | llvm-svn: 146459
* Indvars: guard against exponential behavior in isHighCostExpansion.Andrew Trick2011-12-121-2/+7
| | | | | | | | This should always be done as a matter of principal. I don't have a case that exposes the problem. I just noticed this recently while scanning the code and realized I meant to fix it long ago. llvm-svn: 146438
* LLVMBuild: Introduce a common section which currently has a list of theDaniel Dunbar2011-12-121-0/+3
| | | | | | | | | | | subdirectories to traverse into. - Originally I wanted to avoid this and just autoscan, but this has one key flaw in that new subdirectories can not automatically trigger a rerun of the llvm-build tool. This is particularly a pain when switching back and forth between trees where one has added a subdirectory, as the dependencies will tend to be wrong. This will also eliminates FIXME implicitly. llvm-svn: 146436
* Only replace fwrite with fputc, if the return value is unused.Joerg Sonnenberger2011-12-121-1/+2
| | | | llvm-svn: 146411
* LLVMBuild: Remove trailing newline, which irked me.Daniel Dunbar2011-12-126-6/+0
| | | | llvm-svn: 146409
* When computing reverse-CFG reverse-post-order, skip backedges, asDan Gohman2011-12-121-38/+94
| | | | | | | | | | | | | detected in the forward-CFG DFS. This prevents the reverse-CFG from visiting blocks inside loops after blocks that dominate them in the case where loops have multiple exits. No testcase, because this fixes a bug which in practice only shows up in a full optimizer run, due to the use-list order. This fixes rdar://10422791 and others. llvm-svn: 146408
* Add a TODO comment.Dan Gohman2011-12-121-0/+1
| | | | llvm-svn: 146389
* Fix a copy+pasto in a comment.Dan Gohman2011-12-121-1/+1
| | | | llvm-svn: 146385
* Use getArgOperand instead of getOperand on a call.Dan Gohman2011-12-121-1/+1
| | | | llvm-svn: 146384
* Inline SetSeqToRelease into its only caller, since it's more clear that way.Dan Gohman2011-12-121-11/+4
| | | | llvm-svn: 146383
* Fix omitted break statements in a switch.Dan Gohman2011-12-121-0/+2
| | | | llvm-svn: 146380
* [asan] use .preinit_array only on linuxKostya Serebryany2011-12-121-2/+3
| | | | llvm-svn: 146379
* Switch llvm.cttz and llvm.ctlz to accept a second i1 parameter whichChandler Carruth2011-12-121-1/+1
| | | | | | | | | | | | | | | | | | | | indicates whether the intrinsic has a defined result for a first argument equal to zero. This will eventually allow these intrinsics to accurately model the semantics of GCC's __builtin_ctz and __builtin_clz and the X86 instructions (prior to AVX) which implement them. This patch merely sets the stage by extending the signature of these intrinsics and establishing auto-upgrade logic so that the old spelling still works both in IR and in bitcode. The upgrade logic preserves the existing (inefficient) semantics. This patch should not change any behavior. CodeGen isn't updated because it can use the existing semantics regardless of the flag's value. Note that this will be followed by API updates to Clang and DragonEgg. Reviewed by Nick Lewycky! llvm-svn: 146357
* LSR: ignore strides in outer loops.Andrew Trick2011-12-101-1/+2
| | | | | | | | Since we're not rewriting IVs in other loops, there's not much reason to consider their stride when generating formulae. This should reduce the number of useless formulas considered by LSR. llvm-svn: 146302
* [asan] call __asan_init from .preinit_array. This simplifies __asan_init vs ↵Kostya Serebryany2011-12-091-0/+15
| | | | | | malloc chicken-and-egg situation on Android and probably on other flavours of Linux. Patch by eugenis@google.com. llvm-svn: 146284
* SplitBlockPredecessors uses ArrayRef instead of Data and Size.Jakub Staszak2011-12-096-29/+16
| | | | llvm-svn: 146277
* Add -unroll-runtime for unrolling loops with run-time trip counts.Andrew Trick2011-12-094-14/+426
| | | | | | | | | | | | | 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
OpenPOWER on IntegriCloud