summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Don't sign extend the char when expanding char -> int duringNick Lewycky2009-02-211-2/+2
| | | | | | load(bitcast(char[4] to i32*)) evaluation. llvm-svn: 65246
* Add AddrModeMatcher.cppEvan Cheng2009-02-211-0/+1
| | | | llvm-svn: 65228
* Teach LSR sink to sink the immediate portion of the common expression back ↵Evan Cheng2009-02-211-17/+82
| | | | | | into uses if they fit in address modes of all the uses. llvm-svn: 65215
* rename a function to indicate that it checks for profitability as wellChris Lattner2009-02-211-9/+36
| | | | | | | | as legality. Make load sinking and gep sinking more careful: we only do it when it won't pessimize loads from the stack. This has the added benefit of not producing code that is unanalyzable to SROA. llvm-svn: 65209
* Fix strange logic in CollectIVUsers used to determine whether all uses areEvan Cheng2009-02-201-1/+8
| | | | | | | addresses, part 1. This fixes an obvious logic bug. Previously if the only in-loop use is a PHI, it would return AllUsesAreAddresses as true. llvm-svn: 65178
* Simplify code and reduce indentation. No functionality change.Dan Gohman2009-02-201-80/+70
| | | | llvm-svn: 65167
* Fix 80-column violations.Dan Gohman2009-02-201-4/+5
| | | | llvm-svn: 65159
* It's not necessary to check if Base is null here.Dan Gohman2009-02-201-2/+1
| | | | llvm-svn: 65157
* Add a comment about how Imm can be used for loop-variant values.Dan Gohman2009-02-201-1/+2
| | | | llvm-svn: 65147
* Factor address mode matcher out of codegen prepare to make it available to ↵Evan Cheng2009-02-202-643/+594
| | | | | | other passes, e.g. loop strength reduction. llvm-svn: 65134
* Just roll back the previous change to -mem2reg.Zhou Sheng2009-02-201-26/+0
| | | | | | Will re-think about this according to Chris's comments. llvm-svn: 65126
* patch to update the line number information in pass -mem2reg.Zhou Sheng2009-02-201-0/+26
| | | | | | | | Currently this pass will delete the variable declaration info, and keep the line number info. But the kept line number info is not updated, and some is redundant or not correct, this patch just updates those info. llvm-svn: 65123
* Implement "superhero" strength reduction, or full strengthDan Gohman2009-02-201-109/+344
| | | | | | | | | | | | | | | | | reduction of address calculations down to basic pointer arithmetic. This is currently off by default, as it needs a few other features before it becomes generally useful. And even when enabled, full strength reduction is only performed when it doesn't increase register pressure, and when several other conditions are true. This also factors out a bunch of exisiting LSR code out of StrengthReduceStridedIVUsers into separate functions, and tidies up IV insertion. This actually decreases register pressure even in non-superhero mode. The change in iv-users-in-other-loops.ll is an example of this; there are two more adds because there are two fewer leas, and there is less spilling. llvm-svn: 65108
* Use DEBUG() instead of passing *DOUT to WriteAsOperand,Dan Gohman2009-02-191-17/+7
| | | | | | | since the latter just passes a null reference when debugging is not enabled. llvm-svn: 65060
* Make the debug output of LSR less cryptic and more informative.Dan Gohman2009-02-191-29/+46
| | | | llvm-svn: 65057
* In theory the aliasee may have dead constant usersDuncan Sands2009-02-181-0/+1
| | | | | | | | here. Since we only do the transform if there is one use, strip off any such users in the hope of making the transform fire more often. llvm-svn: 64926
* Use a sign-extend instead of a zero-extend when promoting aDan Gohman2009-02-181-15/+39
| | | | | | | | | | | | trip count value when the original loop iteration condition is signed and the canonical induction variable won't undergo signed overflow. This isn't required for correctness; it just preserves more information about original loop iteration values. Add a getTruncateOrSignExtend method to ScalarEvolution, following getTruncateOrZeroExtend. llvm-svn: 64918
* Simplify by using dyn_cast instead of isa and cast.Dan Gohman2009-02-181-6/+5
| | | | llvm-svn: 64917
* Add explicit keywords.Dan Gohman2009-02-181-2/+2
| | | | llvm-svn: 64915
* Eliminate several more unnecessary intptr_t casts.Dan Gohman2009-02-181-1/+1
| | | | llvm-svn: 64888
* Fix a corner case in the new indvars promotion logic: if thereDan Gohman2009-02-181-19/+25
| | | | | | | | | | are multiple IV's in a loop, some of them may under go signed or unsigned wrapping even if the IV that's used in the loop exit condition doesn't. Restrict sign-extension-elimination and zero-extension-elimination to only those that operate on the original loop-controlling IV. llvm-svn: 64866
* Fix a typo in a comment.Dan Gohman2009-02-181-1/+1
| | | | llvm-svn: 64859
* If an alias is dead and so is its aliasee, then globaldce wouldDuncan Sands2009-02-171-8/+16
| | | | | | | crash because the alias would still be using the aliasee when the aliasee was deleted. llvm-svn: 64844
* LoopIndexSplit doesn't actually use ScalarEvolution.Dan Gohman2009-02-171-4/+1
| | | | llvm-svn: 64811
* Add a method to ScalarEvolution for telling it when a loop has beenDan Gohman2009-02-171-9/+16
| | | | | | | | | | | modified in a way that may effect the trip count calculation. Change IndVars to use this method when it rewrites pointer or floating-point induction variables instead of using a doInitialization method to sneak these changes in before ScalarEvolution has a chance to see the loop. This eliminates the need for LoopPass to depend on ScalarEvolution. llvm-svn: 64810
* commit a tweaked version of Daniel's patch for PR3599. We nowChris Lattner2009-02-171-26/+29
| | | | | | | eliminate all the extensions and all but the one required truncate from the testcase, but the or/and/shift stuff still isn't zapped. llvm-svn: 64809
* Delete trailing whitespace.Dan Gohman2009-02-171-34/+34
| | | | llvm-svn: 64784
* This transform also applies to private linkage.Duncan Sands2009-02-171-2/+2
| | | | llvm-svn: 64773
* Fix 80-column violation.Dan Gohman2009-02-171-1/+2
| | | | llvm-svn: 64766
* Strengthen the "non-constant stride must dominate loop preheader" check.Evan Cheng2009-02-171-9/+4
| | | | llvm-svn: 64703
* Simplify; fix some 80-column violations.Dan Gohman2009-02-171-6/+7
| | | | llvm-svn: 64702
* Fix EnforceKnownAlignment so that it doesn't ever reduce the alignmentDan Gohman2009-02-161-4/+12
| | | | | | of an alloca or global variable. llvm-svn: 64693
* Fix typo caused by too much surfing, dudes...Nick Lewycky2009-02-161-1/+1
| | | | llvm-svn: 64626
* Delete this long-commented-out code. The situation it seems to haveDan Gohman2009-02-161-26/+0
| | | | | | | been written for is no longer relevant with the elimination of signed and unsigned types. llvm-svn: 64625
* Change these tests to use regular loads instead of llvm.x86.sse2.loadu.dq.Dan Gohman2009-02-161-3/+5
| | | | | | | | Enhance instcombine to use the preferred field of GetOrEnforceKnownAlignment in more cases, so that regular IR operations are optimized in the same way that the intrinsics currently are. llvm-svn: 64623
* Update the list of function annotations for nocapture. All of these came upNick Lewycky2009-02-151-47/+186
| | | | | | | | | | | when I was looking at functions used by python. Highlights include, better largefile support (64-bit file sizes on 32-bit systems), fputs string is nocapture, popen/pclose added (popen being noalias return), modf and frexp and friends. Also added some missing 'break' statements and combined identical sections. llvm-svn: 64615
* Make this more useful for cleaning up after theDuncan Sands2009-02-151-15/+5
| | | | | | | one-definition-rule llvm-gcc changes (coming soon to a tree near you!). llvm-svn: 64588
* If the target of an alias has internal linkage, then theDuncan Sands2009-02-151-7/+55
| | | | | | | | alias can be morphed into the target. Implement this transform, and fix a crash in the existing transform at the same time. llvm-svn: 64583
* Fix pr3571: If stride is a value defined by an instruction, make sure it ↵Evan Cheng2009-02-151-5/+15
| | | | | | dominates the loop preheader. When IV users are strength reduced, the stride is inserted into the preheader. It could create a use before def situation. llvm-svn: 64579
* ifdef out unneeded if statement.Evan Cheng2009-02-151-0/+2
| | | | llvm-svn: 64575
* Extend the IndVarSimplify support for promoting induction variables:Dan Gohman2009-02-141-44/+134
| | | | | | | | | - Test for signed and unsigned wrapping conditions, instead of just testing for non-negative induction ranges. - Handle loops with GT comparisons, in addition to LT comparisons. - Support more cases of induction variables that don't start at 0. llvm-svn: 64532
* Clarify debug output.Dan Gohman2009-02-141-1/+1
| | | | llvm-svn: 64531
* Simplify some code. hasComputableLoopEvolution is overkill in this case.Dan Gohman2009-02-141-9/+8
| | | | | | No functionality change. llvm-svn: 64530
* In CodeGenPrepare's debug output, use WriteAsOperand instead ofDan Gohman2009-02-131-6/+16
| | | | | | printing getName(), so that unnamed values are printed correctly. llvm-svn: 64468
* Complete the sentance in this comment. I have reservationsDan Gohman2009-02-131-0/+1
| | | | | | | about the code it describes, but at least now the comment is right. llvm-svn: 64465
* Mark strto* as readonly when the endptr is null.Nick Lewycky2009-02-131-1/+3
| | | | llvm-svn: 64460
* On strtod and friends, mark 'endptr' nocapture in the function prototype, andNick Lewycky2009-02-131-3/+37
| | | | | | mark the first argument nocapture if endptr=NULL for each particular call. llvm-svn: 64453
* Fix the code that checked if a SCEVAddRecExpr Start contains anDan Gohman2009-02-131-1/+1
| | | | | | | | | addrec in a different loop to check the value being added to the accumulated Start value, not the Start value before it has the new value added to it. This prevents LSR from going crazy on the included testcase. Dale, please review. llvm-svn: 64440
* Fix LSR's IV sorting function to explicitly sort by bitwidthDan Gohman2009-02-131-4/+11
| | | | | | | after sorting by stride value. This prevents it from missing IV reuse opportunities in a host-sensitive manner. llvm-svn: 64415
* Teach IndVarSimplify to optimize code using the C "int" type forDan Gohman2009-02-121-226/+200
| | | | | | | | | | | | | | | | | | | | | | | | | | | | loop induction on LP64 targets. When the induction variable is used in addressing, IndVars now is usually able to inserst a 64-bit induction variable and eliminates the sign-extending cast. This is also useful for code using C "short" types for induction variables on targets with 32-bit addressing. Inserting a wider induction variable is easy; the tricky part is determining when trunc(sext(i)) expressions are no-ops. This requires range analysis of the loop trip count. A common case is when the original loop iteration starts at 0 and exits when the induction variable is signed-less-than a fixed value; this case is now handled. This replaces IndVarSimplify's OptimizeCanonicalIVType. It was doing the same optimization, but it was limited to loops with constant trip counts, because it was running after the loop rewrite, and the information about the original induction variable is lost by that point. Rename ScalarEvolution's executesAtLeastOnce to isLoopGuardedByCond, generalize it to be able to test for ICMP_NE conditions, and move it to be a public function so that IndVars can use it. llvm-svn: 64407
OpenPOWER on IntegriCloud