Commit Graph

55639 Commits

Author SHA1 Message Date
Mikhail Glushenkov
163dd597c9 Better error message.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92389 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-01 03:50:34 +00:00
Chris Lattner
f031e8ad01 Teach codegen to lower llvm.powi to an efficient (but not optimal)
multiply sequence when the power is a constant integer.  Before, our
codegen for std::pow(.., int) always turned into a libcall, which was
really inefficient.

This should also make many gfortran programs happier I'd imagine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92388 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-01 03:32:16 +00:00
Chris Lattner
0fba8cf9ff Make this more likely to generate a libcall.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92387 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-01 03:26:51 +00:00
Chris Lattner
f9ead87c68 add missing line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92384 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-01 01:54:08 +00:00
Chris Lattner
d27f911b23 add a few trivial instcombines for llvm.powi.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92383 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-01 01:52:15 +00:00
Chris Lattner
398ffba75f update this. To take the next step, llvm.powi should be generalized to work
on integers as well and codegen should lower them to branch trees.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92382 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-01 01:29:26 +00:00
Chris Lattner
9506c930aa When factoring multiply expressions across adds, factor both
positive and negative forms of constants together.  This 
allows us to compile:

int foo(int x, int y) {
    return (x-y) + (x-y) + (x-y);
}

into:

_foo:                                                       ## @foo
	subl	%esi, %edi
	leal	(%rdi,%rdi,2), %eax
	ret

instead of (where the 3 and -3 were not factored):

_foo:
        imull   $-3, 8(%esp), %ecx
        imull   $3, 4(%esp), %eax
        addl    %ecx, %eax
        ret

this started out as:
    movl    12(%ebp), %ecx
    imull   $3, 8(%ebp), %eax
    subl    %ecx, %eax
    subl    %ecx, %eax
    subl    %ecx, %eax
    ret

This comes from PR5359.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92381 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-01 01:13:15 +00:00
Chris Lattner
75954e0bbd test case we alredy get right.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92380 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-01 00:50:00 +00:00
Ted Kremenek
371da99e64 Remove old header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92378 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-01 00:04:49 +00:00
Chris Lattner
9046193e55 clean up some comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92377 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-01 00:04:26 +00:00
Chris Lattner
f55e7f54b1 switch from std::map to DenseMap for rank data structures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92375 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-01 00:01:34 +00:00
Ted Kremenek
43afbce8ba Remove derelict serialization code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92374 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 23:40:17 +00:00
Chris Lattner
3523993451 reuse negates where possible instead of always creating them from scratch.
This allows us to optimize test12 into:

