Tanya Lattner
6fbe85279f
Fixed minor bug in SafeToHoist and made some changes suggested by Chris.
...
llvm-svn: 7614
2003-08-05 20:39:02 +00:00
Tanya Lattner
48745a598c
Fixed LICM bug that hoists trapping instructions that are not guaranteed to execute.
...
llvm-svn: 7612
2003-08-05 18:45:46 +00:00
Chris Lattner
686e94e760
DEBUG got moved to Support/Debug.h
...
llvm-svn: 7492
2003-08-01 22:15:03 +00:00
Chris Lattner
c5b0f39c96
Instcombine: (A >> c1) << c2 for signed integers
...
llvm-svn: 7295
2003-07-24 18:38:56 +00:00
Chris Lattner
bf9589bf1f
Reorganization of code, no functional changes.
...
Now it shoudl be a bit more efficient
llvm-svn: 7292
2003-07-24 17:52:58 +00:00
Chris Lattner
785e8453f0
Allow folding several instructions into casts, which can simplify a lot
...
of codes. For example,
short kernel (short t1) {
t1 >>= 8; t1 <<= 8;
return t1;
}
became:
short %kernel(short %t1.1) {
%tmp.3 = shr short %t1.1, ubyte 8 ; <short> [#uses=1]
%tmp.5 = cast short %tmp.3 to int ; <int> [#uses=1]
%tmp.7 = shl int %tmp.5, ubyte 8 ; <int> [#uses=1]
%tmp.8 = cast int %tmp.7 to short ; <short> [#uses=1]
ret short %tmp.8
}
before, now it becomes:
short %kernel(short %t1.1) {
%tmp.3 = shr short %t1.1, ubyte 8 ; <short> [#uses=1]
%tmp.8 = shl short %tmp.3, ubyte 8 ; <short> [#uses=1]
ret short %tmp.8
}
which will become:
short %kernel(short %t1.1) {
%tmp.3 = and short %t1.1, 0xFF00
ret short %tmp.3
}
This implements cast-set.ll:test4 and test5
llvm-svn: 7290
2003-07-24 17:35:25 +00:00
Chris Lattner
6d10220481
Add comments
...
llvm-svn: 7283
2003-07-23 21:41:57 +00:00
Chris Lattner
ac8a2be5e4
Remove explicit check for: not (not X) = X, it is already handled because xor is commutative
...
- InstCombine: (X & C1) ^ C2 --> (X & C1) | C2 iff (C1&C2) == 0
- InstCombine: (X | C1) ^ C2 --> (X | C1) & ~C2 iff (C1&C2) == C2
llvm-svn: 7282
2003-07-23 21:37:07 +00:00
Chris Lattner
f453a39185
InstCombine: (X ^ C1) & C2 --> (X & C2) iff (C1&C2) == 0
...
llvm-svn: 7272
2003-07-23 19:36:21 +00:00
Chris Lattner
80d9c3a900
- InstCombine: (X | C1) & C2 --> X & C2 iff C1 & C1 == 0
...
- InstCombine: (X | C) & C --> C
- InstCombine: (X | C1) & C2 --> (X | (C1&C2)) & C2
llvm-svn: 7269
2003-07-23 19:25:52 +00:00
Chris Lattner
76c1da471c
IC: (X & C1) | C2 --> (X | C2) & (C1|C2)
...
IC: (X ^ C1) | C2 --> (X | C2) ^ (C1&~C2)
We are now guaranteed that all 'or's will be inside of 'and's, and all 'and's
will be inside of 'xor's, if the second operands are constants.
llvm-svn: 7264
2003-07-23 18:29:44 +00:00
Chris Lattner
4b43cd9700
IC: (X ^ C1) & C2 --> (X & C2) ^ (C1&C2)
...
Minor code cleanup
llvm-svn: 7262
2003-07-23 17:57:01 +00:00
Chris Lattner
ae691a3068
InstCombine: (X ^ 4) == 8 --> X == 12
...
llvm-svn: 7260
2003-07-23 17:26:36 +00:00
Chris Lattner
b07de65646
IC: (X & 5) == 13 --> false
...
IC: (X | 8) == 4 --> false
llvm-svn: 7257
2003-07-23 17:02:11 +00:00
Chris Lattner
6ad460b336
Simplify code by using ConstantInt::getRawValue instead of checking to see
...
whether the constant is signed or unsigned, then casting
llvm-svn: 7252
2003-07-23 15:22:26 +00:00
Chris Lattner
74a266d229
Fix bug: TailDup/2003-07-22-InfiniteLoop.ll
...
llvm-svn: 7243
2003-07-23 03:32:41 +00:00
Chris Lattner
7594fa7280
- InstCombine (cast (xor A, B) to bool) ==> (setne A, B)
...
- InstCombine (cast (and X, (1 << size(X)-1)) to bool) ==> x < 0
llvm-svn: 7241
2003-07-22 21:46:59 +00:00
John Criswell
98946bac5b
Added code that checks to see if a global variable is external before replacing
...
a load of the global variable with the variable's constant value.
llvm-svn: 7216
2003-07-21 19:42:57 +00:00
John Criswell
dbaf5f719c
Dinakar and I fixed a bug where we were trying to get the initializer of
...
an external constant. Since external constants don't have initializers, we
were failing on an assert() call in llvm/GlobalVariable.h.
llvm-svn: 7193
2003-07-17 19:06:55 +00:00
Chris Lattner
0cc143577c
Add support for elimination of load instruction from global constants
...
llvm-svn: 6912
2003-06-26 05:06:25 +00:00
Chris Lattner
ebbc28f553
Instcombine: X * -1 -> -X
...
llvm-svn: 6904
2003-06-25 17:09:20 +00:00
Chris Lattner
0903331006
Fix bug: Mem2Reg/2003-06-26-IterativePromote.ll
...
llvm-svn: 6901
2003-06-25 14:58:56 +00:00
Chris Lattner
2cd94ee470
Fix bug: ADCE/2003-06-24-BadSuccessor.ll
...
llvm-svn: 6891
2003-06-24 23:02:45 +00:00
Chris Lattner
aac87d1e58
Do not mark ALL terminators live if any instruciton in the block is live. We only
...
want to mark it live if it is an unconditional branch. This fixes bug:
ADCE/2002-05-28-Crash.ll and makes this pass _much_ more useful.
llvm-svn: 6887
2003-06-24 21:49:45 +00:00
Chris Lattner
867b7661cb
Fix bug: SCCP/2003-06-24-OverdefinedPHIValue.ll
...
llvm-svn: 6883
2003-06-24 20:29:52 +00:00
Chris Lattner
e1051d9fcf
Fix bug: TailDup/2003-06-24-Simpleloop.ll
...
llvm-svn: 6881
2003-06-24 19:48:06 +00:00
Chris Lattner
e1f9e715c6
Implement new transforms:
...
Replace (cast (sub A, B) to bool) -> (setne A, B)
Replace (cast (add A, B) to bool) -> (setne A, -B)
llvm-svn: 6873
2003-06-23 21:59:52 +00:00
Chris Lattner
a98d464fd6
Add paranoia checking
...
llvm-svn: 6856
2003-06-22 20:46:00 +00:00
Chris Lattner
99633d8cd2
Test change
...
llvm-svn: 6852
2003-06-22 20:25:27 +00:00
Chris Lattner
6d372c7450
Initial checkin of Tail duplication pass.
...
llvm-svn: 6846
2003-06-22 20:10:28 +00:00
Chris Lattner
9a0da3e531
Instcombine cast (getelementptr Ptr, 0, 0, 0) to ... into: cast Ptr to ...
...
This fixes type safety problems in a variety of benchmarks that were confusing
DSA.
llvm-svn: 6837
2003-06-21 23:12:02 +00:00
Chris Lattner
29e8adc038
Implement the functionality of InstCombine/call.ll
...
llvm-svn: 6783
2003-06-19 17:00:31 +00:00
Chris Lattner
2b01ee820e
Don't corrupt memory when removing an instruction from the program, but
...
not the worklist
llvm-svn: 6733
2003-06-17 03:57:18 +00:00
Chris Lattner
64ec8f36aa
Fix bug: ADCE/2003-06-11-InvalidCFG.ll
...
This was because we were deleting large chunks of functions without an exit block, because the post-dominance
information was not useful. This broke crafty and twolf.
llvm-svn: 6698
2003-06-16 12:10:45 +00:00
Chris Lattner
1bbfcd901c
Fix bug: InstCombine/2003-06-05-BranchInvertInfLoop.ll
...
llvm-svn: 6630
2003-06-05 20:12:51 +00:00
Chris Lattner
95d21756aa
Clean up previous code.
...
Add new combination to turn seteq X, 0 -> not(cast X to bool)
llvm-svn: 6604
2003-06-04 05:10:11 +00:00
Chris Lattner
b2ea03d03a
Implement combination of boolean not with branch
...
llvm-svn: 6599
2003-06-04 04:46:00 +00:00
Chris Lattner
eaafbfd2df
Implement xform: (X != 0) -> (bool)X
...
llvm-svn: 6506
2003-06-01 03:35:25 +00:00
Chris Lattner
1c10a30949
Okay totally give up on trying to optimize aggregates that cannot be completely
...
broken up into their elements. Too many programs break because of this.
llvm-svn: 6440
2003-05-30 19:22:14 +00:00
Chris Lattner
bf8c1cb6a3
add a check that allows the SRoA pass to avoid breaking programs, even if their
...
behavior is technically undefined
llvm-svn: 6438
2003-05-30 18:09:57 +00:00
Chris Lattner
c9d950434b
Fix bug: ScalarRepl/2003-05-30-MultiLevel.ll
...
llvm-svn: 6428
2003-05-30 05:26:30 +00:00
Chris Lattner
0d415b2dd3
Fix bug: ScalarRepl/2003-05-29-ArrayFail.ll
...
llvm-svn: 6425
2003-05-30 04:15:41 +00:00
Chris Lattner
58c7aaa0e5
Add comment
...
llvm-svn: 6415
2003-05-29 20:26:30 +00:00
Chris Lattner
416e30b07b
Fix bug: Instcombine/2003-05-27-ConstExprCrash.ll
...
llvm-svn: 6352
2003-05-27 16:40:51 +00:00
Chris Lattner
8a6c3b5cbe
* Actually USE the statistic that we made
...
* Implement SRoA for arrays
llvm-svn: 6349
2003-05-27 16:09:27 +00:00
Chris Lattner
5c093a1a93
Implementation of the simple "scalar replacement of aggregates" transformation
...
llvm-svn: 6346
2003-05-27 15:45:27 +00:00
Chris Lattner
1fde83c9b5
Fix bug: InstCombine/2003-05-26-CastMiscompile.ll
...
llvm-svn: 6338
2003-05-26 23:41:32 +00:00
Chris Lattner
e58f6153f4
Remove using declarations
...
llvm-svn: 6306
2003-05-22 22:00:07 +00:00
Chris Lattner
91c5d68261
Minor cleanups.
...
This hunk:
- } else if (Src->getNumOperands() == 2 && Src->use_size() == 1) {
+ } else if (Src->getNumOperands() == 2) {
Allows GEP folding to be more aggressive, which reduces the number of instructions
and can dramatically speed up BasicAA in some cases.
llvm-svn: 6286
2003-05-22 19:07:21 +00:00
Misha Brukman
825e174bf7
Hopefully, the final fix for `[Pp]ropogate'.
...
llvm-svn: 6251
2003-05-20 21:01:22 +00:00