summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* don't hoist FP additions into unconditional adds + selects. This Chris Lattner2008-01-031-0/+2
| | | | | | | could theoretically introduce a trap, but is also a performance issue. This speeds up ptrdist/ks by 8%. llvm-svn: 45533
* add missing #includeChris Lattner2008-01-021-0/+1
| | | | llvm-svn: 45516
* Remove attribution from file headers, per discussion on llvmdev.Chris Lattner2007-12-2978-156/+156
| | | | llvm-svn: 45418
* remove attribution from lib Makefiles.Chris Lattner2007-12-296-12/+12
| | | | llvm-svn: 45415
* Disable null pointer folding transforms for non-generic address spaces. This ↵Christopher Lamb2007-12-292-4/+12
| | | | | | should probably be a target-specific predicate based on address space. That way for targets where this isn't applicable the predicate can be optimized away. llvm-svn: 45403
* dead calls to llvm.stacksave can be deleted, even though theyChris Lattner2007-12-291-1/+10
| | | | | | have potential side-effects. llvm-svn: 45392
* Repair a transform that Chris noticed a bug in. Thanks to Nicholas for ↵Owen Anderson2007-12-281-5/+12
| | | | | | pointing out my stupid mistakes when writing this patch. :-) llvm-svn: 45384
* disable this instcombine xform, it miscompiles:Chris Lattner2007-12-281-0/+2
| | | | | | | | | | | | | | | | | | | define i32 @main() { entry: %z = alloca i32 ; <i32*> [#uses=2] store i32 0, i32* %z %tmp = load i32* %z ; <i32> [#uses=1] %sub = sub i32 %tmp, 1 ; <i32> [#uses=1] %cmp = icmp ult i32 %sub, 0 ; <i1> [#uses=1] %retval = select i1 %cmp, i32 1, i32 0 ; <i32> [#uses=1] ret i32 %retval } into ret 1, instead of ret 0. Christopher, please investigate. llvm-svn: 45383
* Fixing several transforms which would drop the collector attributeGordon Henriksen2007-12-253-0/+8
| | | | | | when copying functions. llvm-svn: 45356
* Don't break critical edges for single-bb loops, this helps with PR1877, thoughChris Lattner2007-12-251-3/+1
| | | | | | | | | | it is only a partial fix. This change is noise for most programs, but speeds up Shootout-C++/matrix by 20%, Ptrdist/ks by 24%, smg2000 by 8%, hexxagon by 9%, bzip2 by 9% (not sure I trust this), ackerman by 13%, etc. OTOH, it slows down Shootout/fib2 by 40% (I'll update PR1877 with this info). llvm-svn: 45354
* GC poses hazards to the inliner. Consider:Gordon Henriksen2007-12-251-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | define void @f() { ... call i32 @g() ... } define void @g() { ... } The hazards are: - @f and @g have GC, but they differ GC. Inlining is invalid. This may never occur. - @f has no GC, but @g does. g's GC must be propagated to @f. The other scenarios are safe: - @f and @g have the same GC. - @f and @g have no GC. - @g has no GC. This patch adds inliner checks for the former two scenarios. llvm-svn: 45351
* add a -backedge-hack llc-beta option to codegenprepare.Chris Lattner2007-12-241-2/+10
| | | | | | | When specified, don't split backedges of single-bb loops. This helps address PR1877 llvm-svn: 45344
* implement InstCombine/shift-trunc-shift.ll. This allowsChris Lattner2007-12-221-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | us to compile: #include <math.h> int t1(double d) { return signbit(d); } into: _t1: movd %xmm0, %rax shrq $63, %rax ret instead of: _t1: movd %xmm0, %rax shrq $32, %rax shrl $31, %eax ret on x86-64. llvm-svn: 45311
* If succ has succ itself as one of the predecessors then doDevang Patel2007-12-221-2/+2
| | | | | | | not merge current bb and succ even if bb's terminator is unconditional branch to succ. llvm-svn: 45305
* Make DAE not wipe out attributes on calls, and not dropDuncan Sands2007-12-211-36/+55
| | | | | | | | | | | | | | | return attributes on the floor. In the case of a call to a varargs function where the varargs arguments are being removed, any call attributes on those arguments need to be dropped. I didn't do this because I plan to make it illegal to have such attributes (see next patch). With this change, compiling the gcc filter2 eh test at -O0 and then running opt -std-compile-opts on it results in a correctly working program (compiling at -O1 or higher results in the test failing due to a problem with how we output eh info into the IR). llvm-svn: 45285
* Implement review feedback, including additional transformsChristopher Lamb2007-12-201-17/+15
| | | | | | | | | (icmp slt (sub A B) 1) -> (icmp sle A B) icmp sgt (sub A B) -1) -> (icmp sge A B) and add testcase. llvm-svn: 45256
* Clean up previous patch: PHI uses should not prevent iv reuse if all other ↵Evan Cheng2007-12-201-35/+16
| | | | | | uses are addresses. This trades a constant multiply for one fewer iv. llvm-svn: 45251
* simplify this code with the new m_Zero() pattern. Make sure the select onlyChris Lattner2007-12-201-18/+10
| | | | | | has a single use, and generalize it to not require N to be a constant. llvm-svn: 45250
* Allow iv reuse if the user is a PHI node which is in turn used as addresses.Evan Cheng2007-12-191-29/+82
| | | | llvm-svn: 45230
* When inlining through an 'nounwind' call, mark inlinedDuncan Sands2007-12-193-21/+34
| | | | | | | | | calls 'nounwind'. It is important for correct C++ exception handling that nounwind markings do not get lost, so this transformation is actually needed for correctness. llvm-svn: 45218
* Fold subtracts into integer compares vs. zero. This improves generate code ↵Christopher Lamb2007-12-181-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | for this case on X86 from _foo: movl $99, %ecx movl 4(%esp), %eax subl %eax, %ecx xorl %edx, %edx testl %ecx, %ecx cmovs %edx, %eax ret to _foo: xorl %ecx, %ecx movl 4(%esp), %eax cmpl $99, %eax cmovg %ecx, %eax ret llvm-svn: 45173
* Fix commentsChristopher Lamb2007-12-181-4/+2
| | | | llvm-svn: 45170
* Remove an orthogonal transformation of the selection condition from my most ↵Christopher Lamb2007-12-181-30/+2
| | | | | | recent submission. llvm-svn: 45169
* Rename isNoReturn to doesNotReturn, and isNoUnwind toDuncan Sands2007-12-184-11/+11
| | | | | | doesNotThrow. llvm-svn: 45160
* Fix typos.Christopher Lamb2007-12-181-1/+1
| | | | llvm-svn: 45159
* Fold certain additions through selects (and their compares) so as to ↵Christopher Lamb2007-12-181-0/+61
| | | | | | | | eliminate subtractions. This code is often produced by the SMAX expansion in SCEV. This implements test/Transforms/InstCombine/2007-12-18-AddSelCmpSub.ll llvm-svn: 45158
* Make invokes of inline asm legal. Teach codegenDuncan Sands2007-12-171-3/+2
| | | | | | | | how to lower them (with no attempt made to be efficient, since they should only occur for unoptimized code). llvm-svn: 45108
* GLIBCXX_DEBUG fix. std::vector<>::end() is invalidated by erase.David Greene2007-12-171-1/+1
| | | | llvm-svn: 45101
* Get rid of annoying spaces.David Greene2007-12-171-1/+1
| | | | llvm-svn: 45100
* Fix GLIBCXX_DEBUG errors. Erase invalidates std::vector iteratorsDavid Greene2007-12-171-4/+3
| | | | | | passed the erased element. llvm-svn: 45099
* Change the PointerType api for creating pointer types. The old functionality ↵Christopher Lamb2007-12-1711-70/+82
| | | | | | of PointerType::get() has become PointerType::getUnqual(), which returns a pointer in the generic address space. The new prototype of PointerType::get() requires both a type and an address space. llvm-svn: 45082
* Revert this part of r45073 until the verifier isDuncan Sands2007-12-161-2/+3
| | | | | | changed not to reject invoke of inline asm. llvm-svn: 45077
* Make instcombine promote inline asm calls to 'nounwind'Duncan Sands2007-12-162-3/+15
| | | | | | | | | | | | | calls. Remove special casing of inline asm from the inliner. There is a potential problem: the verifier rejects invokes of inline asm (not sure why). If an asm call is not marked "nounwind" in some .ll, and instcombine is not run, but the inliner is run, then an illegal module will be created. This is bad but I'm not sure what the best approach is. I'm tempted to remove the check in the verifier... llvm-svn: 45073
* Fix typo.Evan Cheng2007-12-131-1/+1
| | | | llvm-svn: 44997
* Be extra careful with extension use optimation. Now turned on by default.Evan Cheng2007-12-131-3/+10
| | | | llvm-svn: 44981
* Fix for edge profiling, patch by 'Marc' for PR1857Chris Lattner2007-12-131-1/+1
| | | | llvm-svn: 44965
* 1. "Upgrage" comments.Wojciech Matyjewicz2007-12-121-15/+16
| | | | | | | | | | | | | | 2. Using zero-extended value of Scale and unsigned division is safe provided that Scale doesn't have the sign bit set. Previously these 2 instructions: %p = bitcast [100 x {i8,i8,i8}]* %x to i8* %q = getelementptr i8* %p, i32 -4 were combined into: %q = getelementptr [100 x { i8, i8, i8 }]* %x, i32 0, i32 1431655764, i32 0 what was incorrect. llvm-svn: 44936
* Don't muck with phi nodes; bug fixes.Evan Cheng2007-12-121-2/+11
| | | | llvm-svn: 44905
* Bug fix. Only safe to perform extension uses optimization if the source of ↵Evan Cheng2007-12-121-0/+5
| | | | | | extension is also defined in the same BB as the extension. llvm-svn: 44896
* Fix PR1850 by removing an unsafe transformation from VMCore/ConstantFold.cpp.Chris Lattner2007-12-101-1/+7
| | | | | | | | Reimplement the xform in Analysis/ConstantFolding.cpp where we can use targetdata to validate that it is safe. While I'm in there, fix some const correctness issues and generalize the interface to the "operand folder". llvm-svn: 44817
* Make PruneEH update the nounwind/noreturn attributesDuncan Sands2007-12-102-76/+81
| | | | | | on functions as it calculates them. llvm-svn: 44802
* Adding a collector name attribute to Function in the IR. These Gordon Henriksen2007-12-101-0/+2
| | | | | | | | | | | | | | | | | | | | methods are new to Function: bool hasCollector() const; const std::string &getCollector() const; void setCollector(const std::string &); void clearCollector(); The assembly representation is as such: define void @f() gc "shadow-stack" { ... The implementation uses an on-the-side table to map Functions to collector names, such that there is no overhead. A StringPool is further used to unique collector names, which are extremely likely to be unique per process. llvm-svn: 44769
* Fix several cache coherence bugs in MemDep/GVN that were found. Also add ↵Owen Anderson2007-12-081-2/+6
| | | | | | | | some (disabled) debugging code to make such problems easier to diagnose in the future, written by Duncan Sands. llvm-svn: 44695
* simplify some code.Chris Lattner2007-12-061-2/+1
| | | | llvm-svn: 44655
* move some ashr-specific code out of commonShiftTransforms into visitAShr.Chris Lattner2007-12-061-15/+16
| | | | llvm-svn: 44650
* If both result of the {s|z}xt and its source are live out, rewrite all uses ↵Evan Cheng2007-12-051-3/+71
| | | | | | of the source with result of extension. llvm-svn: 44643
* Rather than having special rules like "intrinsics cannotDuncan Sands2007-12-034-8/+6
| | | | | | | | | throw exceptions", just mark intrinsics with the nounwind attribute. Likewise, mark intrinsics as readnone/readonly and get rid of special aliasing logic (which didn't use anything more than this anyway). llvm-svn: 44544
* update file comment.Chris Lattner2007-12-031-2/+5
| | | | llvm-svn: 44543
* If ExitValue operand is also defined in Loop header thenDevang Patel2007-12-031-0/+17
| | | | | | | | insert new ExitValue after this operand definition. This fixes PR1828. llvm-svn: 44539
* Integrate the readonly/readnone logic more deeplyDuncan Sands2007-12-014-27/+19
| | | | | | | | | | | | | | | into alias analysis. This meant updating the API which now has versions of the getModRefBehavior, doesNotAccessMemory and onlyReadsMemory methods which take a callsite parameter. These should be used unless the callsite is not known, since in general they can do a better job than the versions that take a function. Also, users should no longer call the version of getModRefBehavior that takes both a function and a callsite. To reduce the chance of misuse it is now protected. llvm-svn: 44487
OpenPOWER on IntegriCloud