define i32 @test12(i32 %X) {
  %factor = mul i32 %X, -3                        ; <i32> [#uses=1]
  %Z = add i32 %factor, 6                         ; <i32> [#uses=1]
  ret i32 %Z
}

instead of:

define i32 @test12(i32 %X) {
  %Y = sub i32 6, %X                              ; <i32> [#uses=1]
  %C = sub i32 %Y, %X                             ; <i32> [#uses=1]
  %Z = sub i32 %C, %X                             ; <i32> [#uses=1]
  ret i32 %Z
}



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92373 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 20:34:32 +00:00
Chris Lattner
f31e2e92a8 we don't need a smallptrset to detect duplicates, the values are
sorted, so we can just do a linear scan.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92372 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 19:49:01 +00:00
Chris Lattner
1e7558b656 make reassociate more careful about not leaving around dead mul's
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92370 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 19:34:45 +00:00
Chris Lattner
f8a447de16 remove debug
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92369 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 19:25:19 +00:00
Chris Lattner
69e98e2c0f teach reassociate to factor x+x+x -> x*3. While I'm at it,
fix RemoveDeadBinaryOp to actually do something.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92368 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 19:24:52 +00:00
Chris Lattner
9f7b7089be change reassociate to use SmallVector for its key datastructures
instead of std::vector.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92366 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 18:40:32 +00:00
Chris Lattner
9cd1bc4f8b change an if to an assert, fix comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92364 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 18:18:46 +00:00
Chris Lattner
94285e620b move the rest of the add optimization code out to OptimizeAdd,
improve some comments, simplify a bit of code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92363 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 18:17:13 +00:00
Chris Lattner
9fdaefad58 factor statistic updating better.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92362 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 17:51:05 +00:00
Benjamin Kramer
4760467ff2 Silence compiler warning.
warning: comparison between signed and unsigned integer expressions


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92359 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 16:27:13 +00:00
Chris Lattner
13a754ce92 simple fix for an incorrect factoring which causes a
miscompilation, PR5458.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92354 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 08:33:49 +00:00
Chris Lattner
7f4ae5c84c merge some more tests in.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92353 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 08:32:22 +00:00
Chris Lattner
e1f5460f78 filecheckize
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92352 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 08:29:56 +00:00
Chris Lattner
dbe85bffd7 fix refactoro
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92349 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 08:23:09 +00:00
Chris Lattner
f3f55a9bc1 factor code out into helper functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92347 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 07:59:34 +00:00
Chris Lattner
8d93b259f6 switch some std::vector's to smallvector. Reduce nesting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92346 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 07:48:51 +00:00
Chris Lattner
ec531233a1 use more modern datastructures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92344 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 07:33:14 +00:00
Chris Lattner
1befe643b2 clean up -debug output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92343 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 07:17:37 +00:00
Douglas Gregor
7e54d5b156 Document the edit-distance algorithm used in StringRef, switch it over
to SmallVector, and add a unit test.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92340 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 04:24:34 +00:00
Chris Lattner
210d0febc2 this #include is ok.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92338 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 03:02:42 +00:00
Chris Lattner
f0908a351a fix Analysis/DebugInfo.h to not include Metadata.h. Do this
by moving one method out of line and eliminating redundant checks
from other methods.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92337 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 03:02:08 +00:00
Chris Lattner
6e7f3b39ef add some basic named MD tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92336 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 03:00:49 +00:00
Chris Lattner
c65b72ca26 use early exits to reduce indentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92335 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 02:33:14 +00:00
Chris Lattner
85b1912dba eliminate another copy of the mdnode printing logic, simplify the
one that remains.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92334 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 02:31:59 +00:00
Chris Lattner
2b4b1e2e60 random tidying for MDNode printing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92333 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 02:27:30 +00:00
Chris Lattner
bd72b3201b eliminate a bunch of useless forwarding functions with one caller.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92332 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 02:23:35 +00:00
Chris Lattner
307c9893fc make mdnMap type safe, rename accessors for consistency with the rest of llvm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92331 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 02:20:11 +00:00
Chris Lattner
51ea55f0ec metadata can't be a global var initializer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92330 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 02:15:45 +00:00
Chris Lattner
6e6b1805da simplify mdnode printing logic. Now N->dump() only
dumps one node instead of all of them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92329 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 02:13:35 +00:00
Chris Lattner
ab2f2f1ace don't unittest mdnode printing, we have disassembler tests for this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92328 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 02:12:13 +00:00
Chris Lattner
fdb3356477 unify two copies of the NamedMDNode printing code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92327 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 01:54:05 +00:00
Chris Lattner
7d054b385f fix printing of function-local metadata to print all the operands of the
mdnode, not just operand 0 over and over.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92326 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 01:44:44 +00:00
Chris Lattner
4a3d3a54eb simplify printing of mdstring and Argument.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92325 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 01:41:14 +00:00
Chris Lattner
38cf02ebc9 simplify asmprinting of NamedMDNode
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92324 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 01:36:50 +00:00
Chris Lattner
183912af79 Remove #include of metadata.h from intrinsicinst.h. The only
method that needs it (DbgValueInst::getValue) has been moved out
of line.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92323 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 01:32:41 +00:00
Chris Lattner
5d0cacdbb6 rename "elements" of metadata to "operands". "Elements" are
things that occur in types.  "operands" are things that occur
in values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92322 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 01:22:29 +00:00
Chris Lattner
b76359e36e Optimize MDNode to coallocate the operand list immediately
after the MDNode in memory.  This eliminates the operands
pointer and saves a new[] per node.

Note that the code in DIDerivedType::replaceAllUsesWith is wrong
and quite scary.  A MDNode should not be RAUW'd with something
else: this changes all uses of the mdnode, which may not be debug
info related!  Debug info should use something non-mdnode for
declarations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92321 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 01:05:46 +00:00
Chris Lattner
cc7b011728 tidy
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92320 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 00:51:46 +00:00