History log of /external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
c81fe9cab545a93a61c059b1c2813f622aef43ae 30-Aug-2012 Benjamin Kramer <benny.kra@googlemail.com> InstCombine: Fix comment to reflect the code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162911 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
639570c3117aaabb0c97b34a9bf05d09f8903ef4 30-Aug-2012 Nadav Rotem <nrotem@apple.com> It is illegal to transform (sdiv (ashr X c1) c2) -> (sdiv x (2^c1 * c2)),
because C always rounds towards zero.

Thanks Dirk and Ben.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162899 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
37dca6331d6bfadfb80b3c68a1cabd6bdf1a13be 28-Aug-2012 Benjamin Kramer <benny.kra@googlemail.com> InstCombine: Defensively avoid undefined shifts by limiting the amount to the bit width.

No test case, undefined shifts get folded early, but can occur when other
transforms generate a constant. Thanks to Duncan for bringing this up.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162755 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
aac7c650a6cac09d42c5fda8d3761bc9c871ff03 28-Aug-2012 Benjamin Kramer <benny.kra@googlemail.com> InstCombine: Guard the transform introduced in r162743 against large ints and non-const shifts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162751 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
a694e2a6910a33596ca706e2c6fc713f02b64c50 28-Aug-2012 Nadav Rotem <nrotem@apple.com> Make sure that we don't call getZExtValue on values > 64 bits.
Thanks Benjamin for noticing this.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162749 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
9753f0b9b4ab33919c5010acb6a7b2dc1e875aff 28-Aug-2012 Nadav Rotem <nrotem@apple.com> Teach InstCombine to canonicalize [SU]div+[AL]shl patterns.

For example:
%1 = lshr i32 %x, 2
%2 = udiv i32 %1, 100

