summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/InstCombine
Commit message (Collapse)AuthorAgeFilesLines
...
* InstCombine: Canonicalize (2^n)-1 - x into (2^n)-1 ^ x iff x is known to be ↵Benjamin Kramer2011-12-242-0/+14
| | | | | | | | | | | smaller than 2^n. This has the obvious advantage of being commutable and is always a win on x86 because const - x wastes a register there. On less weird architectures this may lead to a regression because other arithmetic doesn't fuse with it anymore. I'll address that problem in a followup. llvm-svn: 147254
* Refactor code used in InstCombine::FoldAndOfICmps to new file.Pete Cooper2011-12-171-72/+11
| | | | | | This will be used by SimplifyCfg in a later commit. llvm-svn: 146803
* The powers that be have decided that LLVM IR should now support 16-bitDan Gohman2011-12-172-1/+6
| | | | | | | | "half precision" floating-point with a first-class type. This patch adds basic IR support (but not codegen support). llvm-svn: 146786
* Added InstCombine for "select cond, ~cond, x" type patternsPete Cooper2011-12-151-0/+7
| | | | | | These can be reduced to "~cond & x" or "~cond | x" llvm-svn: 146624
* LLVMBuild: Remove trailing newline, which irked me.Daniel Dunbar2011-12-121-1/+0
| | | | llvm-svn: 146409
* Add support for vectors of pointers.Nadav Rotem2011-12-052-2/+9
| | | | llvm-svn: 145801
* Fix a few more places where TargetData/TargetLibraryInfo is not being passed.Chad Rosier2011-12-025-17/+23
| | | | | | Add FIXMEs to places that are non-trivial to fix. llvm-svn: 145661
* Last bit of TargetLibraryInfo propagation. Also fixed a case for TargetDataChad Rosier2011-12-013-13/+17
| | | | | | | where it appeared beneficial to pass. More of rdar://10500969 llvm-svn: 145630
* Improved fix for abs(val) != 0 to check other similar case. Also fixed ↵Pete Cooper2011-12-011-6/+10
| | | | | | style issues and confusing comment llvm-svn: 145618
* Added instcombine pattern to spot comparing -val or val against 0.Pete Cooper2011-12-011-0/+14
| | | | | | | | (val != 0) == (-val != 0) so "abs(val) != 0" becomes "val != 0" Fixes <rdar://problem/10482509> llvm-svn: 145563
* Whitespace.Chad Rosier2011-11-301-3/+1
| | | | llvm-svn: 145470
* Add support for sqrt, sqrtl, and sqrtf in TargetLibraryInfo. Disable Chad Rosier2011-11-292-3/+6
| | | | | | | | (fptrunc (sqrt (fpext x))) -> (sqrtf x) transformation if -fno-builtin is specified. rdar://10466410 llvm-svn: 145460
* build/CMake: Finish removal of add_llvm_library_dependencies.Daniel Dunbar2011-11-291-8/+0
| | | | llvm-svn: 145420
* Zap some completely ridiculous code. There's probably a miscompile here, ↵Eli Friedman2011-11-291-1/+1
| | | | | | but I don't really want to try to write a testcase involving an invoke returning a pointer to a varargs function... llvm-svn: 145347
* Add a missing safety check to ProcessUGT_ADDCST_ADD. Fixes PR11438.Eli Friedman2011-11-281-0/+8
| | | | llvm-svn: 145316
* Refactor code to use new attribute getters on CallSite for NoCapture and ByVal.Nick Lewycky2011-11-201-2/+2
| | | | | | | | Suggested in code review by Eli. That code in InstCombine looks kinda suspicious. llvm-svn: 145013
* Remove all remaining uses of Value::getNameStr().Benjamin Kramer2011-11-151-1/+1
| | | | llvm-svn: 144648
* InstCombine now optimizes vector udiv by power of 2 to shiftsPete Cooper2011-11-071-5/+9
| | | | | | Fixes r8429 llvm-svn: 144036
* build: Add initial cut at LLVMBuild.txt files.Daniel Dunbar2011-11-031-0/+23
| | | | llvm-svn: 143634
* Make sure we use the right insertion point when instcombine replaces a PHI ↵Eli Friedman2011-11-011-3/+4
| | | | | | with another instruction. (Specifically, don't insert an arbitrary instruction before a PHI.) Fixes PR11275. llvm-svn: 143437
* Minor simplification: use ShuffleVectorInst::getMaskValue instead of a more ↵Eli Friedman2011-10-211-2/+2
| | | | | | expensive helper. llvm-svn: 142672
* Extend instcombine's shufflevector simplification to handle more cases where ↵Eli Friedman2011-10-211-61/+195
| | | | | | the input and output vectors have different sizes. Patch by Xiaoyi Guo. llvm-svn: 142671
* Add support for the Objective-C personality function to the instructionBill Wendling2011-10-171-2/+5
| | | | | | | | combining of the landingpad instruction. The ObjC personality function acts almost identically to the C++ personality function. In particular, it uses "null" as a "catch-all" value. llvm-svn: 142256
* Add a routine to swap branch instruction operands, and update anyChandler Carruth2011-10-171-6/+3
| | | | | | | | | | | | profile metadata at the same time. Use it to preserve metadata attached to a branch when re-writing it in InstCombine. Add metadata to the canonicalize_branch InstCombine test, and check that it is tranformed correctly. Reviewed by Nick Lewycky! llvm-svn: 142168
* Re-commit 141203, but much more conservative.Jim Grosbach2011-10-051-3/+3
| | | | | | | | Just pull the instruction name, but don't change the order of anything else. That keeps --debug happy and non-crashing, but doesn't change how the worklist gets built. llvm-svn: 141210
* Revert 141203. InstCombine is looping on unit tests.Jim Grosbach2011-10-051-9/+8
| | | | llvm-svn: 141209
* Update InstCombine worklist after instruction transform is complete.Jim Grosbach2011-10-051-8/+9
| | | | | | | | | | | | When updating the worklist for InstCombine, the Add/AddUsersToWorklist functions may access the instruction(s) being added, for debug output for example. If the instructions aren't yet added to the basic block, this can result in a crash. Finish the instruction transformation before adjusting the worklist instead. rdar://10238555 llvm-svn: 141203
* Add a new icmp+select optz'n. Also shows off the load(cst) folding added inNick Lewycky2011-10-021-0/+6
| | | | | | r140966. llvm-svn: 140969
* Enhance a couple places where we were doing constant folding of instructions,Nick Lewycky2011-10-021-1/+6
| | | | | | but not load instructions. Noticed by inspection. llvm-svn: 140966
* Don't modify constant in-place.Jim Grosbach2011-09-301-3/+4
| | | | llvm-svn: 140875
* float comparison to double 'zero' constant can just be a float 'zero.'Jim Grosbach2011-09-301-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | InstCombine was incorrectly considering the conversion of the constant zero to be unsafe. We want to transform: define float @bar(float %x) nounwind readnone optsize ssp { %conv = fpext float %x to double %cmp = fcmp olt double %conv, 0.000000e+00 %conv1 = zext i1 %cmp to i32 %conv2 = sitofp i32 %conv1 to float ret float %conv2 } Into: define float @bar(float %x) nounwind readnone optsize ssp { %cmp = fcmp olt float %x, 0.000000e+00 ; <---- This %conv1 = zext i1 %cmp to i32 %conv2 = sitofp i32 %conv1 to float ret float %conv2 } rdar://10215914 llvm-svn: 140869
* Tidy up. Trailing whitespace.Jim Grosbach2011-09-301-220/+220
| | | | llvm-svn: 140865
* Inlining often produces landingpad instructions with repeatedDuncan Sands2011-09-302-0/+338
| | | | | | | | | | | | | | catch or repeated filter clauses. Teach instcombine a bunch of tricks for simplifying landingpad clauses. Currently the code only recognizes the GNU C++ and Ada personality functions, but that doesn't stop it doing a bunch of "generic" transforms which are hopefully fine for any real-world personality function. If these "generic" transforms turn out not to be generic, they can always be conditioned on the personality function. Probably someone should add the ObjC++ personality function. I didn't as I don't know anything about it. llvm-svn: 140852
* Clean up uses of switch instructions so they are not dependent on the ↵Eli Friedman2011-09-291-5/+11
| | | | | | operand ordering. Patch by Stepan Dyatkovskiy. llvm-svn: 140803
* Stop emitting instructions with the name "tmp" they eat up memory and have ↵Benjamin Kramer2011-09-276-42/+34
| | | | | | | | to be uniqued, without any benefit. If someone prefers %tmp42 to %42, run instnamer. llvm-svn: 140634
* Fix an infinite loop where a transform in InstCombiner::visitAnd claims a ↵Eli Friedman2011-09-191-21/+22
| | | | | | | | construct is changed when it is not. (See included testcase.) Patch by Xiaoyi Guo. llvm-svn: 140072
* Make demanded-elt simplification for shufflevector slightly stronger. ↵Eli Friedman2011-09-151-0/+3
| | | | | | Spotted by inspection. llvm-svn: 139768
* Split the init.trampoline intrinsic, which currently combines GCC'sDuncan Sands2011-09-062-11/+90
| | | | | | | | | | | | | | | | | | | | init.trampoline and adjust.trampoline intrinsics, into two intrinsics like in GCC. While having one combined intrinsic is tempting, it is not natural because typically the trampoline initialization needs to be done in one function, and the result of adjust trampoline is needed in a different (nested) function. To get around this llvm-gcc hacks the nested function lowering code to insert an additional parent variable holding the adjust.trampoline result that can be accessed from the child function. Dragonegg doesn't have the luxury of tweaking GCC code, so it stored the result of adjust.trampoline in the memory GCC set aside for the trampoline itself (this is always available in the child function), and set up some new memory (using an alloca) to hold the trampoline. Unfortunately this breaks Go which allocates trampoline memory on the heap and wants to use it even after the parent has exited (!). Rather than doing even more hacks to get Go working, it seemed best to just use two intrinsics like in GCC. Patch mostly by Sanjoy Das. llvm-svn: 139140
* Use Duncan's patch to delete the instructions in reverse order (minus the ↵Bill Wendling2011-09-041-6/+10
| | | | | | landingpad and terminator). llvm-svn: 139090
* Update comments to reflect reality.Bill Wendling2011-09-021-2/+1
| | | | llvm-svn: 139023
* Reduce indentation. No functionality change.Bill Wendling2011-09-011-17/+18
| | | | llvm-svn: 138968
* Change worklist driven deletion to be an iterative process.Bill Wendling2011-09-011-26/+5
| | | | | | Duncan noticed this! llvm-svn: 138967
* Resubmit with fix. Properly remove the instructions except for landingpad, ↵Bill Wendling2011-09-011-9/+28
| | | | | | which should be removed only when its invokes are. llvm-svn: 138932
* Submitted this too early.Bill Wendling2011-09-011-5/+0
| | | | llvm-svn: 138931
* Don't DCE the landingpad instruction.Bill Wendling2011-09-011-0/+5
| | | | | | The landingpad instruction can be removed only when its invokes are removed. llvm-svn: 138930
* Fixes following the CR by Chris and Duncan:Nadav Rotem2011-08-291-5/+0
| | | | | | | Optimize chained bitcasts of the form A->B->A. Undo r138722 and change isEliminableCastPair to allow this case. llvm-svn: 138756
* Bitcasts are transitive. Bitcast-Bitcast-X becomes Bitcast-X.Nadav Rotem2011-08-281-0/+5
| | | | llvm-svn: 138722
* When inserting new instructions, use getFirstInsertionPt instead ofBill Wendling2011-08-251-1/+1
| | | | | | getFirstNonPHI so that it will skip over the landingpad instructions as well. llvm-svn: 138537
* Revert r137655. There is some question about whether the 'landingpad'Bill Wendling2011-08-171-1/+2
| | | | | | instruction should be marked as potentially reading and/or writing memory. llvm-svn: 137863
* Use the getFirstInsertionPt() method instead of getFirstNonPHI + an 'isa<>'Bill Wendling2011-08-162-4/+2
| | | | | | check for a LandingPadInst. llvm-svn: 137745
OpenPOWER on IntegriCloud