summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Rename everything to follow LLVM style ... I think.Nick Lewycky2011-04-261-207/+300
| | | | | | | | | | | | | | Add support for switch and indirectbr edges. This works by densely numbering all blocks which have such terminators, and then separately numbering the possible successors. The predecessors write down a number, the successor knows its own number (as a ConstantInt) and sends that and the pointer to the number the predecessor wrote down to the runtime, who looks up the counter in a per-function table. Coverage data should now be functional, but I haven't tested it on anything other than my 2-file synthetic test program for coverage. llvm-svn: 130186
* Enhance MemDep: When alias analysis returns a partial alias result,Chris Lattner2011-04-261-24/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | return it as a clobber. This allows GVN to do smart things. Enhance GVN to be smart about the case when a small load is clobbered by a larger overlapping load. In this case, forward the value. This allows us to compile stuff like this: int test(void *P) { int tmp = *(unsigned int*)P; return tmp+*((unsigned char*)P+1); } into: _test: ## @test movl (%rdi), %ecx movzbl %ch, %eax addl %ecx, %eax ret which has one load. We already handled the case where the smaller load was from a must-aliased base pointer. llvm-svn: 130180
* Remove unused STL header includes.Jay Foad2011-04-236-6/+0
| | | | llvm-svn: 130068
* PR9214: Convert Metadata API to use ArrayRef.Jay Foad2011-04-212-3/+3
| | | | llvm-svn: 129932
* In gcov profiling, give all functions an extra unified return block. This isNick Lewycky2011-04-211-5/+17
| | | | | | | necessary since gcov counts transitions between blocks. It can't see if you've run every line in a straight-line function, so we add an edge for it to notice. llvm-svn: 129905
* Fix think-o: emit all 8 bytes of the EOF marker. Also reflow a line in aNick Lewycky2011-04-211-3/+3
| | | | | | comment for 80 columns. llvm-svn: 129904
* Add independent controls for whether GCOV profiling should emit .gcno files orNick Lewycky2011-04-211-4/+16
| | | | | | | instrument the program to emit .gcda. TODO: we should emit slightly different .gcda files when .gcno emission is off. llvm-svn: 129903
* Fix another case of <rdar://problem/9184212> that only occurs with codeCameron Zwarich2011-04-201-31/+44
| | | | | | | generated by llvm-gcc, since llvm-gcc uses 2 i64s for passing a 4 x float vector on ARM rather than an i64 array like Clang. llvm-svn: 129878
* The bitcast case here is actually handled uniformly earlier in the function, soCameron Zwarich2011-04-201-8/+3
| | | | | | delete it. llvm-svn: 129877
* Cleanup some code to better use an early return style in preparation for addingCameron Zwarich2011-04-201-6/+10
| | | | | | more cases. llvm-svn: 129876
* Trivial simplification.Jay Foad2011-04-191-2/+1
| | | | llvm-svn: 129759
* Mark some functions as used which are used within debug-only code. ThisChandler Carruth2011-04-181-0/+3
| | | | | | silences Clang's -Wunused-function when building in release mode. llvm-svn: 129709
* Rename a misleadingly-named variable.Frits van Bommel2011-04-161-5/+5
| | | | llvm-svn: 129644
* Fix bug when checking phi operands in InstCombiner::visitPHINode(),Jay Foad2011-04-161-1/+1
| | | | | | found by code inspection. llvm-svn: 129641
* Fix cmake build.Rafael Espindola2011-04-161-1/+1
| | | | llvm-svn: 129632
* Move the re-stemming function up top and use it where it's currently inlined.Nick Lewycky2011-04-161-15/+25
| | | | | | | | | | Break the arc-profile code out to a function like the notes emission code is, and reorder the functions in the file. The only functionality change is that we no longer modify the Module when the Module has no debug info to use. llvm-svn: 129631
* Rename LineProfiling to GCOVProfiling to more accurately represent what itNick Lewycky2011-04-163-218/+509
| | | | | | | does. Also mostly implement it. Still a work-in-progress, but generates legal output on crafted test cases. llvm-svn: 129630
* Fix a ton of comment typos found by codespell. Patch byChris Lattner2011-04-1517-25/+25
| | | | | | Luis Felipe Strano Moraes! llvm-svn: 129558
* Add an instcombine for constructs like a | -(b != c); a select is moreEli Friedman2011-04-141-1/+8
| | | | | | | canonical, and generally leads to better code. Found while looking at an article about saturating arithmetic. llvm-svn: 129545
* Fix an infinite alternation in JumpThreading where two transforms would ↵Owen Anderson2011-04-141-3/+15
| | | | | | | | | | repeatedly undo each other. The solution is to perform more aggressive constant folding to make one of the edges just folded away rather than trying to thread it. Fixes <rdar://problem/9284786>. Discovered with CSmith. llvm-svn: 129538
* Cleanup r129509 based on comments by ChrisMon P Wang2011-04-141-7/+6
| | | | llvm-svn: 129532
* Cleanup r129472 by using a utility routine as suggested by Eli.Mon P Wang2011-04-141-51/+43
| | | | llvm-svn: 129509
* rework FoldBranchToCommonDest to exit earlier when there is a bonusChris Lattner2011-04-141-39/+30
| | | | | | | | | | | | instruction around, reducing work. Greatly simplify handling of debug instructions. There is no need to build up a vector of them and then move them into the one predecessor if we're processing a block. Instead just rescan the block and *copy* them into the pred. If a block gets merged into multiple preds, this will retain more debug info. llvm-svn: 129502
* fix a couple -Wsign-compare warnings.Chris Lattner2011-04-141-2/+2
| | | | llvm-svn: 129501
* Vectors with different number of elements of the same element type can haveMon P Wang2011-04-131-6/+64
| | | | | | | | the same allocation size but different primitive sizes(e.g., <3xi32> and <4xi32>). When ScalarRepl promotes them, it can't use a bit cast but should use a shuffle vector instead. llvm-svn: 129472
* Fixed the revision 129449.Junjie Gu2011-04-131-1/+1
| | | | llvm-svn: 129450
* Passing unroll parameters (unroll-count, threshold, and partial unroll) via ↵Junjie Gu2011-04-131-12/+23
| | | | | | | | | LoopUnroll class's ctor. Doing so will allow multiple context with different loop unroll parameters to run. This is a minor change and no effect on existing application. llvm-svn: 129449
* Add the alias analysis to the C api.Rafael Espindola2011-04-131-0/+9
| | | | llvm-svn: 129447
* Reapply r129401 with patch for clang.Bill Wendling2011-04-132-8/+1
| | | | llvm-svn: 129419
* Revert r129401 for now. Clang is using the old way of doing things.Bill Wendling2011-04-122-1/+8
| | | | llvm-svn: 129403
* Remove the unaligned load intrinsics in favor of using native unaligned loads.Bill Wendling2011-04-122-8/+1
| | | | | | | | | Now that we have a first-class way to represent unaligned loads, the unaligned load intrinsics are superfluous. First part of <rdar://problem/8460511>. llvm-svn: 129401
* lib/Transforms/Instrumentation/CMakeLists.txt: Add LineProfiling.cpp to fix ↵NAKAMURA Takumi2011-04-121-0/+1
| | | | | | up r129340. llvm-svn: 129343
* Add support for line profiling. Very work-in-progress.Nick Lewycky2011-04-122-0/+218
| | | | | | | | | | Use debug info in the IR to find the directory/file:line:col. Each time that location changes, bump a counter. Unlike the existing profiling system, we don't try to look at argv[], and thusly don't require main() to be present in the IR. This matches GCC's technique where you specify the profiling flag when producing each .o file. The runtime library is minimal, currently just calling printf at program shutdown time. The API is designed to make it possible to emit GCOV data later on. llvm-svn: 129340
* Consider ConstantAggregateZero as well as ConstantArray/Struct.Nick Lewycky2011-04-121-5/+7
| | | | llvm-svn: 129338
* Fix reassociate to use a worklist instead of recursing when newDan Gohman2011-04-121-59/+67
| | | | | | | | | reassociation opportunities are exposed. This fixes a bug where the nested reassociation expects to be the IR to be consistent, but it isn't, because the outer reassociation has disconnected some of the operands. rdar://9167457 llvm-svn: 129324
* comment cleanup, use moveBefore instead of removeFromParent+insertBefore.Chris Lattner2011-04-111-9/+5
| | | | llvm-svn: 129319
* remove the StructRetPromotion pass. It is unused, not maintained andChris Lattner2011-04-113-359/+0
| | | | | | | has some bugs. If this is interesting functionality, it should be reimplemented in the argpromotion pass. llvm-svn: 129314
* Just because a GlobalVariable's initializer is [N x { i32, void ()* }] doesn'tNick Lewycky2011-04-111-7/+10
| | | | | | | | | | | | mean that it has to be ConstantArray of ConstantStruct. We might have ConstantAggregateZero, at either level, so don't crash on that. Also, semi-deprecate the sentinal value. The linker isn't aware of sentinals so we end up with the two lists appended, each with their "sentinals" on them. Different parts of LLVM treated sentinals differently, so make them all just ignore the single entry and continue on with the rest of the list. llvm-svn: 129307
* Don't include Operator.h from InstrTypes.h.Jay Foad2011-04-117-0/+7
| | | | llvm-svn: 129271
* Add back a couple checks removed by r129128; the fact that an intitializerEli Friedman2011-04-091-4/+6
| | | | | | | is an array of structures doesn't imply it's a ConstantArray of ConstantStruct. llvm-svn: 129207
* fix PR9523, a crash in looprotate on a non-canonical loop made out of ↵Chris Lattner2011-04-091-1/+5
| | | | | | indirectbr. llvm-svn: 129203
* Fix a bug where RecursivelyDeleteTriviallyDeadInstructions couldChris Lattner2011-04-091-3/+18
| | | | | | | delete the instruction pointed to by CGP's current instruction iterator, leading to a crash on the testcase. This fixes PR9578. llvm-svn: 129200
* Add a function for profiling to run at shutdown. Unlike the existing API, thisNick Lewycky2011-04-082-3/+40
| | | | | | | can be used even when main() isn't present in the Module, but it means that you don't get to read argv[]. llvm-svn: 129163
* llvm.global_[cd]tor is defined to be either external, or appending with an arrayNick Lewycky2011-04-081-20/+5
| | | | | | | of { i32, void ()* }. Teach the verifier to verify that, deleting copies of checks strewn about. llvm-svn: 129128
* Do not let debug info interfer with branch folding.Devang Patel2011-04-071-0/+6
| | | | llvm-svn: 129114
* Expose more passes to the C API.Rafael Espindola2011-04-071-0/+16
| | | | llvm-svn: 129087
* While hoisting common code from if/else, hoist debug info intrinsics if they ↵Devang Patel2011-04-071-8/+18
| | | | | | match. llvm-svn: 129078
* PR9634: Don't unconditionally tell the AliasSetTracker that the PreheaderLoadEli Friedman2011-04-071-21/+4
| | | | | | | | | | | is equivalent to any other relevant value; it isn't true in general. If it is equivalent, the LoopPromoter will tell the AST the equivalence. Also, delete the PreheaderLoad if it is unused. Chris, since you were the last one to make major changes here, can you check that this is sane? llvm-svn: 129049
* Simplify. isIdenticalToWhenDefined() checks opcode.Devang Patel2011-04-071-4/+2
| | | | llvm-svn: 129041
* While folding branch to a common destination into a predecessor, copy dbg ↵Devang Patel2011-04-061-4/+17
| | | | | | values also. llvm-svn: 129035
OpenPOWER on IntegriCloud