Chris Lattner
877a3b424d
implement the next chunk of SROA with memset/memcpy's of aggregates. This
...
implements Transforms/ScalarRepl/memset-aggregate-byte-leader.ll
llvm-svn: 35150
2007-03-19 00:16:43 +00:00
Nick Lewycky
db204ecfbc
Clean up this code and fix subtract miscompile.
...
llvm-svn: 35146
2007-03-18 22:58:46 +00:00
Chris Lattner
0741842b3b
Implement InstCombine/and-xor-merge.ll:test[12].
...
Rearrange some code to simplify it now that shifts are binops
llvm-svn: 35145
2007-03-18 22:51:34 +00:00
Nick Lewycky
17d20fd41e
Propagate ValueRanges across equality.
...
Add some more micro-optimizations: x * 0 = 0, a - x = a --> x = 0.
llvm-svn: 35138
2007-03-18 01:09:32 +00:00
Anton Korobeynikov
22f436da42
Silence warning
...
llvm-svn: 35137
2007-03-17 14:48:06 +00:00
Nick Lewycky
4f73de2b4e
Add more comments and update to new asm syntax.
...
Add new micro-optimizations.
Add icmp predicate snuggling. Given %x ULT 4, "icmp ugt %x, 2" becomes
"icmp eq %x, 3". This doesn't apply in any non-trivial cases yet due to missing
support for NE values in ValueRanges.
llvm-svn: 35119
2007-03-16 02:37:39 +00:00
Zhou Sheng
d8c645b0ba
ShiftAmt might equal to zero. Handle this situation.
...
llvm-svn: 35094
2007-03-14 09:07:33 +00:00
Zhou Sheng
b912844554
Enable KnownZero/One.clear().
...
llvm-svn: 35093
2007-03-14 03:21:24 +00:00
Evan Cheng
b5eb932c93
Correct type info for isLegalAddressImmediate() check.
...
llvm-svn: 35086
2007-03-13 20:34:37 +00:00
Chris Lattner
d1bce956b4
ifdef out some dead code.
...
Fix PR1244 and Transforms/InstCombine/2007-03-13-CompareMerge.ll
llvm-svn: 35082
2007-03-13 14:27:42 +00:00
Zhou Sheng
ebe634e662
For expression like
...
"APInt::getAllOnesValue(ShiftAmt).zextOrCopy(BitWidth)",
to handle ShiftAmt == BitWidth situation, use zextOrCopy() instead of
zext().
llvm-svn: 35080
2007-03-13 06:40:59 +00:00
Zhou Sheng
af4341d441
In APInt version ComputeMaskedBits():
...
1. Ensure VTy, KnownOne and KnownZero have same bitwidth.
2. Make code more efficient.
llvm-svn: 35078
2007-03-13 02:23:10 +00:00
Evan Cheng
720acdfb31
Use new TargetLowering addressing modes hooks.
...
llvm-svn: 35072
2007-03-12 23:27:37 +00:00
Jeff Cohen
00227417d2
Unbreak VC++ build. Do not use identifiers starting with _ as they are reserved and
...
can collide with system defined names. Windows defines _BB, for example.
llvm-svn: 35066
2007-03-12 17:56:27 +00:00
Reid Spencer
1791f23803
Add an APInt version of SimplifyDemandedBits.
...
Patch by Zhou Sheng.
llvm-svn: 35064
2007-03-12 17:25:59 +00:00
Reid Spencer
d9281784be
Add an APInt version of ShrinkDemandedConstant.
...
Patch by Zhou Sheng.
llvm-svn: 35063
2007-03-12 17:15:10 +00:00
Zhou Sheng
be171ee5cd
Avoid to assert on "(KnownZero & KnownOne) == 0".
...
llvm-svn: 35062
2007-03-12 16:54:56 +00:00
Zhou Sheng
b3e00c4656
In function ComputeMaskedBits():
...
1. Replace getSignedMinValue() with getSignBit() for better code readability.
2. Replace APIntOps::shl() with operator<<= for convenience.
3. Make APInt construction more effective.
llvm-svn: 35060
2007-03-12 05:44:52 +00:00
Nick Lewycky
d9bd0bc3e2
Add value ranges. Currently inefficient in both execution time and
...
optimization power.
llvm-svn: 35058
2007-03-10 18:12:48 +00:00
Anton Korobeynikov
8a6dc102d3
Use range tests in LowerSwitch, where possible
...
llvm-svn: 35057
2007-03-10 16:46:28 +00:00
Devang Patel
5f50e61d52
Remove dead comments.
...
llvm-svn: 35053
2007-03-09 23:41:03 +00:00
Devang Patel
bda1250624
Avoid recursion. Use iterative algorithm for RenamePass().
...
llvm-svn: 35052
2007-03-09 23:39:14 +00:00
Devang Patel
58818c530f
Increment iterator now because IVUseShouldUsePostIncValue may remove
...
User from the list of I users.
llvm-svn: 35051
2007-03-09 21:19:53 +00:00
Zhou Sheng
d1eb3d593e
Fix a bug in function ComputeMaskedBits().
...
llvm-svn: 35027
2007-03-08 15:15:18 +00:00
Chris Lattner
abd3bff4f2
This appears correct, enable it so we can see perf changes on testers
...
llvm-svn: 35024
2007-03-08 07:03:55 +00:00
Chris Lattner
9f022d550b
Second half of PR1226. This is currently still disabled, until I have a chance to
...
do the correctness/performance analysis testing.
llvm-svn: 35023
2007-03-08 06:36:54 +00:00
Zhou Sheng
387d7b1a35
Fix a bug in APIntified ComputeMaskedBits().
...
llvm-svn: 35022
2007-03-08 05:42:00 +00:00
Reid Spencer
bb5741fb02
For PR1205:
...
Provide an APIntified version of MaskedValueIsZero. This will (temporarily)
cause a "defined but not used" message from the compiler. It will be used
in the next patch in this series.
Patch by Sheng Zhou.
llvm-svn: 35019
2007-03-08 01:52:58 +00:00
Reid Spencer
aa69640b10
For PR1205:
...
Add a new ComputeMaskedBits function that is APIntified. We'll slowly
convert things over to use this version. When its all done, we'll remove
the existing version.
llvm-svn: 35018
2007-03-08 01:46:38 +00:00
Devang Patel
2ac57e1f02
Now IndVarSimplify is a LoopPass.
...
llvm-svn: 35003
2007-03-07 06:39:01 +00:00
Devang Patel
69730c96db
Now LICM is a LoopPass.
...
llvm-svn: 35001
2007-03-07 04:41:30 +00:00
Devang Patel
9779e56c04
Now LoopUnroll is a LoopPass.
...
llvm-svn: 34996
2007-03-07 01:38:05 +00:00
Devang Patel
901a27d892
Now LoopUnswitch is a LoopPass.
...
llvm-svn: 34992
2007-03-07 00:26:10 +00:00
Devang Patel
b0743b5d6a
Now LoopStrengthReduce is a LoopPass.
...
llvm-svn: 34984
2007-03-06 21:14:09 +00:00
Reid Spencer
3939b1a274
Remove an unnecessary if statement and adjust indentation.
...
llvm-svn: 34939
2007-03-05 23:36:13 +00:00
Chris Lattner
66e6a8229a
This is the first major step of implementing PR1226. We now successfully
...
scalarrepl things down to elements, but mem2reg can't promote elements that
are memset/memcpy'd. Until then, the code is disabled "0 &&".
llvm-svn: 34924
2007-03-05 07:52:57 +00:00
Chris Lattner
fe53cf2459
fix a subtle bug that caused an MSVC warning. Thanks to Jeffc for pointing this out.
...
llvm-svn: 34920
2007-03-05 00:11:19 +00:00
Chris Lattner
5fdded1d2f
Add some simplifications for demanded bits, this allows instcombine to turn:
...
define i64 @test(i64 %A, i32 %B) {
%tmp12 = zext i32 %B to i64 ; <i64> [#uses=1]
%tmp3 = shl i64 %tmp12, 32 ; <i64> [#uses=1]
%tmp5 = add i64 %tmp3, %A ; <i64> [#uses=1]
%tmp6 = and i64 %tmp5, 123 ; <i64> [#uses=1]
ret i64 %tmp6
}
into:
define i64 @test(i64 %A, i32 %B) {
%tmp6 = and i64 %A, 123 ; <i64> [#uses=1]
ret i64 %tmp6
}
This implements Transforms/InstCombine/add2.ll:test1
llvm-svn: 34919
2007-03-05 00:02:29 +00:00
Jeff Cohen
b622c11f77
Unbreak VC++ build.
...
llvm-svn: 34917
2007-03-05 00:00:42 +00:00
Chris Lattner
ab2f913b68
simplify some code
...
llvm-svn: 34914
2007-03-04 23:16:36 +00:00
Chris Lattner
c33fd469ef
minor cleanups
...
llvm-svn: 34904
2007-03-04 04:50:21 +00:00
Chris Lattner
8258b44b22
Speed up -instcombine by 20% by avoiding a particularly expensive passmgr call.
...
llvm-svn: 34902
2007-03-04 04:27:24 +00:00
Chris Lattner
a5403a587c
switch MarkAliveBlocks over to using SmallPtrSet instead of std::set, speeding
...
up simplifycfg by 20%
llvm-svn: 34901
2007-03-04 04:20:48 +00:00
Chris Lattner
d7b4c92cd0
make better use of LCSSA information in RewriteLoopExitValues. Before, we
...
would scan the entire loop body, then scan all users of instructions in the
loop, looking for users outside the loop. Now, since we know that the
loop is in LCSSA form, we know that any users outside the loop will be LCSSA
phi nodes. Just scan them.
This speeds up indvars significantly.
llvm-svn: 34898
2007-03-04 03:43:23 +00:00
Chris Lattner
1f7648efba
Implement PR1179/PR1232 and test/Transforms/IndVarsSimplify/loop_evaluate_[234].ll
...
This makes -indvars require and use LCSSA, updating it as appropriate.
llvm-svn: 34896
2007-03-04 01:00:28 +00:00
Chris Lattner
ed30abf0cb
Make RewriteLoopExitValues far less nested by using continue in the loop
...
llvm-svn: 34891
2007-03-03 22:48:48 +00:00
Chris Lattner
da1d04a057
my recent change caused a failure in a bswap testcase, because it changed
...
the order that instcombine processed instructions in the testcase. The end
result is that instcombine finished with:
define i16 @test1(i16 %a) {
%tmp = zext i16 %a to i32 ; <i32> [#uses=2]
%tmp21 = lshr i32 %tmp, 8 ; <i32> [#uses=1]
%tmp5 = shl i32 %tmp, 8 ; <i32> [#uses=1]
%tmp.upgrd.32 = or i32 %tmp21, %tmp5 ; <i32> [#uses=1]
%tmp.upgrd.3 = trunc i32 %tmp.upgrd.32 to i16 ; <i16> [#uses=1]
ret i16 %tmp.upgrd.3
}
which can't get matched as a bswap.
This patch makes instcombine more sophisticated about removing truncating
casts, allowing it to turn this into:
define i16 @test2(i16 %a) {
%tmp211 = lshr i16 %a, 8
%tmp52 = shl i16 %a, 8
%tmp.upgrd.323 = or i16 %tmp211, %tmp52
ret i16 %tmp.upgrd.323
}
which then matches as bswap. This fixes bswap.ll and implements
InstCombine/cast2.ll:test[12]. This also implements cast elimination of
add/sub.
llvm-svn: 34870
2007-03-03 05:27:34 +00:00
Nick Lewycky
db42295ff2
Translate bit operations to English.
...
llvm-svn: 34868
2007-03-03 03:14:40 +00:00
Chris Lattner
960a543037
add a top-level iteration loop to instcombine. This means that it will never
...
finish without combining something it is capable of.
llvm-svn: 34865
2007-03-03 02:04:50 +00:00
Reid Spencer
c34dedf686
APIntify this pass.
...
llvm-svn: 34863
2007-03-03 00:48:31 +00:00