summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix InstCombine/2006-11-10-ashr-miscompile.ll a miscompilation introducedChris Lattner2006-11-101-3/+3
| | | | | | by the shr -> [al]shr patch. This was reduced from 176.gcc. llvm-svn: 31653
* Teach ShrinkDemandedConstant how to handle X+C. This implements:Chris Lattner2006-11-091-1/+100
| | | | | | add.ll:test33, add.ll:test34, shift-sra.ll:test2 llvm-svn: 31586
* reenable factoring of GEP expressions, being more precise about theChris Lattner2006-11-081-5/+10
| | | | | | case that it bad to do. llvm-svn: 31563
* make this code more efficient by not creating a phi node we are just going toChris Lattner2006-11-081-36/+33
| | | | | | delete in the first place. This also makes it simpler. llvm-svn: 31562
* disable this factoring optzn for GEPs for now, this severely pessimizes someChris Lattner2006-11-081-1/+1
| | | | | | loops. llvm-svn: 31560
* For PR950:Reid Spencer2006-11-081-204/+175
| | | | | | | | This patch converts the old SHR instruction into two instructions, AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not dependent on the sign of their operands. llvm-svn: 31542
* The wrong parameter was being tested to deturmine i32 vs i64Andrew Lenharth2006-11-031-1/+1
| | | | llvm-svn: 31431
* For PR786:Reid Spencer2006-11-021-10/+6
| | | | | | | | | | Turn on -Wunused and -Wno-unused-parameter. Clean up most of the resulting fall out by removing unused variables. Remaining warnings have to do with unused functions (I didn't want to delete code without review) and unused variables in generated code. Maintainers should clean up the remaining issues when they see them. All changes pass DejaGnu tests and Olden. llvm-svn: 31380
* For PR950:Reid Spencer2006-11-021-117/+128
| | | | | | Replace the REM instruction with UREM, SREM and FREM. llvm-svn: 31369
* Factor gep instructions through phi nodes.Chris Lattner2006-11-011-10/+39
| | | | llvm-svn: 31346
* Turn a phi of many loads into a phi of the address and a single load of theChris Lattner2006-11-011-41/+30
| | | | | | | result. This can significantly shrink code and exposes identities more aggressively. llvm-svn: 31344
* Fix a bug in the previous patchChris Lattner2006-11-011-3/+6
| | | | llvm-svn: 31342
* Fold things like "phi [add (a,b), add(c,d)]" into two phi's and one add.Chris Lattner2006-11-011-3/+57
| | | | | | This triggers thousands of times on multisource. llvm-svn: 31341
* Simplify code a bit by changing instances of:Reid Spencer2006-10-261-47/+27
| | | | | | | | InsertNewInstBefore(new CastInst(Val, ValTy, Val->GetName()), I) into: InsertCastBefore(Val, ValTy, I) llvm-svn: 31204
* For PR950:Reid Spencer2006-10-261-132/+249
| | | | | | | | Make necessary changes to support DIV -> [SUF]Div. This changes llvm to have three division instructions: signed, unsigned, floating point. The bytecode and assembler are bacwards compatible, however. llvm-svn: 31195
* Fix miscompilation of MallocBench/espresso which code review pointed outChris Lattner2006-10-201-1/+1
| | | | | | but apparently didn't make it into the final patch. llvm-svn: 31070
* For PR950:Reid Spencer2006-10-201-278/+316
| | | | | | | | This patch implements the first increment for the Signless Types feature. All changes pertain to removing the ConstantSInt and ConstantUInt classes in favor of just using ConstantInt. llvm-svn: 31063
* While creating mask, use 1ULL instead of 1.Devang Patel2006-10-201-1/+1
| | | | llvm-svn: 31062
* It is OK to remove extra cast if operation is EQ/NE even though sourceDevang Patel2006-10-191-2/+3
| | | | | | and destination sign may not match but other conditions are met. llvm-svn: 31056
* Typo Typo.Devang Patel2006-10-191-1/+1
| | | | llvm-svn: 31055
* Typo.Devang Patel2006-10-191-1/+1
| | | | llvm-svn: 31054
* Fix bug in PR454 resolution. Added new test case.Devang Patel2006-10-191-1/+15
| | | | | | This fixes llvmAsmParser.cpp miscompile by llvm on PowerPC Darwin. llvm-svn: 31053
* Undo Chris' last patch, it caused a regression.Reid Spencer2006-10-161-2/+2
| | | | llvm-svn: 30991
* fix a buggy check that accidentally disabled this xformChris Lattner2006-10-151-1/+1
| | | | llvm-svn: 30967
* add a new SimplifyDemandedVectorElts method, which works similarly toChris Lattner2006-10-051-8/+254
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SimplifyDemandedBits. The idea is that some operations can be simplified if not all of the computed elements are needed. Some targets (like x86) have a large number of intrinsics that operate on a single element, but pass other elts through unmodified. If those other elements are not needed, the intrinsics can be simplified to scalar operations, and insertelement ops can be removed. This turns (f.e.): ushort %Convert_sse(float %f) { %tmp = insertelement <4 x float> undef, float %f, uint 0 ; <<4 x float>> [#uses=1] %tmp10 = insertelement <4 x float> %tmp, float 0.000000e+00, uint 1 ; <<4 x float>> [#uses=1] %tmp11 = insertelement <4 x float> %tmp10, float 0.000000e+00, uint 2 ; <<4 x float>> [#uses=1] %tmp12 = insertelement <4 x float> %tmp11, float 0.000000e+00, uint 3 ; <<4 x float>> [#uses=1] %tmp28 = tail call <4 x float> %llvm.x86.sse.sub.ss( <4 x float> %tmp12, <4 x float> < float 1.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00 > ) ; <<4 x float>> [#uses=1] %tmp37 = tail call <4 x float> %llvm.x86.sse.mul.ss( <4 x float> %tmp28, <4 x float> < float 5.000000e-01, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00 > ) ; <<4 x float>> [#uses=1] %tmp48 = tail call <4 x float> %llvm.x86.sse.min.ss( <4 x float> %tmp37, <4 x float> < float 6.553500e+04, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00 > ) ; <<4 x float>> [#uses=1] %tmp59 = tail call <4 x float> %llvm.x86.sse.max.ss( <4 x float> %tmp48, <4 x float> zeroinitializer ) ; <<4 x float>> [#uses=1] %tmp = tail call int %llvm.x86.sse.cvttss2si( <4 x float> %tmp59 ) ; <int> [#uses=1] %tmp69 = cast int %tmp to ushort ; <ushort> [#uses=1] ret ushort %tmp69 } into: ushort %Convert_sse(float %f) { entry: %tmp28 = sub float %f, 1.000000e+00 ; <float> [#uses=1] %tmp37 = mul float %tmp28, 5.000000e-01 ; <float> [#uses=1] %tmp375 = insertelement <4 x float> undef, float %tmp37, uint 0 ; <<4 x float>> [#uses=1] %tmp48 = tail call <4 x float> %llvm.x86.sse.min.ss( <4 x float> %tmp375, <4 x float> < float 6.553500e+04, float undef, float undef, float undef > ) ; <<4 x float>> [#uses=1] %tmp59 = tail call <4 x float> %llvm.x86.sse.max.ss( <4 x float> %tmp48, <4 x float> < float 0.000000e+00, float undef, float undef, float undef > ) ; <<4 x float>> [#uses=1] %tmp = tail call int %llvm.x86.sse.cvttss2si( <4 x float> %tmp59 ) ; <int> [#uses=1] %tmp69 = cast int %tmp to ushort ; <ushort> [#uses=1] ret ushort %tmp69 } which improves codegen from: _Convert_sse: movss LCPI1_0, %xmm0 movss 4(%esp), %xmm1 subss %xmm0, %xmm1 movss LCPI1_1, %xmm0 mulss %xmm0, %xmm1 movss LCPI1_2, %xmm0 minss %xmm0, %xmm1 xorps %xmm0, %xmm0 maxss %xmm0, %xmm1 cvttss2si %xmm1, %eax andl $65535, %eax ret to: _Convert_sse: movss 4(%esp), %xmm0 subss LCPI1_0, %xmm0 mulss LCPI1_1, %xmm0 movss LCPI1_2, %xmm1 minss %xmm1, %xmm0 xorps %xmm1, %xmm1 maxss %xmm1, %xmm0 cvttss2si %xmm0, %eax andl $65535, %eax ret This is just a first step, it can be extended in many ways. Testcase here: Transforms/InstCombine/vec_demanded_elts.ll llvm-svn: 30752
* Fix a bug from r1.391 of this file, where we checked the size instead ofChris Lattner2006-10-011-2/+2
| | | | | | | the alignment when promoting allocations. This implements InstCombine/cast.ll:test32 llvm-svn: 30682
* Eliminate ConstantBool::True and ConstantBool::False. Instead, provideChris Lattner2006-09-281-53/+56
| | | | | | ConstantBool::getTrue() and ConstantBool::getFalse(). llvm-svn: 30665
* simplifyAndrew Lenharth2006-09-201-12/+8
| | | | llvm-svn: 30535
* We went through all that trouble to compute whether it was safe to transformChris Lattner2006-09-201-6/+46
| | | | | | | this comparison, but never checked it. Whoops, no wonder we miscompiled 177.mesa! llvm-svn: 30511
* Back out Chris' last set of changes. This breaks 177.mesa and povray somehow.Evan Cheng2006-09-201-43/+6
| | | | llvm-svn: 30505
* 80 col.Evan Cheng2006-09-201-1/+2
| | | | llvm-svn: 30504
* If we have an add, do it in the pointer realm, not the int realm. This is ↵Andrew Lenharth2006-09-191-0/+22
| | | | | | critical in the linux kernel for pointer analysis correctness llvm-svn: 30496
* implement select.ll:test19-22Chris Lattner2006-09-191-6/+43
| | | | llvm-svn: 30482
* Fix an infinite loop building the CFEChris Lattner2006-09-181-1/+2
| | | | llvm-svn: 30465
* Implement InstCombine/cast.ll:test31. This speeds up 462.libquantum by 26%.Chris Lattner2006-09-181-4/+39
| | | | llvm-svn: 30456
* Implement Transforms/InstCombine/shift-sra.ll:test0Chris Lattner2006-09-181-0/+20
| | | | llvm-svn: 30450
* Rewrite shift/and/compare sequences to promote better licm of the RHS.Chris Lattner2006-09-181-28/+48
| | | | | | Use isLogicalShift/isArithmeticShift to simplify code. llvm-svn: 30448
* Fix Transforms/InstCombine/2006-09-15-CastToBool.ll and PR913Chris Lattner2006-09-161-0/+5
| | | | llvm-svn: 30405
* Fix PR905 and InstCombine/2006-09-11-EmptyStructCrash.llChris Lattner2006-09-111-1/+2
| | | | llvm-svn: 30266
* Implement Transforms/InstCombine/hoist_instr.llChris Lattner2006-09-091-14/+54
| | | | llvm-svn: 30234
* Turn div X, (Cond ? Y : 0) -> div X, YChris Lattner2006-09-091-19/+68
| | | | | | This implements select.ll::test18. llvm-svn: 30230
* eliminate RegisterOpt. It does the same thing as RegisterPass.Chris Lattner2006-08-271-1/+1
| | | | llvm-svn: 29925
* s|llvm/Support/Visibility.h|llvm/Support/Compiler.h|Chris Lattner2006-08-271-1/+1
| | | | llvm-svn: 29911
* Silence a warning produced in assertions-disabled modeChris Lattner2006-07-111-1/+1
| | | | llvm-svn: 29108
* Add a comment, and fix a typo that broke the build.Owen Anderson2006-07-101-1/+2
| | | | llvm-svn: 29094
* Don't indent the entire function.Owen Anderson2006-07-101-50/+49
| | | | llvm-svn: 29093
* Recognize 16-bit bswaps by relaxing overconstrained pattern.Chris Lattner2006-07-101-2/+5
| | | | | | This implements Transforms/InstCombine/bswap.ll:test[34]. llvm-svn: 29087
* Make instcombine not remove Phi nodes when LCSSA is live.Owen Anderson2006-07-101-47/+51
| | | | llvm-svn: 29083
* Shrink libllvmgcc.dylib by another 23KChris Lattner2006-06-281-2/+4
| | | | llvm-svn: 28972
* Fix Transforms/InstCombine/2006-06-28-infloop.llChris Lattner2006-06-281-0/+6
| | | | llvm-svn: 28961
OpenPOWER on IntegriCloud