summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Use Nick's suggestion of storing a large NULL into the GV instead of memset, ↵Bill Wendling2012-09-131-18/+10
| | | | | | which requires TargetData. llvm-svn: 163799
* Fix Doxygen issues:Dmitri Gribenko2012-09-131-1/+4
| | | | | | | | * wrap code blocks in \code ... \endcode; * refer to parameter names in paragraphs correctly (\arg is not what most people want -- it starts a new paragraph). llvm-svn: 163790
* Introduce the __llvm_gcov_flush function.Bill Wendling2012-09-131-6/+56
| | | | | | | | | | This function writes out the current values of the counters and then resets them. This can be used similarly to the __gcov_flush function to sync the counters when need be. For instance, in a situation where the application doesn't exit. <rdar://problem/12185886> llvm-svn: 163757
* Detect overflow in the path count computation. rdar://12277446.Dan Gohman2012-09-121-0/+13
| | | | llvm-svn: 163739
* PGO: preserve branch-weight metadata when removing a case which jumpsManman Ren2012-09-121-0/+22
| | | | | | to the default target. llvm-svn: 163724
* Release build: guard dump functions withManman Ren2012-09-123-9/+9
| | | | | | | | "#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)" No functional change. Update r163344. llvm-svn: 163679
* SimplifyCFG: preserve branch-weight metadata when creating a new switch fromManman Ren2012-09-111-81/+45
| | | | | | | | | | | | | a pair of switch/branch where both depend on the value of the same variable and the default case of the first switch/branch goes to the second switch/branch. Code clean up and fixed a few issues: 1> handling the case where some cases of the 2nd switch are invalidated 2> correctly calculate the weight for the 2nd switch when it is a conditional eq Testing case is modified from Alastair's original patch. llvm-svn: 163635
* llvm/lib/Transforms/Utils/CMakeLists.txt: Update.NAKAMURA Takumi2012-09-111-0/+1
| | | | llvm-svn: 163593
* Add a pass that renames everything with metasyntatic names. This works well ↵Alex Rosenberg2012-09-112-0/+133
| | | | | | after using bugpoint to reduce the confusion presented by the original names, which no longer mean what they used to. llvm-svn: 163592
* Move bypassSlowDivision into the llvm namespace.Benjamin Kramer2012-09-101-4/+6
| | | | llvm-svn: 163503
* Fix style issues from r163302 pointed out by Evan.Hans Wennborg2012-09-101-18/+15
| | | | llvm-svn: 163491
* Move spaces to the right places. No functionality change.Nick Lewycky2012-09-091-4/+4
| | | | llvm-svn: 163485
* DSE: Poking holes into a SetVector is expensive, avoid it if possible.Benjamin Kramer2012-09-091-5/+5
| | | | llvm-svn: 163480
* Remove an incorrect assert during branch weight propagation.Andrew Trick2012-09-081-1/+0
| | | | | | Patch and test case by Alastair Murray! llvm-svn: 163437
* SimplifyCFG: ValidLookupTableConstant should be staticHans Wennborg2012-09-071-1/+1
| | | | llvm-svn: 163378
* Release build: guard dump functions with "ifndef NDEBUG"Manman Ren2012-09-063-0/+18
| | | | | | No functional change. llvm-svn: 163344
* Fix switch_to_lookup_table.ll test from r163302.Hans Wennborg2012-09-061-5/+6
| | | | | | | | The lookup tables did not get built in a deterministic order. This makes them get built in the order that the corresponding phi nodes were found. llvm-svn: 163305
* Build lookup tables for switches (PR884)Hans Wennborg2012-09-061-0/+286
| | | | | | | | | | | | | | | | | | | | | | This adds a transformation to SimplifyCFG that attemps to turn switch instructions into loads from lookup tables. It works on switches that are only used to initialize one or more phi nodes in a common successor basic block, for example: int f(int x) { switch (x) { case 0: return 5; case 1: return 4; case 2: return -2; case 5: return 7; case 6: return 9; default: return 42; } This speeds up the code by removing the hard-to-predict jump, and reduces code size by removing the code for the jump targets. llvm-svn: 163302
* Update function names to conform to guidelines.Jim Grosbach2012-09-061-26/+26
| | | | | | No functional change. llvm-svn: 163279
* Stop casting away const qualifier needlessly.Roman Divacky2012-09-051-2/+2
| | | | llvm-svn: 163258
* [asan] fix lintKostya Serebryany2012-09-051-1/+1
| | | | llvm-svn: 163205
* [asan] extend the blacklist functionality to handle global-init. Patch by ↵Kostya Serebryany2012-09-053-1/+11
| | | | | | Reid Watson llvm-svn: 163199
* Make provenance checking conservative in cases whenDan Gohman2012-09-041-37/+42
| | | | | | | | pointers-to-strong-pointers may be in play. These can lead to retains and releases happening in unstructured ways, foiling the optimizer. This fixes rdar://12150909. llvm-svn: 163180
* BypassSlowDivision: Assign to reference, don't copy the object.Jakub Staszak2012-09-041-2/+2
| | | | llvm-svn: 163179
* Fix my previous patch (r163164). It does now what it is supposed to do:Jakub Staszak2012-09-041-1/+0
| | | | | | Doesn't set MadeChange to TRUE if BypassSlowDivision doesn't change anything. llvm-svn: 163165
* Return false if BypassSlowDivision doesn't change anything.Jakub Staszak2012-09-041-33/+34
| | | | | | | | | | Also a few minor changes: - use pre-inc instead of post-inc - use isa instead of dyn_cast - 80 col - trailing spaces llvm-svn: 163164
* Generic Bypass Slow DivPreston Gurd2012-09-043-1/+266
| | | | | | | | | | | | | | | | | | | | | | | - CodeGenPrepare pass for identifying div/rem ops - Backend specifies the type mapping using addBypassSlowDivType - Enabled only for Intel Atom with O2 32-bit -> 8-bit - Replace IDIV with instructions which test its value and use DIVB if the value is positive and less than 256. - In the case when the quotient and remainder of a divide are used a DIV and a REM instruction will be present in the IR. In the non-Atom case they are both lowered to IDIVs and CSE removes the redundant IDIV instruction, using the quotient and remainder from the first IDIV. However, due to this optimization CSE is not able to eliminate redundant IDIV instructions because they are located in different basic blocks. This is overcome by calculating both the quotient (DIV) and remainder (REM) in each basic block that is inserted by the optimization and reusing the result values when a subsequent DIV or REM instruction uses the same operands. - Test cases check for the presents of the optimization when calculating either the quotient, remainder, or both. Patch by Tyler Nowicki! llvm-svn: 163150
* LICM may hoist an instruction with undefined behavior above a trap.Nadav Rotem2012-09-041-7/+30
| | | | | | | | | | Scan the body of the loop and find instructions that may trap. Use this information when deciding if it is safe to hoist or sink instructions. Notice that we can optimize the search of instructions that may throw in the case of nested loops. rdar://11518836 llvm-svn: 163132
* Not all targets have efficient ISel code generation for select instructions.Nadav Rotem2012-09-021-7/+22
| | | | | | | | | For example, the ARM target does not have efficient ISel handling for vector selects with scalar conditions. This patch adds a TLI hook which allows the different targets to report which selects are supported well and which selects should be converted to CF duting codegen prepare. llvm-svn: 163093
* LoopRotation: Make the brute force DomTree update more brute force.Benjamin Kramer2012-09-021-32/+21
| | | | | | | | | | | | | | We update until we hit a fixpoint. This is probably slow but also slightly simplifies the code. It should also fix the occasional invalid domtrees observed when building with expensive checking. I couldn't find a case where this had a measurable slowdown, but if someone finds a pathological case where it does we may have to find a cleverer way of updating dominators here. Thanks to Duncan for the test case. llvm-svn: 163091
* Rename ANDROIDEABI to Android.Logan Chien2012-09-021-1/+1
| | | | | | | | | | | | | Most of the code guarded with ANDROIDEABI are not ARM-specific, and having no relation with arm-eabi. Thus, it will be more natural to call this environment "Android" instead of "ANDROIDEABI". Note: We are not using ANDROID because several projects are using "-DANDROID" as the conditional compilation flag. llvm-svn: 163087
* LoopRotation: Check some invariants of the dominator updating code.Benjamin Kramer2012-09-011-0/+3
| | | | llvm-svn: 163058
* testMichael Ilseman2012-08-301-2/+2
| | | | llvm-svn: 162914
* LoopRotate: Also rotate loops with multiple exits.Benjamin Kramer2012-08-301-13/+60
| | | | | | | | | | | | | | | The old PHI updating code in loop-rotate was replaced with SSAUpdater a while ago, it has no problems with comples PHIs. What had to be fixed is detecting whether a loop was already rotated and updating dominators when multiple exits were present. This change increases overall code size a bit, mostly due to additional loop unrolling opportunities. Passes test-suite and selfhost with -verify-dom-info. Fixes PR7447. Thanks to Andy for the input on the domtree updating code. llvm-svn: 162912
* InstCombine: Fix comment to reflect the code.Benjamin Kramer2012-08-301-1/+1
| | | | llvm-svn: 162911
* WhitespaceAlexey Samsonov2012-08-301-3/+3
| | | | llvm-svn: 162907
* It is illegal to transform (sdiv (ashr X c1) c2) -> (sdiv x (2^c1 * c2)),Nadav Rotem2012-08-301-10/+0
| | | | | | | | because C always rounds towards zero. Thanks Dirk and Ben. llvm-svn: 162899
* Pass by pointer and not std::string.Bill Wendling2012-08-301-2/+2
| | | | llvm-svn: 162888
* Revert r162855 in favor of changing clang to emit the absolute coverage file ↵Bill Wendling2012-08-301-19/+7
| | | | | | path. llvm-svn: 162883
* Preserve branch profile metadata during switch formation.Andrew Trick2012-08-291-0/+154
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Patch by Michael Ilseman! This fixes SimplifyCFGOpt::FoldValueComparisonIntoPredecessors to preserve metata when folding conditional branches into switches. void foo(int x) { if (x == 0) bar(1); else if (__builtin_expect(x == 10, 1)) bar(2); else if (x == 20) bar(3); } CFG: B0 | \ | X0 B10 | \ | X10 B20 | \ E X20 Merge B0-B10: w(B0-X0) = w(B0-X0)*sum-weights(B10) = w(B0-X0) * (w(B10-X10) + w(B10-B20)) w(B0-X10) = w(B0-B10) * w(B10-X10) w(B0-B20) = w(B0-B10) * w(B10-B20) B0 __ | \ \ | X10 X0 B20 | \ E X20 Merge B0-B20: w(B0-X0) = w(B0-X0) * sum-weights(B20) = w(B0-X0) * (w(B20-E) + w(B20-X20)) w(B0-X10) = w(B0-X10) * sum-weights(B20) = ... w(B0-X20) = w(B0-B20) * w(B20-X20) w(B0-E) = w(B0-B20) * w(B20-E) llvm-svn: 162868
* whitespaceAndrew Trick2012-08-291-168/+168
| | | | llvm-svn: 162867
* Use the full path to output the .gcda file.Bill Wendling2012-08-291-7/+19
| | | | | | | | This lets the user run the program from a different directory and still have the .gcda files show up in the correct place. <rdar://problem/12179524> llvm-svn: 162855
* Use ArrayRef instead of SmallVector when passing vector into function.Bill Wendling2012-08-291-4/+3
| | | | llvm-svn: 162851
* Make MemoryBuiltins aware of TargetLibraryInfo.Benjamin Kramer2012-08-2919-84/+113
| | | | | | | | | | | | | | | | This disables malloc-specific optimization when -fno-builtin (or -ffreestanding) is specified. This has been a problem for a long time but became more severe with the recent memory builtin improvements. Since the memory builtin functions are used everywhere, this required passing TLI in many places. This means that functions that now have an optional TLI argument, like RecursivelyDeleteTriviallyDeadFunctions, won't remove dead mallocs anymore if the TLI argument is missing. I've updated most passes to do the right thing. Fixes PR13694 and probably others. llvm-svn: 162841
* InstCombine: Defensively avoid undefined shifts by limiting the amount to ↵Benjamin Kramer2012-08-281-2/+2
| | | | | | | | | the bit width. No test case, undefined shifts get folded early, but can occur when other transforms generate a constant. Thanks to Duncan for bringing this up. llvm-svn: 162755
* InstCombine: Guard the transform introduced in r162743 against large ints ↵Benjamin Kramer2012-08-281-10/+10
| | | | | | and non-const shifts. llvm-svn: 162751
* Make sure that we don't call getZExtValue on values > 64 bits.Nadav Rotem2012-08-281-8/+8
| | | | | | Thanks Benjamin for noticing this. llvm-svn: 162749
* Teach InstCombine to canonicalize [SU]div+[AL]shl patterns.Nadav Rotem2012-08-281-0/+20
| | | | | | | | | | For example: %1 = lshr i32 %x, 2 %2 = udiv i32 %1, 100 rdar://12182093 llvm-svn: 162743
* Don't use for loops for code that is only intended to execute once. NoDan Gohman2012-08-271-6/+6
| | | | | | intended functionality change. Thanks to Ahmed Charles for spotting it. llvm-svn: 162686
* [asan/tsan] rename FunctionBlackList* to BlackList* as this class is not ↵Kostya Serebryany2012-08-245-17/+17
| | | | | | limited to functions any more llvm-svn: 162566
OpenPOWER on IntegriCloud