Nick Lewycky
99f4558117
Revert r54876 r54877 r54906 and r54907. Evan found that these caused a 20%
...
slowdown in bzip2.
llvm-svn: 55113
2008-08-21 05:56:10 +00:00
Evan Cheng
f5a7e51c81
Silence a compiler warning.
...
llvm-svn: 55087
2008-08-20 23:36:48 +00:00
Mon P Wang
1b2c061b73
Fixed shuffle optimizations to handle non power of 2 vectors
...
llvm-svn: 55035
2008-08-20 02:23:25 +00:00
Nick Lewycky
75d4a83f2f
Make this comment clearer. Instead of using an ambiguous ~ (not) on an icmp
...
predicate, swap the order of the operands.
llvm-svn: 54907
2008-08-17 20:02:02 +00:00
Nick Lewycky
53b44029d6
Consider the case where xor by -1 and xor by 128 have been combined already to
...
produce an xor by 127.
llvm-svn: 54906
2008-08-17 19:58:24 +00:00
Nick Lewycky
18c6f56c76
I found a better place for this optz'n.
...
llvm-svn: 54877
2008-08-17 07:54:14 +00:00
Nick Lewycky
18f50b2637
Xor'ing both sides of icmp by sign-bit is equivalent to swapping signedness of
...
the predicate.
Also, make this optz'n apply in more cases where it's safe to do so.
llvm-svn: 54876
2008-08-17 07:34:14 +00:00
Chris Lattner
1d23915a8f
use smallvector instead of vector for a couple worklists. This speeds up instcombine
...
by ~10% on some testcases.
llvm-svn: 54811
2008-08-15 04:03:01 +00:00
Dan Gohman
6134fbccef
Fix a bogus srem rule - a negative value srem'd by a power-of-2
...
can have a non-negative result; for example, -16%16 is 0. Also,
clarify the related comments. This fixes PR2670.
llvm-svn: 54767
2008-08-13 23:12:35 +00:00
Chris Lattner
2aa0ff27aa
Implement support for simplifying vector comparisons by 0.0 and 1.0 like we
...
do for scalars. Patch contributed by Nicolas Capens
This also generalizes the previous xforms to work on long double, now that
isExactlyValue works for long double.
llvm-svn: 54653
2008-08-11 22:06:05 +00:00
Dan Gohman
ac22cfcae9
Fix a shufflevector instcombine that was emitting invalid masks indices
...
when it meant to be emitting undef indices.
llvm-svn: 54417
2008-08-06 18:17:32 +00:00
Chris Lattner
f5b353c1fd
optimize a common idiom generated by clang for bitfield access, PR2638.
...
llvm-svn: 54408
2008-08-06 07:35:52 +00:00
Chris Lattner
7bdaecb7f4
Zap sitofp/fptoui pairs. In all cases when the sign difference
...
matters, the result is undefined anyway.
llvm-svn: 54396
2008-08-06 05:13:06 +00:00
Nick Lewycky
bf42893567
Reinstate this optimization, but without the miscompile. Thanks to Bill for
...
tracking down that this was breaking llvm-gcc bootstrap on Linux.
llvm-svn: 54394
2008-08-06 04:54:03 +00:00
Bill Wendling
ee12a7aeff
Revert r53282. This was causing a miscompile on Linux. Also, the transformation
...
looks bogus. Please see PR2629 for details on why this is breaking things.
llvm-svn: 54372
2008-08-05 21:23:45 +00:00
Nate Begeman
fecbc8cff1
Add vector shifts to the IR, patch by Eli Friedman.
...
CodeGen & Clang work coming next.
llvm-svn: 54161
2008-07-29 15:49:41 +00:00
Dan Gohman
fa1211f69b
Enable first-class aggregates support.
...
Remove the GetResultInst instruction. It is still accepted in LLVM assembly
and bitcode, where it is now auto-upgraded to ExtractValueInst. Also, remove
support for return instructions with multiple values. These are auto-upgraded
to use InsertValueInst instructions.
The IRBuilder still accepts multiple-value returns, and auto-upgrades them
to InsertValueInst instructions.
llvm-svn: 53941
2008-07-23 00:34:11 +00:00
Chris Lattner
c600c53d1f
Fix PR2553
...
llvm-svn: 53715
2008-07-17 06:07:20 +00:00
Matthijs Kooijman
c1d7477ed2
Redo InstCombiner::visitExtractValueInst. Instead of using the (complicate)
...
FindInsertedValue, it now performs a number of simple transformations that
should result in the same effect when applied iteratively.
llvm-svn: 53673
2008-07-16 12:55:45 +00:00
Evan Cheng
c97094552c
Fix PR2296. Do not transform x86_sse2_storel_dq into a full-width store.
...
llvm-svn: 53666
2008-07-16 07:28:14 +00:00
Chris Lattner
16395e51f4
Fix PR2506 by being a bit more careful about reverse fact propagation when
...
disproving a condition. This actually compiles the existing testcase
(udiv_select_to_select_shift) to:
define i64 @test(i64 %X, i1 %Cond) {
entry:
%divisor1.t = lshr i64 %X, 3 ; <i64> [#uses=1]
%quotient2 = lshr i64 %X, 3 ; <i64> [#uses=1]
%sum = add i64 %divisor1.t, %quotient2 ; <i64> [#uses=1]
ret i64 %sum
}
instead of:
define i64 @test(i64 %X, i1 %Cond) {
entry:
%quotient1.v = select i1 %Cond, i64 3, i64 4 ; <i64> [#uses=1]
%quotient1 = lshr i64 %X, %quotient1.v ; <i64> [#uses=1]
%quotient2 = lshr i64 %X, 3 ; <i64> [#uses=1]
%sum = add i64 %quotient1, %quotient2 ; <i64> [#uses=1]
ret i64 %sum
}
llvm-svn: 53534
2008-07-14 00:15:52 +00:00
Nick Lewycky
f76aa23b54
Enhance analysis of srem.
...
Remove dead code analyzing urem. 'urem' of power-of-2 is canonicalized to an
'and' instruction.
llvm-svn: 53506
2008-07-12 05:04:38 +00:00
Nick Lewycky
45e127ab20
Document 'mask' in this calculation.
...
llvm-svn: 53454
2008-07-11 08:16:26 +00:00
Nick Lewycky
da405e1155
Remove misleading constant from comment.
...
llvm-svn: 53452
2008-07-11 07:36:19 +00:00
Nick Lewycky
f95b64acaa
Add another optimization from PR2330. Also catch some missing cases that are
...
similar.
llvm-svn: 53451
2008-07-11 07:20:53 +00:00
Chris Lattner
3994bed1a9
a missed optimization that Eli spotted
...
llvm-svn: 53449
2008-07-11 06:40:29 +00:00
Chris Lattner
13a6911ea2
another bug in the same line.
...
llvm-svn: 53448
2008-07-11 06:38:16 +00:00
Chris Lattner
de89b507dd
fix a bug spotted by Eli's eagle eyes
...
llvm-svn: 53447
2008-07-11 06:36:01 +00:00
Chris Lattner
bd25b8507c
simplify and merge a bunch of code. Instead of comparing against
...
the min/max values for an integer type, compare against the min/max
values we can prove contain the input. This might be a tighter bound,
so this is general goodness.
llvm-svn: 53446
2008-07-11 05:40:05 +00:00
Chris Lattner
38a50c9528
fold away (x <= cst) earlier, allowing us to not have to
...
handle them in some code.
llvm-svn: 53445
2008-07-11 05:08:55 +00:00
Chris Lattner
6af608b8ce
Fix folding of icmp's of i1 where the comparison is signed. The code
...
was using the algorithm for folding unsigned comparisons which is
completely wrong. This has been broken since the signless types change.
llvm-svn: 53444
2008-07-11 04:20:58 +00:00
Chris Lattner
4fa8bb3430
Fix a bogus optimization: folding (slt (zext i1 A to i32), 1) -> (slt i1 A, true)
...
This cause a regression in InstCombine/JavaCompare, which was doing the right
thing on accident. To handle the missed case, generalize the comparisons based
on masked bits a little bit to handle comparisons against the max value. For
example, we can now xform (slt i32 (and X, 4), 4) -> (setne i32 (and X, 4), 4)
llvm-svn: 53443
2008-07-11 04:09:09 +00:00
Nick Lewycky
6193a564ab
Fix overzealous optimization. Thanks to Duncan Sands for pointing out my error!
...
llvm-svn: 53393
2008-07-10 05:51:40 +00:00
Nick Lewycky
bb89c2a3f6
Simplify, suggested by Chris Lattner.
...
llvm-svn: 53283
2008-07-09 07:35:26 +00:00
Nick Lewycky
f9c27c343a
Fold (a < 8) && (b < 8) into (a|b) < 8 for unsigned less or greater than.
...
llvm-svn: 53282
2008-07-09 07:29:11 +00:00
Nick Lewycky
364661c43e
Fold ((1 << a) & 1) to (a == 0).
...
llvm-svn: 53276
2008-07-09 05:20:13 +00:00
Nick Lewycky
0d3645e673
Reduce x - y to -y when we know the 'x' part will get masked off anyways.
...
llvm-svn: 53271
2008-07-09 04:32:37 +00:00
Chris Lattner
501d78fdc0
Fix PR2496, a really nasty bug which involved sinking volatile loads
...
into phis. This is actually the same bug as PR2262 /
2008-04-29-VolatileLoadDontMerge.ll, but I missed checking the first
predecessor for multiple successors. Testcase here:
InstCombine/2008-07-08-VolatileLoadMerge.ll
llvm-svn: 53240
2008-07-08 17:18:32 +00:00
Dan Gohman
38740a98b2
Make DenseMap's insert return a pair, to more closely resemble std::map.
...
llvm-svn: 53177
2008-07-07 17:46:23 +00:00
Nick Lewycky
9f1a4dc672
Fix missed optimization opportunity when analyzing cast of mul and select.
...
llvm-svn: 53151
2008-07-05 21:19:34 +00:00
Evan Cheng
da3db11db3
- Re-apply 52748 and friends with fix. GetConstantStringInfo() returns an empty string for ConstantAggregateZero case which surprises selectiondag.
...
- Correctly handle memcpy from constant string which is zero-initialized.
llvm-svn: 52891
2008-06-30 07:31:25 +00:00
Anton Korobeynikov
a7c583d584
Revert (52748 and friends):
...
Move GetConstantStringInfo to lib/Analysis. Remove
string output routine from Constant. Update all
callers. Change debug intrinsic api slightly to
accomodate move of routine, these now return values
instead of strings.
This unbreaks llvm-gcc bootstrap.
llvm-svn: 52884
2008-06-29 17:57:03 +00:00
Eric Christopher
d0ab9c47e6
Move GetConstantStringInfo to lib/Analysis. Remove
...
string output routine from Constant. Update all
callers. Change debug intrinsic api slightly to
accomodate move of routine, these now return values
instead of strings.
llvm-svn: 52748
2008-06-26 00:31:12 +00:00
Chris Lattner
c9c81fb0df
Fix PR2488, a case where we deleted stack restores too aggressively.
...
llvm-svn: 52702
2008-06-25 05:59:28 +00:00
Eli Friedman
d3449df326
Fix for PR2479: correctly optimize expressions like (a > 13) & (a ==
...
15).
See also PR1800, which is about the signed case.
llvm-svn: 52608
2008-06-21 23:36:13 +00:00
Chris Lattner
f3ecd2d290
Fix PR2471, which is a bug involving an invalid promotion from a conditional load.
...
llvm-svn: 52525
2008-06-20 05:12:56 +00:00
Bill Wendling
cd6fb1d0a8
Remove dead code causing a warning.
...
llvm-svn: 52502
2008-06-19 18:00:44 +00:00
Dan Gohman
ed2250990a
Use Instruction::moveBefore instead of manipulating the instruction list
...
directly.
llvm-svn: 52498
2008-06-19 17:47:47 +00:00
Chris Lattner
78119b4742
Fix the regressions on sext-misc.ll my patch yesterday caused.
...
llvm-svn: 52466
2008-06-18 18:11:55 +00:00
Chris Lattner
ef36dcd10b
implement some simple bswap optimizations, rdar://5992453
...
llvm-svn: 52442
2008-06-18 04:33:20 +00:00