summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* factor simplification logic for AND and OR out to InstSimplify from instcombine.Chris Lattner2009-11-101-85/+34
| | | | llvm-svn: 86635
* pull a bunch of logic out of instcombine into instsimplify for compare Chris Lattner2009-11-091-56/+13
| | | | | | simplification, this handles the foldable fcmp x,x cases among many others. llvm-svn: 86627
* inline a simple function.Chris Lattner2009-11-091-17/+20
| | | | llvm-svn: 86625
* rename SimplifyCompare -> SimplifyCmpInst and split it into Chris Lattner2009-11-091-0/+1
| | | | | | | Simplify[IF]Cmp pieces. Add some predicates to CmpInst to determine whether a predicate is fp or int. llvm-svn: 86624
* if a 'with overflow' intrinsic just has the normal result used, simplifyChris Lattner2009-11-091-0/+41
| | | | | | it to a normal binop. Patch by Alastair Lynn, testcase by me. llvm-svn: 86524
* enhance PHI slicing to handle the case when a slicable PHI is beginChris Lattner2009-11-091-74/+167
| | | | | | used by a chain of other PHIs. llvm-svn: 86503
* Teach an instcombine to not pull trunc instructions through PHI nodesChris Lattner2009-11-081-10/+30
| | | | | | | | | when both the source and dest are illegal types, since it would cause the phi to grow (for example, we shouldn't transform test14b's phi to a phi on i320). This fixes an infinite loop on i686 bootstrap with phi slicing turned on, so turn it back on. llvm-svn: 86483
* reapply r8644[3-5] with only the scary part Chris Lattner2009-11-081-8/+151
| | | | | | (SliceUpIllegalIntegerPHI) disabled. llvm-svn: 86480
* Speculatively revert r8644[3-5], they seem to be leading to infinite loops inDaniel Dunbar2009-11-081-151/+8
| | | | | | llvm-gcc bootstrap. llvm-svn: 86478
* teach a couple of instcombine transformations involving PHIs toChris Lattner2009-11-081-8/+151
| | | | | | | | not turn a PHI in a legal type into a PHI of an illegal type, and add a new optimization that breaks up insane integer PHI nodes into small pieces (PR3451). llvm-svn: 86443
* make instcombine only rewrite a chain of computation Chris Lattner2009-11-071-19/+5
| | | | | | | | | | (eliminating some extends) if the new type of the computation is legal or if both the source and dest are illegal. This prevents instcombine from changing big chains of computation into i64 on 32-bit targets for example. llvm-svn: 86398
* remove some more Context arguments.Chris Lattner2009-11-061-1/+1
| | | | llvm-svn: 86235
* remove a bunch of extraneous LLVMContext argumentsChris Lattner2009-11-061-4/+3
| | | | | | from various APIs, addressing PR5325. llvm-svn: 86231
* move two functions up higher in the file. Delete a useless argumentChris Lattner2009-11-041-176/+232
| | | | | | | | | | | | | | to EmitGEPOffset. Implement some new transforms for optimizing subtracts of two pointer to ints into the same vector. This happens for C++ iterator idioms for example, stringmap takes a const char* that points to the start and end of a string. Once inlined, we want the pointer difference to turn back into a length. This is rdar://7362831. llvm-svn: 86021
* fix instcombine to only do store sinking when the alignmentsChris Lattner2009-11-021-4/+8
| | | | | | of the two loads agree. Propagate that onto the new store. llvm-svn: 85772
* when merging two loads, make sure to take the min of their alignment,Chris Lattner2009-11-011-1/+1
| | | | | | | not the max. This didn't matter until the previous patch because instcombine would refuse to sink loads with differenting alignments. llvm-svn: 85738
* split load sinking out to its own function, like gep sinking.Chris Lattner2009-11-011-66/+101
| | | | llvm-svn: 85737
* fix a bug noticed by inspection: when instcombine sinks loads throughChris Lattner2009-11-011-4/+24
| | | | | | | | phis, it didn't preserve the alignment of the load. This is a missed optimization of the alignment is high and a miscompilation when the alignment is low. llvm-svn: 85736
* add a comment.Chris Lattner2009-10-311-0/+4
| | | | llvm-svn: 85671
* Reapply r85634, with the bug fixed.Dan Gohman2009-10-311-15/+17
| | | | llvm-svn: 85655
* Revert 85634. It's breaking consumer-typeset (and others).Evan Cheng2009-10-311-17/+15
| | | | llvm-svn: 85641
* Optimize around the fact that pred_iterator is slow: instead of sortingDan Gohman2009-10-301-15/+17
| | | | | | | PHI operands by the predecessor order, sort them by the order used by the first PHI in the block. This is still suffucient to expose duplicates. llvm-svn: 85634
* Sort the incoming values in PHI nodes to match the predecessor order.Dan Gohman2009-10-301-0/+19
| | | | | | | This helps expose duplicate PHIs, which will make it easier for them to be eliminated. llvm-svn: 85623
* Rename MallocFreeHelper as MemoryBuiltinsVictor Hernandez2009-10-271-1/+1
| | | | llvm-svn: 85286
* Add braces to avoid ambiguous else.Dan Gohman2009-10-271-1/+2
| | | | llvm-svn: 85185
* Rename MallocHelper as MallocFreeHelper, since it now also identifies calls ↵Victor Hernandez2009-10-261-1/+1
| | | | | | to free() llvm-svn: 85181
* Remove FreeInst.Victor Hernandez2009-10-261-55/+2
| | | | | | | Remove LowerAllocations pass. Update some more passes to treate free calls just like they were treating FreeInst. llvm-svn: 85176
* Code that checks WillNotOverflowSignedAdd before creating an AddDan Gohman2009-10-261-8/+8
| | | | | | can safely use the NSW bit on the Add. llvm-svn: 85164
* reapply r85085 with a bugfix to avoid infinite looping.Chris Lattner2009-10-261-8/+47
| | | | | | | All of the 'demorgan' related xforms need to use dyn_castNotVal, not m_Not. llvm-svn: 85119
* Revert 85085. It causes infinite looping during llvm-gcc build.Evan Cheng2009-10-261-45/+6
| | | | llvm-svn: 85090
* Implement PR3266 & PR5276, folding:Chris Lattner2009-10-261-6/+45
| | | | | | not (or (icmp, icmp)) -> and(icmp, icmp) llvm-svn: 85085
* Remove ICmpInst::isSignedPredicate which was a reimplementationNick Lewycky2009-10-251-19/+17
| | | | | | CmpInst::isSigned. llvm-svn: 85037
* Auto-upgrade free instructions to calls to the builtin free function.Victor Hernandez2009-10-241-0/+40
| | | | | | | Update all analysis passes and transforms to treat free calls just like FreeInst. Remove RaiseAllocations and all its tests since FreeInst no longer needs to be raised. llvm-svn: 84987
* Remove AllocationInst. Since MallocInst went away, AllocaInst is the only ↵Victor Hernandez2009-10-231-9/+9
| | | | | | subclass of AllocationInst, so it no longer is necessary. llvm-svn: 84969
* move another load optimization from instcombine -> libanalysis.Chris Lattner2009-10-221-12/+2
| | | | llvm-svn: 84841
* move 'loading i32 from string' optimization from instcombineChris Lattner2009-10-221-34/+0
| | | | | | | to libanalysis. Instcombine shrinking... does this even make sense??? llvm-svn: 84840
* Move some constant folding logic for loads out of instcombine intoChris Lattner2009-10-221-42/+18
| | | | | | | | | Analysis/ConstantFolding.cpp. This doesn't change the behavior of instcombine but makes other clients of ConstantFoldInstruction able to handle loads. This was partially extracted from Eli's patch in PR3152. llvm-svn: 84836
* fix PR5262.Chris Lattner2009-10-221-15/+42
| | | | llvm-svn: 84810
* revert r84754, it isn't the right approach. Edwin, please propose Chris Lattner2009-10-211-60/+6
| | | | | | patches for fixes like this instead of committing them directly. llvm-svn: 84799
* Make changes to rev 84292 as requested by Chris Lattner.Victor Hernandez2009-10-211-2/+20
| | | | | | | Most changes are cleanup, but there is 1 correctness fix: I fixed InstCombine so that the icmp is removed only if the malloc call is removed (which requires explicit removal because the Worklist won't DCE any calls since they can have side-effects). llvm-svn: 84772
* Fix PR5262: when folding select into PHI, make sure all operands are availableTorok Edwin2009-10-211-6/+60
| | | | | | | in the PHI's Basic Block. This uses a conservative approach, because we don't have dominator info in instcombine. llvm-svn: 84754
* Remove MallocInst from LLVM Instructions.Victor Hernandez2009-10-171-30/+3
| | | | llvm-svn: 84299
* only try to fold constantexpr operands when the worklist is first populated, Chris Lattner2009-10-151-15/+30
| | | | | | | | don't bother every time going around the main worklist. This speeds up a release-asserts opt -std-compile-opts on 403.gcc by about 4% (1.5s). It seems to speed up the most expensive instances of instcombine by ~10%. llvm-svn: 84171
* don't bother calling ConstantFoldInstruction unless there is a use of theChris Lattner2009-10-151-22/+25
| | | | | | | | | instruction (which disqualifies stores, unreachable, etc) and at least the first operand is a constant. This filters out a lot of obvious cases that can't be folded. Also, switch the IRBuilder to a TargetFolder, which tries harder. llvm-svn: 84170
* Use isVoidTy()Devang Patel2009-10-141-7/+7
| | | | llvm-svn: 84118
* make instcombine's instruction sinking more aggressive in theChris Lattner2009-10-141-3/+10
| | | | | | presence of PHI nodes. llvm-svn: 84103
* Check void type before using RAUWd.Devang Patel2009-10-131-4/+15
| | | | llvm-svn: 84049
* Do not check use_empty() before replaceAllUsesWith(). This gives ↵Devang Patel2009-10-131-9/+6
| | | | | | ValueHandles a chance to get properly updated. llvm-svn: 84033
* Fix warning.Dale Johannesen2009-10-121-1/+1
| | | | llvm-svn: 83870
* populate instcombine's initial worklist more carefully, causingChris Lattner2009-10-121-18/+26
| | | | | | | | | | | it to visit instructions from the start of the function to the end of the function in the first path. This greatly speeds up some pathological cases (e.g. PR5150). Try #3, this time with some unneeded debug info stuff removed which was causing dead pointers to be added to the worklist. llvm-svn: 83818
OpenPOWER on IntegriCloud