rdar://12182093




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162743 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
2a5422b1a6955977d05af48222c86c77c7549484 22-Jun-2012 Evan Cheng <evan.cheng@apple.com> Look pass zext to strength reduce an udiv. Patch by David Majnemer. rdar://11721329

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158946 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
7302d80490feabfc8a01bee0fa698aab55169544 06-Feb-2012 Chris Lattner <sabre@nondot.org> Remove some dead code and tidy things up now that vectors use ConstantDataVector
instead of always using ConstantVector.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149912 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
a78fa8cc2dd6d2ffe5e4fe605f38aae7b3d2fb7a 27-Jan-2012 Chris Lattner <sabre@nondot.org> continue making the world safe for ConstantDataVector. At this point,
we should (theoretically optimize and codegen ConstantDataVector as well
as ConstantVector.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149116 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
4ca829e89567f002fc74eb0e3e532a7c7662e031 25-Jan-2012 Chris Lattner <sabre@nondot.org> use ConstantVector::getSplat in a few places.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148929 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
a29fc806fe02cea76f7896b7e344bb919dd7ac25 08-Nov-2011 Pete Cooper <peter_cooper@apple.com> InstCombine now optimizes vector udiv by power of 2 to shifts

Fixes r8429


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144036 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
a9390a4d5f5d568059a80970d22194b165d097a7 27-Sep-2011 Benjamin Kramer <benny.kra@googlemail.com> Stop emitting instructions with the name "tmp" they eat up memory and have to be uniqued, without any benefit.

If someone prefers %tmp42 to %42, run instnamer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140634 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
db125cfaf57cc83e7dd7453de2d509bc8efd0e5e 18-Jul-2011 Chris Lattner <sabre@nondot.org> land David Blaikie's patch to de-constify Type, with a few tweaks.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135375 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
c73b24db5f6226ed44ebc44ce1c25bb357206623 15-Jul-2011 Chris Lattner <sabre@nondot.org> start using the new helper methods a bit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135251 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
f1002828fdaffa4e005a81f269c77fe72951f39f 01-Jun-2011 Stuart Hastings <stuart@apple.com> Reapply 132348 with fixes. rdar://problem/6501862


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132402 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
3200c4b53ca742bd0103454250ca89fec2776211 31-May-2011 Stuart Hastings <stuart@apple.com> Revert to pacify a buildbot. rdar://problem/6501862


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132351 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
df48e84b5bf0967c1fc397912c109f29475c791b 31-May-2011 Stuart Hastings <stuart@apple.com> Followup to 132316; accept arbitrary constants, add with a constant,
sub with a non-constant. Fix comments, enlarge test case.
rdar://problem/6501862


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132348 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
acbf107d9b9ffeddbcc3d015107c6faff439ee9b 30-May-2011 Stuart Hastings <stuart@apple.com> (1 - X) * (-2) -> (x - 1) * 2, for all positive nonzero powers of 2
rdar://problem/6501862


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132316 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
613f1a3994ef6f009c93264f6708830249130896 23-May-2011 Chris Lattner <sabre@nondot.org> rearrange two transforms, since one subsumes the other. Make the shift-exactness
xform recurse.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131888 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
05cd88656135255b545d24adb51c2ba1b5c8b99e 23-May-2011 Chris Lattner <sabre@nondot.org> Transform any logical shift of a power of two into an exact/NUW shift when
in a known-non-zero context.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131887 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
6083bb935373020af240bdf8fbec1cdcf360303f 23-May-2011 Chris Lattner <sabre@nondot.org> use the valuetracking isPowerOfTwo function, which is more powerful than checking
for a constant directly. Thanks to Duncan for pointing this out.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131885 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
6c9b8d3d411b0ee65263dc41d2b953fe118cf31e 22-May-2011 Chris Lattner <sabre@nondot.org> add some random notes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131862 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
1add46ddfa38f23669cb02de342fdb59a8709245 22-May-2011 Chris Lattner <sabre@nondot.org> Carve out a place in instcombine to put transformations which work knowing that their
result is non-zero. Implement an example optimization (PR9814), which allows us to
transform:
A / ((1 << B) >>u 2)
into:
A >>u (B-2)

which we compile into:

_divu3: ## @divu3
leal -2(%rsi), %ecx
shrl %cl, %edi
movl %edi, %eax
ret

instead of:

_divu3: ## @divu3
movb %sil, %cl
movl $1, %esi
shll %cl, %esi
shrl $2, %esi
movl %edi, %eax
xorl %edx, %edx
divl %esi, %eax
ret



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131860 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
00676a6df1116f47a015de589f911d2b5b7f4117 02-May-2011 Duncan Sands <baldrick@free.fr> Remove unused variable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130705 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
f24ed77d2416b66178d8ff1d807858dfab37ca18 02-May-2011 Duncan Sands <baldrick@free.fr> Move some rem transforms out of instcombine and into instsimplify.
This automagically provides a transform noticed by my super-optimizer
as occurring quite often: "rem x, (select cond, x, 1)" -> 0.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130694 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
7d6eb5a018ef4352730d63dc202cfaf013f489fe 30-Apr-2011 Benjamin Kramer <benny.kra@googlemail.com> InstCombine: Turn (zext A) udiv (zext B) into (zext (A udiv B)). Same for urem or constant B.

This obviously helps a lot if the division would be turned into a libcall
(think i64 udiv on i386), but div is also one of the few remaining instructions
on modern CPUs that become more expensive when the bitwidth gets bigger.

This also helps register pressure on i386 when dividing chars, divb needs
two 8-bit parts of a 16 bit register as input where divl uses two registers.

int foo(unsigned char a) { return a/10; }
int bar(unsigned char a, unsigned char b) { return a/b; }

compiles into (x86_64)
_foo:
imull $205, %edi, %eax
shrl $11, %eax
ret
_bar:
movzbl %dil, %eax
divb %sil, %al
movzbl %al, %eax
ret

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130615 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
23b02cd0315625d9d586118abcc972053298d50b 30-Apr-2011 Benjamin Kramer <benny.kra@googlemail.com> Use SimplifyDemandedBits on div instructions.

This folds away silly stuff like (a&255)/1000 -> 0.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130614 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
546739656ec9469499d3866d87dca6fdbcf2eee0 30-Mar-2011 Benjamin Kramer <benny.kra@googlemail.com> InstCombine: If the divisor of an fdiv has an exact inverse, turn it into an fmul.

Fixes PR9587.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128546 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
7a6aa1a3919af8ece92702c36dc552d81be9151a 10-Feb-2011 Chris Lattner <sabre@nondot.org> Enhance a bunch of transformations in instcombine to start generating
exact/nsw/nuw shifts and have instcombine infer them when it can prove
that the relevant properties are true for a given shift without them.

Also, a variety of refactoring to use the new patternmatch logic thrown
in for good luck. I believe that this takes care of a bunch of related
code quality issues attached to PR8862.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125267 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
35bda8914c0d1c02a6f90f42e7810c83150737e1 06-Feb-2011 Chris Lattner <sabre@nondot.org> enhance vmcore to know that udiv's can be exact, and add a trivial
instcombine xform to exercise this.

Nothing forms exact udivs yet though. This is progress on PR8862



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124992 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
31726c154dafa9fef08b1bcac9822c2a4618ec19 29-Jan-2011 Frits van Bommel <fvbommel@gmail.com> Call SimplifyFDivInst() in InstCombiner::visitFDiv().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124535 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
1fca2c32cc99197215d3fd32a4ad05214c74edd1 29-Jan-2011 Frits van Bommel <fvbommel@gmail.com> Move InstCombine's knowledge of fdiv to SimplifyInstruction().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124534 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
593faa53fa6d89841e601cc4571d143a6a05f0b4 28-Jan-2011 Duncan Sands <baldrick@free.fr> My auto-simplifier noticed that ((X/Y)*Y)/Y occurs several times in SPEC
benchmarks, and that it can be simplified to X/Y. (In general you can only
simplify (Z*Y)/Y to Z if the multiplication did not overflow; if Z has the
form "X/Y" then this is the case). This patch implements that transform and
moves some Div logic out of instcombine and into InstructionSimplify.
Unfortunately instcombine gets in the way somewhat, since it likes to change
(X/Y)*Y into X-(X rem Y), so I had to teach instcombine about this too.
Finally, thanks to the NSW/NUW flags, sometimes we know directly that "Z*Y"
does not overflow, because the flag says so, so I added that logic too. This
eliminates a bunch of divisions and subtractions in 447.dealII, and has good
effects on some other benchmarks too. It seems to have quite an effect on
tramp3d-v4 but it's hard to say if it's good or bad because inlining decisions
changed, resulting in massive changes all over.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124487 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
37bf92b5238434b00fde79347ba5336e7554e562 22-Dec-2010 Duncan Sands <baldrick@free.fr> Add a generic expansion transform: A op (B op' C) -> (A op B) op' (A op C)
if both A op B and A op C simplify. This fires fairly often but doesn't
make that much difference. On gcc-as-one-file it removes two "and"s and
turns one branch into a select.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122399 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
82fdab335881cd90f8f7ab3ad1f1ca0bb3ee886a 21-Dec-2010 Duncan Sands <baldrick@free.fr> Pull a few more simplifications out of instcombine (there are still
plenty left though!), in particular for multiplication.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122330 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
40f8f6264d5af2c38e797e0dc59827cd231e8ff7 07-Dec-2010 Jay Foad <jay.foad@gmail.com> PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() and
zextOrTrunc(), and APSInt methods extend(), extOrTrunc() and new method
trunc(), to be const and to return a new value instead of modifying the
object in place.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121120 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
1951a5b721187ab85db0b2db55ae39eec3733c20 17-Nov-2010 Benjamin Kramer <benny.kra@googlemail.com> InstCombine: Add a missing irem identity (X % X -> 0).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119538 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
096aa79276b8527a3cbbb3691e40e729dea09523 13-Nov-2010 Duncan Sands <baldrick@free.fr> Generalize the reassociation transform in SimplifyCommutative (now renamed to
SimplifyAssociativeOrCommutative) "(A op C1) op C2" -> "A op (C1 op C2)",
which previously was only done if C1 and C2 were constants, to occur whenever
"C1 op C2" simplifies (a la InstructionSimplify). Since the simplifying operand
combination can no longer be assumed to be the right-hand terms, consider all of
the possible permutations. When compiling "gcc as one big file", transform 2
(i.e. using right-hand operands) fires about 4000 times but it has to be said
that most of the time the simplifying operands are both constants. Transforms
3, 4 and 5 each fired once. Transform 6, which is an existing transform that
I didn't change, never fired. With this change, the testcase is now optimized
perfectly with one run of instcombine (previously it required instcombine +
reassociate + instcombine, and it may just have been luck that this worked).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119002 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
a9445e11c553855a6caacbbbf77a9b993ecc651e 02-Mar-2010 Dan Gohman <gohman@apple.com> Floating-point add, sub, and mul are now spelled fadd, fsub, and fmul,
respectively.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97531 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
1df9859c40492511b8aa4321eb76496005d3b75b 16-Feb-2010 Duncan Sands <baldrick@free.fr> There are two ways of checking for a given type, for example isa<PointerType>(T)
and T->isPointerTy(). Convert most instances of the first form to the second form.
Requested by Chris.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96344 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
b0bc6c361da9009e8414efde317d9bbff755f6c0 15-Feb-2010 Duncan Sands <baldrick@free.fr> Uniformize the names of type predicates: rather than having isFloatTy and
isInteger, we now have isFloatTy and isIntegerTy. Requested by Chris!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96223 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
5b39620e2da1451c5db50559085ae4b86a152936 17-Jan-2010 Owen Anderson <resistor@mac.com> Fix comment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93679 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
11acaa374cdcebb161bf0de5f244265d78a749c1 05-Jan-2010 Benjamin Kramer <benny.kra@googlemail.com> Convert a ton of simple integer type equality tests to the new predicate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92760 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
d12c27ce0079ba14e73e0c422a30dac68c631a23 05-Jan-2010 Chris Lattner <sabre@nondot.org> split mul/div/rem instructions out to their own file.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92689 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp