Commit Graph

7131 Commits

Author SHA1 Message Date
Owen Anderson
2722dfa75d Remove unneeded check, and correct style.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108427 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-15 16:38:22 +00:00
Dan Gohman
c88c1a4581 Watch out for a constant offset cancelling out a base register, forming
a zero. This situation arrises in Fortran code with induction variables
that start at 1 instead of 0. This fixes PR7651.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108424 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-15 15:14:45 +00:00
Owen Anderson
96fe621e07 Reapply r108378, with bugfixes, testcase, and improved comment formatting.
This now passes LIT, nighty test, and llvm-gcc bootstrap on my machine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108422 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-15 15:00:23 +00:00
Nick Lewycky
706f50820c This is a full sentence.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108418 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-15 06:51:22 +00:00
Nick Lewycky
664040a03c Disable aliases on all platforms.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108417 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-15 06:48:56 +00:00
Chris Lattner
35a939b97d make various clients of ReplaceAndSimplifyAllUses tolerate
it *changing* the things it replaces, not just causing them
to drop to null.  There is no functionality change yet, but 
this is required for a subsequent patch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108414 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-15 06:06:04 +00:00
Eli Friedman
5e84e8e52a Speculatively revert r108378; may be causing bootstrap failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108389 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-15 00:33:00 +00:00
Owen Anderson
bd129a7460 Add instcombine transforms to optimize tests of multiple bits of the same value into a single larger comparison.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108378 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-14 23:33:51 +00:00
Owen Anderson
e84178a0bd Extend SimplifyCFG's common-destination folding heuristic to allow a single
"bonus" instruction to be speculatively executed.  Add a heuristic to
ensure we're not tripping up out-of-order execution by checking that this bonus
instruction only uses values that were already guaranteed to be available.

This allows us to eliminate the short circuit in (x&1)&&(x&2).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108351 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-14 19:52:16 +00:00
Chris Lattner
07c9b64719 revert r108320, I see the failures now...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108322 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-14 06:16:35 +00:00
Chris Lattner
7e185af930 reapply benjamin's instcombine patch, I don't see anything wrong with it and can't repro any problems with a manual self-host.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108320 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-14 05:59:13 +00:00
Eric Christopher
f0193ed8de Grammar.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108252 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-13 18:27:13 +00:00
Duncan Sands
d0d3ccc827 Handle the case of a tail recursion in which the tail call is followed
by a return that returns a constant, while elsewhere in the function
another return instruction returns a different constant.  This is a
special case of accumulator recursion, so just generalize the existing
logic a bit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108241 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-13 15:41:41 +00:00
Benjamin Kramer
c9fe6374b7 Nope, still breaks the release selfhost bots :(
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108153 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 16:38:48 +00:00
Benjamin Kramer
8fd437c43f Reapply the "or" half of r108136, which seems to be less problematic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108152 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 16:15:48 +00:00
Gabor Greif
a9b8338bfa cache result of operator*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108150 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 15:48:26 +00:00
Benjamin Kramer
e2d07b5208 Revert r108141 again, sigh.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108148 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 14:42:04 +00:00
Gabor Greif
40119ceeec cache result of operator*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108147 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 14:15:58 +00:00
Gabor Greif
a53029b1fc cache result of operator*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108146 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 14:15:10 +00:00
Gabor Greif
65b9212d34 cache result of operator*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108145 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 14:14:03 +00:00
Gabor Greif
aaaaa02a93 cache result of operator*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108144 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 14:13:15 +00:00
Gabor Greif
b7df500063 cache results of operator*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108143 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 14:12:11 +00:00
Gabor Greif
ee1f44fba3 cache results of operator*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108142 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 14:10:24 +00:00
Benjamin Kramer
98a8206e58 Reapply 108136 with an ugly pasto fixed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108141 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 13:44:00 +00:00
Benjamin Kramer
ad854f0764 Move optimization to avoid redundant matching.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108140 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 13:34:22 +00:00
Benjamin Kramer
0cc4ed1ca5 Revert r108136 until I figure out why it broke selfhost.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108139 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 12:35:49 +00:00
Gabor Greif
110b75aa75 cache dereferenced iterators
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108138 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 12:03:02 +00:00
Gabor Greif
639e9e47a2 recommit r108131 (hich has been backed out in r108135) with a fix
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108137 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 12:02:10 +00:00
Benjamin Kramer
4fc719e607 instcombine: fold (x & y) | (~x & z) and (x & y) ^ (~x & z) into ((y ^ z) & x) ^ z which is one instruction shorter. (PR6773)
before:
  %and = and i32 %y, %x
  %neg = xor i32 %x, -1
  %and4 = and i32 %z, %neg
  %xor = xor i32 %and4, %and

after:
  %xor1 = xor i32 %z, %y
  %and2 = and i32 %xor1, %x
  %xor = xor i32 %and2, %z


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108136 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 11:54:45 +00:00
Gabor Greif
e99e077522 back out r108131 (of TailDuplication.cpp) for now, it causes a buildbot failure
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108135 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 11:32:39 +00:00
Gabor Greif
fc41f90817 cache dereferenced iterators
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108134 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 11:19:24 +00:00
Gabor Greif
625398343e cache dereferenced iterators
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108133 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 10:59:23 +00:00
Gabor Greif
f1b2874c68 cache dereferenced iterators
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108132 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 10:49:54 +00:00
Gabor Greif
a8b9df7bd9 cache dereferenced iterators
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108131 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 10:36:48 +00:00
Duncan Sands
3472766f9e Convert some tab stops into spaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108130 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 08:16:59 +00:00
Chris Lattner
5a30a8574c make the prototypes for CreateMalloc and CreateFree more consistent. Patch
by Hans Vandierendonck from PR7605


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108116 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 00:57:28 +00:00
Chris Lattner
0a96144aac if jump threading is able to infer interesting values on both
the LHS and RHS of an and/or instruction, don't multiply add
known predecessor values.  This fixes the crash on testcase
from PR7498


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108114 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 00:47:34 +00:00
Duncan Sands
24080a9878 The accumulator tail recursion transform claims to work for any associative
operation, but the way it's implemented requires the operation to also be
commutative.  So add a check for commutativity (and tweak the corresponding
comments).  This makes no difference in practice since every associative
LLVM instruction is also commutative!  Here's an example to show the need
for commutativity: the accum_recursion.ll testcase calculates the factorial
function.  Before the transformation the result of a call is
  ((((1*1)*2)*3)...)*x
while afterwards it is
  (((1*x)*(x-1))...*2)*1
which clearly requires both associativity and commutativity of * to be equal
to the original.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108056 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-10 20:31:42 +00:00
Gabor Greif
e664267ae7 cache result of operator*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107990 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-09 16:51:20 +00:00
Gabor Greif
9085fcab82 cache result of operator*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107984 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-09 16:31:08 +00:00
Gabor Greif
bf2eefdb0d cache result of operator*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107983 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-09 16:26:41 +00:00
Gabor Greif
e80ba4f884 cache result of operator*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107981 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-09 16:17:52 +00:00
Gabor Greif
7656018c22 cache result of operator*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107976 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-09 15:40:10 +00:00
Gabor Greif
7556cf541b cache result of operator*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107975 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-09 15:25:42 +00:00
Gabor Greif
5896935423 cache result of operator*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107974 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-09 15:25:09 +00:00
Gabor Greif
fc36c0f21f cache result of operator*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107972 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-09 15:01:36 +00:00
Gabor Greif
1d3ae029c4 cache result of operator* (found by inspection)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107971 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-09 14:48:08 +00:00
Gabor Greif
0814985887 cache result of operator*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107969 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-09 14:36:49 +00:00
Gabor Greif
a29742df5f cache result of operator*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107968 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-09 14:29:14 +00:00
Gabor Greif
5417a03b55 cache result of operator*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107966 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-09 14:18:23 +00:00
Gabor Greif
9672414017 cache operator*'s result (in multiple functions)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107965 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-09 14:02:13 +00:00
Gabor Greif
b654435712 do not repeatedly dereference use_iterator
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107962 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-09 12:23:50 +00:00
Benjamin Kramer
1db071f0da Teach instcombine to transform
(X >s -1) ? C1 : C2 and (X <s  0) ? C2 : C1
into ((X >>s 31) & (C2 - C1)) + C1, avoiding the conditional.

This optimization could be extended to take non-const C1 and C2 but we better
stay conservative to avoid code size bloat for now.

for
int sel(int n) {
     return n >= 0 ? 60 : 100;
}

we now generate
  sarl  $31, %edi
  andl  $40, %edi
  leal  60(%rdi), %eax

instead of
  testl %edi, %edi
  movl  $60, %ecx
  movl  $100, %eax
  cmovnsl %ecx, %eax


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107866 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-08 11:39:10 +00:00
Chris Lattner
0238f8c430 Fix the second half of PR7437: scalarrepl wasn't preserving
address spaces when SRoA'ing memcpy's.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107846 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-08 00:27:05 +00:00
Duncan Sands
8246adc1f0 Rename "Release" builds as "Release+Asserts"; rename "Release-Asserts"
builds to "Release".  The default build is unchanged (optimization on,
assertions on), however it is now called Release+Asserts.  The intent
is that future LLVM releases released via llvm.org will be Release builds
in the new sense, i.e. will have assertions disabled (currently they have
assertions enabled, for a more than 20% slowdown).  This will bring them
in line with MacOS releases, which ship with assertions disabled.  It also
means that "Release" now means the same things in make and cmake builds:
cmake already disables assertions for "Release" builds AFAICS.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107758 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-07 07:48:00 +00:00
Nick Lewycky
10d2f4d01b Detabify this file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107637 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-06 03:53:43 +00:00
Devang Patel
1192d4d0a5 MDString is already checked earlier.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107516 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-02 21:13:23 +00:00
Dan Gohman
8c1ffae068 Don't claim to preserve AliasAnalysis. First, this is doesn't actually
have any effect, and second, deleting stores can potentially invalidate
an AliasAnalysis, and there's currently no notification for this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107496 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-02 18:43:05 +00:00
Bill Wendling
5e721d7682 Implement the "linker_private_weak" linkage type. This will be used for
Objective-C metadata types which should be marked as "weak", but which the
linker will remove upon final linkage. However, this linkage isn't specific to
Objective-C.

For example, the "objc_msgSend_fixup_alloc" symbol is defined like this:

      .globl l_objc_msgSend_fixup_alloc
      .weak_definition l_objc_msgSend_fixup_alloc
      .section __DATA, __objc_msgrefs, coalesced
      .align 3
l_objc_msgSend_fixup_alloc:
       .quad   _objc_msgSend_fixup
       .quad   L_OBJC_METH_VAR_NAME_1

This is different from the "linker_private" linkage type, because it can't have
the metadata defined with ".weak_definition".

Currently only supported on Darwin platforms.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107433 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-01 21:55:59 +00:00
Devang Patel
26d14294de Debugging infomration is encoded in llvm IR using metadata. This is designed
such a way that debug info for symbols preserved even if symbols are
optimized away by the optimizer. 

Add new special pass to remove debug info for such symbols.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107416 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-01 19:49:20 +00:00
Devang Patel
e62b203570 If a named mdnode is removed then mark module as changed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107412 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-01 18:27:46 +00:00
Jim Grosbach
7fa1bbad29 lowerinvoke needs to handle aggregate function args like sjlj eh does.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107335 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-30 22:22:59 +00:00
Devang Patel
444a08cd6f Remove all debug info related named mdnodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107323 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-30 21:29:00 +00:00
Gabor Greif
8e1ebff9f1 use ArgOperand API
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107278 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-30 12:42:43 +00:00
Gabor Greif
e9af352d74 use ArgOperand API
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107277 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-30 12:40:35 +00:00
Gabor Greif
2458513430 use getArgOperand (corrected by CallInst::ArgOffset) instead of getOperand
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107275 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-30 12:38:26 +00:00
Gabor Greif
6e1f330c4c use getArgOperand (corrected by CallInst::ArgOffset) instead of getOperand
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107273 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-30 09:19:23 +00:00
Gabor Greif
237e1da16a use getNumArgOperands instead of getNumOperands
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107272 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-30 09:17:53 +00:00
Gabor Greif
6f14c8c7c1 use getArgOperand instead of getOperand
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107271 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-30 09:16:16 +00:00
Gabor Greif
ad72e73136 use getArgOperand instead of getOperand
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107270 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-30 09:15:28 +00:00
Gabor Greif
351cbac4d3 use getArgOperand instead of getOperand
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107269 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-30 09:14:26 +00:00
Bill Wendling
07d3177117 Revert r107205 and r107207.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107215 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-29 22:34:52 +00:00
Bill Wendling
207855cff9 Introducing the "linker_weak" linkage type. This will be used for Objective-C
metadata types which should be marked as "weak", but which the linker will
remove upon final linkage. For example, the "objc_msgSend_fixup_alloc" symbol is
defined like this:

       .globl l_objc_msgSend_fixup_alloc
       .weak_definition l_objc_msgSend_fixup_alloc
       .section __DATA, __objc_msgrefs, coalesced
       .align 3
l_objc_msgSend_fixup_alloc:
        .quad   _objc_msgSend_fixup
        .quad   L_OBJC_METH_VAR_NAME_1

This is different from the "linker_private" linkage type, because it can't have
the metadata defined with ".weak_definition".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107205 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-29 21:24:00 +00:00
Duncan Sands
a7065b1fcc Return Changed. This required setting Changed if dbg metadata
is stripped off.  Currently set unconditionally, since the API
does not provide a way of working out if anything was actually
stripped off.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107142 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-29 14:52:10 +00:00
Gabor Greif
a90c5c7605 use ArgOperand API
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107017 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-28 16:50:57 +00:00
Gabor Greif
30d2577f64 use ArgOperand API
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107016 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-28 16:45:00 +00:00
Gabor Greif
d6bf5cf641 employ CallInst::ArgOffset (for now)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107015 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-28 16:43:57 +00:00
Gabor Greif
18c383f87f use setArgOperand
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107004 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-28 12:31:35 +00:00
Gabor Greif
245e9c4834 use CallInst::ArgOffset
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107003 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-28 12:30:07 +00:00
Gabor Greif
f148cb6044 use ArgOperand API and CallInst::ArgOffset
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107002 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-28 12:29:20 +00:00
Gabor Greif
19101c7585 use cached value
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107000 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-28 11:20:42 +00:00
Chris Lattner
1495247f51 minor cleanup to SROA: when lowering type unsafe accesses to
large integers, the first inserted value would always create
an 'or X, 0'.  Even though this is trivially zapped by
instcombine, don't bother creating this pointless instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106979 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-27 07:58:26 +00:00
Duncan Sands
d50e9e2566 Fix PR7328: when turning a tail recursion into a loop, need to preserve
the returned value after the tail call if it differs from other return
values.  The optimal thing to do would be to introduce a phi node for
the return value, but for the moment just fix the miscompile.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106947 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-26 12:53:31 +00:00
Dan Gohman
3e3f15bb09 In GenerateReassociations, don't bother thinking about individual
SCEVUnknown values which are loop-variant, as LSR can't do anything
interesting with these values in any case. This fixes very slow compile
times on loops which have large numbers of such values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106897 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-25 22:32:18 +00:00
Dale Johannesen
1784d160e4 The hasMemory argument is irrelevant to how the argument
for an "i" constraint should get lowered; PR 6309.  While
this argument was passed around a lot, this is the only
place it was used, so it goes away from a lot of other
places.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106893 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-25 21:55:36 +00:00
Gabor Greif
f1ba6513bf use ArgOperand API (one more hunk I could split)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106825 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-25 07:58:41 +00:00
Gabor Greif
9c68a7bb45 use ArgOperand API (some hunks I could split)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106824 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-25 07:57:14 +00:00
Gabor Greif
7f1d7f5779 use ArgOperand API; tighten type of handleFreeWithNonTrivialDependency to be able to use isFreeCall whithout a cast or new overload
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106823 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-25 07:40:32 +00:00
Dan Gohman
fc33a3099e Add an exports file for the Hello example plugin.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106768 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 17:36:51 +00:00
Dan Gohman
2ea09e0546 A few minor micro-optimizations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106764 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 16:57:52 +00:00
Dan Gohman
d42819a07b Teach getExactSDiv to evaluate x/1 to x up front, as it's a common
enough special case, and it theoretically allows more folding because
it works even when x is unanalyzable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106763 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 16:51:25 +00:00
Dan Gohman
473e63512a Fix copy+pasto issues in isMulSExtable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106759 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 16:45:11 +00:00
Gabor Greif
caf70b31b0 use ArgOperand API
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106752 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 16:11:44 +00:00
Gabor Greif
2f1ab74e76 use (even more, still) ArgOperand API
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106750 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 15:51:11 +00:00
Gabor Greif
9e4f243de7 use ArgOperand API and CallSite for arg range; add necessary casts and perform some cosmetics
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106747 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 14:42:01 +00:00
Gabor Greif
fef8c4eb54 use ArgOperand API and CallSite for arg range
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106745 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 14:13:36 +00:00
Gabor Greif
bcda85c743 use (even more) ArgOperand API
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106744 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 13:54:33 +00:00
Gabor Greif
c310fcc909 use ArgOperand API
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106743 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 13:42:49 +00:00
Gabor Greif
cea7ac7c01 use ArgOperand API
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106740 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 12:58:35 +00:00
Gabor Greif
3e84e2e90f use ArgOperand API
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106737 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 12:35:13 +00:00
Gabor Greif
916973706d use ArgOperand API, also tighten the type of visitFree to make this work out smoothly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106736 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 12:21:15 +00:00
Gabor Greif
3ccbb22eaf use ArgOperand API; introduce downcasted pointers into scope to facilitate this
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106734 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 12:03:56 +00:00
Gabor Greif
aee5dc1939 use ArgOperand API
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106731 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 10:42:46 +00:00
Gabor Greif
d883a9d1ed use ArgOperand API
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106730 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 10:17:17 +00:00
Gabor Greif
0a14be0693 use callsite to obtain all arguments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106729 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 10:04:07 +00:00
Gabor Greif
aeff385e3e use callsite to obtain all arguments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106728 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 09:56:43 +00:00
Gabor Greif
407014f9a5 use getNumArgOperands
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106709 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 00:48:48 +00:00
Gabor Greif
de9f5452d3 use ArgOperand API
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106707 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 00:44:01 +00:00
Devang Patel
e9916a302f Use ValueMap instead of DenseMap.
The ValueMapper used by various cloning utility maps MDNodes also.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106706 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 00:33:28 +00:00
Devang Patel
774cca70b1 Use available typedef for " DenseMap<const Value*, Value*>".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106699 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 00:00:42 +00:00
Devang Patel
29d3dd8a64 Cosmetic change.
Do not use "ValueMap" as a name for a local variable or an argument.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106698 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-23 23:55:51 +00:00
Devang Patel
170f06ebe2 Revert 106592 for now. It causes clang-selfhost build failure.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106598 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-22 23:29:55 +00:00
Dan Gohman
caf71ab473 Fix OptimizeMax to handle an odd case where one of the max operands
is another max which folds. This fixes PR7454.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106594 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-22 23:07:13 +00:00
Devang Patel
186b3d2606 If a metadata operand is seeded in value map and the metadata should also be seeded in value map. This is not limited to function local metadata.
Failure to seed metdata in such cases causes troubles when in a cloned module, metadata from a new module refers to values in old module. Usually this results in mysterious bugpoint crashes. For example,

 Checking to see if we can delete global inits: Unknown constant!
 UNREACHABLE executed at /d/g/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:904!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106592 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-22 22:53:21 +00:00
Devang Patel
3bf329f495 While cloning a module, clone metadata attached with instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106591 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-22 22:50:42 +00:00
Devang Patel
d8800e7972 Clone named metadata while cloning a module.
Reapply Bob's patch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106560 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-22 18:52:38 +00:00
Dan Gohman
fe60104ac9 Use pre-increment instead of post-increment when the result is not used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106542 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-22 15:08:57 +00:00
Devang Patel
e4acff8720 Revert 106528. It is causing self host failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106529 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-22 06:14:09 +00:00
Devang Patel
52e0612f7d Do not rely on DenseMap slot which can be easily invalidated when DenseMap grows.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106528 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-22 05:16:56 +00:00
Bob Wilson
ec68864877 Revert my change to clone named metadata. Buildbots are complaining.
--- Reverse-merging r106508 into '.':
U    lib/Transforms/Utils/CloneModule.cpp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106521 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-22 02:08:51 +00:00
Bob Wilson
e42f493f4c Include named metadata when cloning a module.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106508 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-22 00:11:03 +00:00
Dan Gohman
403a8cdda5 Use A.append(...) instead of A.insert(A.end(), ...) when A is a
SmallVector, and other SmallVector simplifications.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106452 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-21 19:47:52 +00:00
Dan Gohman
74e5ef096e Add a TODO comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106397 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-19 21:30:18 +00:00
Dan Gohman
1e3121c80a Include the use kind along with the expression in the key of the
use sharing map. The reconcileNewOffset logic already forces a
separate use if the kinds differ, so incorporating the kind in the
key means we can track more sharing opportunities.

More sharing means fewer total uses to track, which means smaller
problem sizes, which means the conservative throttles don't kick
in as often.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106396 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-19 21:29:59 +00:00
Dan Gohman
b6211710ac Don't include things in anonymous namespaces that don't need it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106395 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-19 21:21:39 +00:00
Dan Gohman
a52838285b Disable indvars on loops when LoopSimplify form is not available.
This fixes PR7333.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106267 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-18 01:35:11 +00:00
Jim Grosbach
d0e8469ba6 remove trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106164 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-16 22:41:09 +00:00
Rafael Espindola
e96af56a5b Make sure that simplify libcalls does not replace a call with one calling
convention with a new call with a different calling convention.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106134 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-16 19:34:01 +00:00
Benjamin Kramer
ea9ca0236d simplify-libcalls: fold strncmp(x, y, 1) -> memcmp(x, y, 1)
The memcmp will be optimized further and even the pathological case
'strstr(x, "x") == x' generates optimal code now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106097 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-16 10:30:29 +00:00
Benjamin Kramer
386e918438 simplify-libcalls: fold strstr(a, b) == a -> strncmp(a, b, strlen(b)) == 0
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106047 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-15 21:34:25 +00:00
Chris Lattner
e58867e55e jump threading can't split a critical edge from an indirectbr. This
fixes PR7356.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105950 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-14 19:45:43 +00:00
Benjamin Kramer
c05cb8d561 SimplifyCFG: don't turn volatile stores to null/undef into unreachable. Fixes PR7369.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105914 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-13 14:35:54 +00:00
Kenneth Uildriks
42c7d23c6d Pulled CodeMetrics out of InlineCost.h and made it a bit more general, so it can be reused from PartialSpecializationCost
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105725 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-09 15:11:37 +00:00
Dan Gohman
b9539745c5 Make bugpoint dead-argument-hacking actually work, and actually test it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105551 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-07 20:20:33 +00:00
Kenneth Uildriks
3a4340d4cb Partial specialization was not checking the callsite to make sure it was using the same constants as the specialization, leading to calls to the wrong specialization. Patch by Takumi Nakamura\!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105528 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-05 14:50:21 +00:00
Dan Gohman
a15ec5dfcc Don't track users of undef values; they aren't interesting for
register pressure.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105501 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-04 23:16:05 +00:00
Devang Patel
93031ac032 Copy location info for current function argument from dbg.declare if respective store instruction does not have any location info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105490 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-04 22:27:30 +00:00
Jim Grosbach
23d3d4595c Remove unused code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105293 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-01 21:56:30 +00:00
Jim Grosbach
69081e9291 fix think-o
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105291 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-01 21:35:50 +00:00
Jim Grosbach
aeafb374e2 Simplify things a bit more. Fix prototype to use SmallVectorImpl and
change a few SmallVectors to vanilla C arrays.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105289 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-01 21:06:46 +00:00
Jim Grosbach
0fd8b6283f mirror of r105280 changes for LowerInvoke, which uses the same basic logic here
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105281 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-01 18:04:56 +00:00
Jim Grosbach
601f9d6c03 Use SmallVector instead of std::vector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105279 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-01 17:56:41 +00:00
Duncan Sands
2914ba6ec7 Fix PR7272: when inlining through a callsite with byval arguments,
the newly created allocas may be used by inlined calls, so these
need to have their tail call flags cleared.  Fixes PR7272.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105255 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-31 21:00:26 +00:00
Benjamin Kramer
c29df3cac7 Avoid swap when a copy suffices.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105220 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-31 12:50:41 +00:00
Nick Lewycky
a9d6680cb1 The memcpy intrinsic only takes i8* for %src and %dst, so cast them to that
first. Fixes PR7265.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105206 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-31 06:16:35 +00:00
Dan Gohman
dd9344f3fa Move FindAvailableLoadedValue isSafeToLoadUnconditionally out of
lib/Transforms/Utils and into lib/Analysis so that Analysis passes
can use them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104949 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-28 16:19:17 +00:00
Dan Gohman
05d6253727 Teach instcombine to promote alloca array sizes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104945 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-28 15:09:00 +00:00
Dan Gohman
28d2e0a39f Fix instcombine's handling of alloca to accept non-i32 types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104935 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-28 04:33:04 +00:00
Devang Patel
4251d85ae7 Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104914 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-28 01:29:50 +00:00
Devang Patel
f7a3051471 Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104913 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-28 01:17:51 +00:00
Devang Patel
d8720f4ba3 Do not drop location info for inlined function args.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104884 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-27 20:25:04 +00:00
Duncan Sands
1d9b973fd7 Teach instCombine to remove malloc+free if malloc's only uses are comparisons
to null.  Patch by Matti Niemenmaa.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104871 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-27 19:09:06 +00:00
Benjamin Kramer
1464c1d60a Kill unneeded SExt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104692 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-26 09:45:04 +00:00
Benjamin Kramer
48aefe15d0 Properly promote operands when optimizing a single-character memcmp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104648 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-25 22:53:43 +00:00
Dan Gohman
5b71dcedf0 Fix a missing newline in debug output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104644 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-25 21:50:35 +00:00
Dan Gohman
0fe46d9b48 DominatorTree.getNode can return null for unreachable blocks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104290 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-20 22:46:54 +00:00
Dan Gohman
9f383eb950 Minor code cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104287 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-20 22:25:20 +00:00
Dan Gohman
a552878508 Make Solve check its own post-condition, to reduce clutter in the
top-level LSRInstance logic.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104278 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-20 20:59:23 +00:00
Dan Gohman
76c315a26c Add comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104276 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-20 20:52:00 +00:00
Dan Gohman
402d43529c More code cleanups. Use iterators instead of indices when indices
aren't needed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104273 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-20 20:33:18 +00:00
Dan Gohman
c6519f916b Fix OptimizeShadowIV to set Changed. Change OptimizeLoopTermCond to set
Changed directly instead of using a return value.

Rename FilterOutUndesirableDedicatedRegisters's Changed variable to
distinguish it from LSRInstance's Changed member.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104269 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-20 20:05:31 +00:00
Dan Gohman
f7ff37d674 Add some comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104268 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-20 20:00:41 +00:00
Dan Gohman
d974a0e9d6 Simplify this code. Don't do a DomTreeNode lookup for each visited block.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104267 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-20 20:00:25 +00:00
Dan Gohman
ea507f5c28 Minor code cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104263 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-20 19:44:23 +00:00
Dan Gohman
f182b23f8f When canonicalizing icmp operand order to put the loop invariant
operand on the left, the interesting operand is on the right. This
fixes a bug where LSR was failing to recognize ICmpZero uses,
which led it to be unable to reverse the induction variable in the
attached testcase.

Delete test/CodeGen/X86/stack-color-with-reg-2.ll, because its test
is extremely fragile and hard to meaningfully update.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104262 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-20 19:26:52 +00:00
Dan Gohman
9da1bf4845 Set Changed to true when canonicalizing ICmp operand order; even though
it isn't a very interesting change, it's a change nonetheless.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104260 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-20 19:16:03 +00:00
Devang Patel
69b4d1caff Strip llvm.dbg.lv also.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104236 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-20 16:49:22 +00:00
Dan Gohman
24a7c30822 Rename a variable to avoid shadowing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104234 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-20 16:41:11 +00:00
Dan Gohman
4766744072 Minor code simplification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104232 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-20 16:23:28 +00:00
Dan Gohman
5ce6d05ad6 Move the code for deleting BaseRegs and LSRUses into helper functions,
and fix a bug that valgrind noticed where the code would std::swap an
element with itself.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104225 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-20 15:17:54 +00:00
Dan Gohman
a2086b3483 Teach LSR how to cope better with unrolled loops on targets where
the addressing modes don't make this trivially easy. This allows
it to avoid falling into the less precise heuristics in more
cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104186 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-19 23:43:12 +00:00
Dan Gohman
57aaa0b264 Add a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104089 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-18 23:55:57 +00:00
Dan Gohman
360026f07f Fix the predicate which checks for non-sensical formulae which have
constants in registers which partially cancel out their immediate fields.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104088 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-18 23:48:08 +00:00
Dan Gohman
b2df433f71 Factor out the code for recomputing an LSRUse's Regs set after some
of its formulae have been removed into a helper function, and also
teach it how to update the RegUseTracker.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104087 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-18 23:42:37 +00:00
Dan Gohman
d079c300ed Factor out code for estimating search space complexity into a helper
function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104082 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-18 22:51:59 +00:00
Dan Gohman
0da751baf7 Add some more debug output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104080 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-18 22:41:32 +00:00
Dan Gohman
d69d62833a Factor out the code for deleting a formula from an LSRUse into
a helper function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104079 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-18 22:39:15 +00:00
Dan Gohman
6458ff9230 Make some debug output more informative.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104078 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-18 22:37:37 +00:00
Dan Gohman
c4cfbaf217 Print an error message in Formula::print if the HasBaseReg flag
is inconsistent with the BaseRegs field. It's not print's job to
assert on an invalid condition, but it can make one more obvious.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104077 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-18 22:35:55 +00:00
Dan Gohman
90bb355b16 Rename RegUseTracker's RegUses member to RegUsesMap to avoid
confusion with LSRInstance's RegUses member.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104076 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-18 22:33:00 +00:00
Nick Lewycky
54b78dca4e Teach the always inliner to release its inline cost estimates, like the basic
inliner did in r103653. Why does the always inliner even bother with cost
estimates anyways?


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103858 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-15 04:26:25 +00:00
Nick Lewycky
1462a9b97f Clean up, no functional change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103857 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-15 03:41:58 +00:00
Nick Lewycky
911ae391e8 Remove heinous tabs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103700 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-13 06:45:13 +00:00
Nick Lewycky
33ab0b1568 Replace the core comparison login in merge functions. We can now merge
vector<>::push_back() in:

  int foo(vector<int> &a, vector<unsigned> &b) {
    a.push_back(10);
    b.push_back(11);
  }

to two calls to the same push_back function, or fold away the two copies of
push_back() in:

  struct T { int; };
  struct S { char; };
  vector<T*> t;
  vector<S*> s;
  void f(T *x) { t.push_back(x); }
  void g(S *x) { s.push_back(x); }

but leave f() and g() separate, since they refer to two different global
variables.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103698 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-13 05:48:45 +00:00
Nick Lewycky
9a1581b910 Clear CachedFunctionInfo upon Pass::releaseMemory. Because ValueMap will abort
on RAUW of functions, this is a correctness issue instead of a mere memory
usage problem.


No testcase until the new MergeFunctions can land.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103653 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-12 21:48:15 +00:00
Duncan Sands
16d8f8bd91 I got tired of VISIBILITY_HIDDEN colliding with the gcc enum. Rename it
to LLVM_LIBRARY_VISIBILITY and introduce LLVM_GLOBAL_VISIBILITY, which is
the opposite, for future use by dragonegg.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103495 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-11 20:16:09 +00:00
Douglas Gregor
7d9663c70b Fixes for Microsoft Visual Studio 2010, from Steven Watanabe!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103457 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-11 06:17:44 +00:00
Chris Lattner
c7d7e0cbe0 make simplifycfg insert an llvm.trap before the 'unreachable' it introduces
when it detects undefined behavior.  llvm.trap generally codegens into some
thing really small (e.g. a 2 byte ud2 instruction on x86) and debugging this
sort of thing is "nontrivial".  For example, we now compile:

void foo() { *(int*)0 = 42; }

into:

_foo:
	pushl	%ebp
	movl	%esp, %ebp
	ud2

Some may even claim that this is a security hole, though that seems dubious
to me.  This addresses rdar://7958343 - Optimizing away null dereference 
potentially allows arbitrary code execution


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103356 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-08 22:15:59 +00:00
Chris Lattner
6745191070 Teach instcombine to transform a bitcast/(zext|trunc)/bitcast sequence
with a vector input and output into a shuffle vector.  This sort of 
sequence happens when the input code stores with one type and reloads
with another type and then SROA promotes to i96 integers, which make
everyone sad.

This fixes rdar://7896024



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103354 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-08 21:50:26 +00:00
Chris Lattner
7944c21cae Fix PR7052, patch by Jakub Staszak!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103347 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-08 20:01:44 +00:00
Dan Gohman
59dc60337f When pruning candidate formulae out of an LSRUse, update the
LSRUse's Regs set after all pruning is done, rather than trying
to do it on the fly, which can produce an incomplete result.

This fixes a case where heuristic pruning was stripping all
formulae from a use, which led the solver to enter an infinite
loop.

Also, add a few asserts to diagnose this kind of situation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103328 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-07 23:36:59 +00:00
Devang Patel
e9f8f5e600 Wrap const MDNode * inside DIDescriptor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103295 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-07 20:54:48 +00:00
Devang Patel
ed66bf5125 Use overloaded operators instead of DIDescriptor::getNode()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103276 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-07 18:19:32 +00:00
Ted Kremenek
5fa680d397 Update CMake build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103266 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-07 17:13:20 +00:00
Dan Gohman
28a193ed8b Add an LLVM IR version of code sinking. This uses the same simple algorithm
as MachineSink, but it isn't constrained by MachineInstr-level details.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103257 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-07 15:40:13 +00:00
Bob Wilson
bc78653057 Use the right version of "append" to combine two SmallVectors.
This fixes the compile-time regressions seen in last night's tests.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103118 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-05 20:44:15 +00:00
Bob Wilson
4aad88d1fd Combine the implementations of the core part of the SSAUpdater and
MachineSSAUpdater to avoid duplicating all the code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103060 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-04 23:18:19 +00:00
Bob Wilson
34414a634e Defer adding critical edges to the "toSplit" list until after checking for
indirect branches in all the predecessors.  This avoids unnecessarily
splitting edges in cases where load PRE is not possible anyway.
Thanks to Jakub Staszak for pointing this out.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103034 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-04 20:03:21 +00:00
Dan Gohman
deff621abd Use getConstant instead of getIntegerSCEV. The two are basically the
same, now that getConstant has overloads consistent with ConstantInt::get.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102965 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 22:09:21 +00:00
Devang Patel
86b6f80a4c Check for side effects before splitting loop.
Patch by Jakub Staszak!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102928 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 18:06:58 +00:00
Chris Lattner
83f66fe614 revert r102831. We already delete dead readonly calls in
other places, killing a valid transformation is not the right
answer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102850 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-01 17:19:38 +00:00
Owen Anderson
1b4a38646f Disable the call-deletion transformation introduced in r86975. Without
halting analysis, it is illegal to delete a call to a read-only function.
The correct solution is almost certainly to add a "must halt" attribute and
only allow deletions in its presence.

XFAIL the relevant testcase for now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102831 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-01 08:34:28 +00:00
Chris Lattner
0ca2f28458 rename InlineInfo.DevirtualizedCalls -> InlinedCalls to
reflect that it includes all inlined calls now, not just
devirtualized ones.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102824 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-01 01:26:13 +00:00
Chris Lattner
6da12e6767 Implement rdar://6295824 and PR6724 with two tiny changes
that can have a big effect :).  The first is to enable the
iterative SCC passmanager juice that kicks in when the
scc passmgr detects that a function pass has devirtualized
a call.  In this case, it will rerun all the passes it 
manages on the SCC, up to the iteration count limit (4). This
is useful because a function pass may devirualize a call, and
we want the inliner to inline it, or pruneeh to infer stuff
about it, etc.

The second patch is to add *all* call sites to the 
DevirtualizedCalls list the inliner uses.  This list is
about to get renamed, but the jist of this is that the 
inliner now reconsiders *all* inlined call sites as candidates
for further inlining.  The intuition is this that in cases 
like this:

f() { g(1); }     g(int x) { h(x); }

We analyze this bottom up, and may decide that it isn't 
profitable to inline H into G.  Next step, we decide that it is
profitable to inline G into F, and do so, which means that F 
now calls H.  Even though the call from G -> H may not have been
profitable to inline, the call from F -> H may be (in this case
because a constant allows folding etc).

In my spot checks, this doesn't have a big impact on code.  For
example, the LLC output for 252.eon grew from 0.02% (from
317252 to 317308) and 176.gcc actually shrunk by .3% (from 1525612
to 1520964 bytes).  252.eon never iterated in the SCC Passmgr,
176.gcc iterated at most 1 time.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102823 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-01 01:15:56 +00:00
Chris Lattner
159528702a The inliner has traditionally not considered call sites
that appear due to inlining a callee as candidates for
futher inlining, but a recent patch made it do this if
those call sites were indirect and became direct.

Unfortunately, in bizarre cases (see testcase) doing this
can cause us to infinitely inline mutually recursive
functions into callers not in the cycle.  Fix this by
keeping track of the inline history from which callsite
inline candidates got inlined from.

This shouldn't affect any "real world" code, but is required
for a follow on patch that is coming up next.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102822 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-01 01:05:10 +00:00
Devang Patel
0aa885d3ab Preserve debug info attached with call instruction while eliminating dead argument.
Radar 7927803


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102760 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-30 20:23:54 +00:00
Chris Lattner
2d4b8ee1d9 further clarify alignment of globals, fix instcombine
to not increase the alignment of globals with an assigned
alignment and section.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102476 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-28 00:31:12 +00:00
Chris Lattner
c6f0aadc3b Fix a problem that lower invoke has with allocas (PR6694), and
add a version of createLowerInvokePass that allows the client
to specify whether it wants "expensive" or "cheap" lowering.

Patch by Alex Mac!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102402 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-26 23:49:32 +00:00
Chris Lattner
8581c260d3 fix PR6940: sitofp(undef) folds to 0.0, not undef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102358 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-26 18:21:23 +00:00
Chris Lattner
d89673c028 remove #if 1's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102296 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-25 04:43:02 +00:00
Dan Gohman
1d367988e2 Generalize LSR's OptimizeMax to handle the new kinds of max expressions
that indvars may use, now that indvars is recognizing le and ge loops.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102235 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-24 03:13:44 +00:00
Chris Lattner
5d7da43215 enable my inliner change: add newly devirtualized call sites to
the worklist, making them inline candidates.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102213 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-23 21:16:07 +00:00
Chris Lattner
076863225c switch InlineInfo.DevirtualizedCalls's list to be of WeakVH.
This fixes a bug where calls inlined into an invoke would get
changed into an invoke but the array would keep pointing to
the (now dead) call.  The improved inliner behavior is still
disabled for now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102196 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-23 18:37:01 +00:00
Dan Gohman
fafb890ee2 Fix LSR to tolerate cases where ScalarEvolution initially
misses an opportunity to fold add operands, but folds them
after LSR has separated them out. This fixes rdar://7886751.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102157 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-23 01:55:05 +00:00
Chris Lattner
62cc838b90 disable my previous inliner patch, it appears to be busting self-host.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102153 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-23 00:41:03 +00:00
Chris Lattner
fe9af3b1f7 The inliner was choosing to not consider call sites
that appear in the SCC as a result of inlining as candidates
for inlining.  Change this so that it *does* consider call 
sites that change from being indirect to being direct as a
result of inlining.  This allows it to completely 
"devirtualize" the testcase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102146 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-22 23:37:35 +00:00
Chris Lattner
60915146f4 refactor the interface to InlineFunction so that most of the in/out
arguments are handled with a new InlineFunctionInfo class.  This 
makes it easier to extend InlineFunction to return more info in the
future.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102137 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-22 23:07:58 +00:00
Chris Lattner
b957a5e41e when inlining something like this:
define void @f3(void (i8*)* %__f) ssp {
entry:
  call void %__f(i8* undef)
  unreachable
}

define void @f4(i8* %this) ssp align 2 {
entry:
  call void @f3(void (i8*)* @f2) ssp
  ret void
}

The inliner is turning the indirect call to %__f into a direct
call to F2.  Make the call graph more precise when this happens.

The inliner doesn't revisit call sites introduced by inlining,
so there isn't an easy way to test for this, but a more precise
callgraph is a good thing.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102131 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-22 21:31:00 +00:00
Chris Lattner
f8b99cb03b eliminate dead #include.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102119 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-22 20:41:10 +00:00
Bob Wilson
b913863a95 Fix a performance problem with the new SSAUpdater. This showed up in the
GCCAS time for MultiSource/Benchmarks/ASCI_Purple/SMG2000.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102009 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-21 18:39:03 +00:00
Devang Patel
3943084136 Rename ValueMapTy as ValueToValueMapTy to clearly indicate that this has no replationship with ADT/ValueMap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101950 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-20 22:24:18 +00:00
Devang Patel
cd9b492451 There is no need to install ValueMapper.h header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101949 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-20 22:18:31 +00:00
Gabor Greif
a9b2313c13 use abstract accessors to CallInst
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101899 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-20 13:13:04 +00:00
Chris Lattner
4f1f6f6342 remove a bunch of ad-hoc code to simplify instructions from
loop unswitch, and use inst simplify instead.  It is more
powerful and less duplication.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101874 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-20 05:33:18 +00:00
Chris Lattner
047542669a move some select simplifications out out instcombine into
inst simplify.  No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101873 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-20 05:32:14 +00:00
Chris Lattner
a78130c320 RewriteLoopBodyWithConditionConstant can end up rewriting the
condition we're unswitching on.  In this case, don't try to
simplify the second copy of the loop which may be dead or not,
but is probably a constant now.  This fixes PR6879


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101870 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-20 05:09:16 +00:00
Chris Lattner
4471136e4d make the inliner do less work for leaf functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101846 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-20 00:47:08 +00:00
Chris Lattner
eae220259f Fix rdar://7879828 - crash in CallGraph, a self host issue.
Arg promotion was deleting call graph nodes that still had references
from the 'indirect' CGN.  Like the inliner, it should only delete the
function if all references are gone.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101845 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-20 00:46:50 +00:00
Dan Gohman
c056454ecf Remove the Expr member from IVUsers. Instead of remembering the expression,
just ask ScalarEvolution for it on demand. This helps IVUsers be more robust
in the case of expressions changing underneath it. This fixes PR6862.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101819 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-19 21:48:58 +00:00
Bob Wilson
84bd6b0c31 Re-commit my previous SSAUpdater changes. The previous version naively tried
to determine where to place PHIs by iteratively comparing reaching definitions
at each block.  That was just plain wrong.  This version now computes the
dominator tree within the subset of the CFG where PHIs may need to be placed,
and then places the PHIs in the iterated dominance frontier of each definition.
The rest of the patch is mostly the same, with a few more performance
improvements added in.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101612 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-17 03:08:24 +00:00
Eric Christopher
551754c495 Revert 101465, it broke internal OpenGL testing.
Probably the best way to know that all getOperand() calls have been handled
is to replace that API instead of updating.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101579 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16 23:37:20 +00:00
Chris Lattner
2decb22222 introduce a new CallGraphSCC class, and pass it around
to CallGraphSCCPass's instead of passing around a
std::vector<CallGraphNode*>.  No functionality change,
but now we have a much tidier interface.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101558 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16 22:42:17 +00:00
Dan Gohman
ea25b48af3 Refine the detection of seemingly infinitely recursive calls where the
callee is expected to be expanded to something else by codegen, so that
normal infinitely recursive calls are still transformed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101468 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16 15:57:50 +00:00
Gabor Greif
4ec2258ffb reapply r101434
with a fix for self-hosting

rotate CallInst operands, i.e. move callee to the back
of the operand array

the motivation for this patch are laid out in my mail to llvm-commits:
more efficient access to operands and callee, faster callgraph-construction,
smaller compiler binary


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101465 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16 15:33:14 +00:00
Chris Lattner
a0bada729f fix comment noticed by Bob
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101437 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16 02:32:17 +00:00
Gabor Greif
607a7ab3da back out r101423 and r101397, they break llvm-gcc self-host on darwin10
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101434 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16 01:16:20 +00:00
Chris Lattner
d55c1c1659 fix PR6832: we were using the alignment of a pointer when we
wanted the alignment of the pointee.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101432 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16 01:05:38 +00:00
Chris Lattner
a001b66498 improve comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101429 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16 00:38:19 +00:00
Chris Lattner
4cc576bc5e pull all the ConvertToScalarInfo code together into one
place.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101427 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16 00:24:57 +00:00
Chris Lattner
593375d04a more refactoring: suck some stuff out of SRoA into
ConvertToScalarInfo.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101425 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16 00:20:00 +00:00
Gabor Greif
8db3f2c2ab shift intrinsic operand
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101423 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16 00:06:45 +00:00
Chris Lattner
c447207264 introduce a new ConvertToScalarInfo struct to simplify
CanConvertToScalar/MergeInType.  Eliminate a pointless
LLVMContext argument to MergeInType.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101422 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 23:50:26 +00:00
Chris Lattner
31d80103d5 tidy interface to isOnlyCopiedFromConstantGlobal
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101405 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 21:59:20 +00:00
Gabor Greif
2ff961f668 reapply r101364, which has been backed out in r101368
with a fix

rotate CallInst operands, i.e. move callee to the back
of the operand array

the motivation for this patch are laid out in my mail to llvm-commits:
more efficient access to operands and callee, faster callgraph-construction,
smaller compiler binary


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101397 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 20:51:13 +00:00
Anton Korobeynikov
764f62ba60 Revert r100896 and around - this breaks the only mingw32 buildbot we have.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101387 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 19:51:42 +00:00
Dan Gohman
b35798347e Fix a bunch of namespace polution.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101376 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 17:08:50 +00:00
Gabor Greif
9ee1720811 back out r101364, as it trips the linux nightlybot on some clang C++ tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101368 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 12:46:56 +00:00
Gabor Greif
165dac08d1 rotate CallInst operands, i.e. move callee to the back
of the operand array

the motivation for this patch are laid out in my mail to llvm-commits:
more efficient access to operands and callee, faster callgraph-construction,
smaller compiler binary


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101364 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 10:49:53 +00:00
Tobias Grosser
a76b334d44 IPO needs ScalarOpts and InstCombine in its libs
The commit "Adding IPSCCP and Internalize passes to the C-bindings" introduced
new dependencies for IPO. Add these to the CMAKE build as otherwise the
BUILD_SHARED_LIBS=1 build fails.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101313 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-14 23:42:23 +00:00
Evan Cheng
86cd445645 - Code clean up to reduce indentation.
- TryToOptimizeStoreOfMallocToGlobal should check if TargetData is available and bail out if it is not. The transformations being done requires TD.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101285 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-14 20:52:55 +00:00
Gabor Greif
67894a3d02 performance: cache the dereferenced use_iterator
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101253 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-14 16:48:56 +00:00
Gabor Greif
488d4421c6 performance: cache the dereferenced use_iterator
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101250 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-14 16:13:56 +00:00
Nick Lewycky
3c594ff290 I don't know how, but I managed to goof the revert. Remove function that should
have been removed in r101231.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101232 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-14 05:03:50 +00:00
Nick Lewycky
3715e45da5 Revert r101213.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101231 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-14 04:51:58 +00:00
Nick Lewycky
ff1ef6bdf1 Remove tab.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101223 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-14 04:19:05 +00:00
Nick Lewycky
5894c0b60e While DAE can't modify the function signature of an externally visible function,
it can check whether the visible direct callers are passing in parameters to
dead arguments and replace those with undef.

This reinstates r94322 with bugs fixed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101213 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-14 03:38:11 +00:00
Eric Christopher
2a7cb9d9ce Actually... return after the check for invalid input.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101139 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-13 16:41:29 +00:00
Owen Anderson
d5e624027a Remove SCCVN from the CMake build system.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101125 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-13 08:33:09 +00:00
Owen Anderson
fd64901579 SCCVN, we hardly knew ye!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101117 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-13 05:24:08 +00:00
Dan Gohman
a590b79ee2 Teach IndVarSimplify how to eliminate remainder operators where the
numerator is an induction variable. For example, with code like this:

  for (i=0;i<n;++i)
    x[i%n] = 0;

IndVarSimplify will now recognize that i is always less than n inside
the loop, and eliminate the remainder.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101113 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-13 01:46:36 +00:00
Dan Gohman
ca9b7037e2 Suppress LinearFunctionTestReplace when the computed backedge-taken
expression is a UDiv and it doesn't appear that the UDiv came from
the user's source.

ScalarEvolution has recently figured out how to compute a tripcount
expression for the inner loop in
SingleSource/Benchmarks/Shootout/sieve.c, using a udiv. Emitting a
udiv instruction dramatically slows down the enclosing loop.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101068 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-12 21:13:43 +00:00
Dan Gohman
ef817ccec4 Delete this code, which is no longer needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101033 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-12 08:00:22 +00:00
Dan Gohman
d890f29ca6 Move the EliminateIVUsers call back out to its original location. Now that
a ScalarEvolution bug with overflow handling is fixed, the normal analysis
code will automatically decline to operate on the icmp instructions which
are responsible for the loop exit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101032 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-12 07:56:56 +00:00
Dan Gohman
dd842e34c8 Use RecursivelyDeleteTriviallyDeadInstructions in EliminateIVComparisons,
instead of deleting just the user. This makes it more consistent with
other code in IndVarSimplify, and theoretically can eliminate more users
earlier.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101027 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-12 07:29:15 +00:00
Eric Christopher
67a71b5306 Verify function prototypes before trying to optimize functions. We also
need TargetData, just return false if we don't have it.

Update testcases accordingly.

Fixes PR6807.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101011 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-12 04:48:00 +00:00
Dan Gohman
931e345e76 Re-apply r101000, with a fix: Don't eliminate an icmp which is part of
the loop exit test. This usually doesn't come up for a variety of
reasons, but it isn't impossible, so make IndVarSimplify handle it
conservatively.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101008 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-12 02:21:50 +00:00
Dan Gohman
ac3b9cdf15 Revert 101000, which is breaking self-host builds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101002 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-12 00:17:10 +00:00
Dan Gohman
3fddbb337d Teach IndVarSimplify how to eliminate comparisons involving induction
variables. For example, with code like this:

  for (i=0;i<n;++i)
    if (i<n)
      x[i] = 0;

IndVarSimplify will now recognize that i is always less than n inside
the loop, and eliminate the if.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101000 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-11 23:10:12 +00:00
Dan Gohman
3948d0b8b0 Rename isLoopGuardedByCond to isLoopEntryGuardedByCond, to emphasise
that it's only testing for the entry condition, not full loop-invariant
conditions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100979 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-11 19:27:13 +00:00
Chris Lattner
5106dcd078 Implement support for varargs functions without any fixed
parameters in the CBE by implicitly adding a fixed argument.
This allows eliminating a work-around from DAE.  Patch by
Sylvere Teissier!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100944 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-10 19:12:44 +00:00
Chris Lattner
6f285d2105 fix PR6743, a case where we'd delete an instruction before using it
in some cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100937 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-10 18:26:57 +00:00
Chris Lattner
a2fb234b04 fix PR6760, a missing check in heap SRoA.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100936 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-10 18:19:22 +00:00
Dan Gohman
e5f76877ae When determining a canonical insert position, don't climb deeper
into adjacent loops. Also, ensure that the insert position is
dominated by the loop latch of any loop in the post-inc set which
has a latch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100906 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-09 22:07:05 +00:00
Chris Lattner
e3a39d40db suck the propagating "has dynamic libs" check into a single makefile
variable TARGET_HAS_DYNAMIC_LIBS


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100896 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-09 20:51:47 +00:00
Chris Lattner
21aa347c28 add minix support, patch by Kees van Reeuwijk! PR6797
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100895 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-09 20:45:04 +00:00
Wesley Peck
16ddd885d8 Adding IPSCCP and Internalize passes to the C-bindings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100893 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-09 20:43:20 +00:00
Dan Gohman
4a2a683366 When looking for loop-invariant users, look through no-op instructions,
so that an unfortunately placed bitcast doesn't pin a value in a
register.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100883 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-09 19:12:34 +00:00
Gabor Greif
c092362300 performance: cache result of looking up user
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100862 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-09 15:18:34 +00:00
Dan Gohman
6c3ae655b8 Minor code simplification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100859 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-09 14:53:59 +00:00
Gabor Greif
ea3eec9f85 const-ize a predicate
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100856 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-09 10:57:00 +00:00
Dan Gohman
d96eae8010 Refactor the code for computing the insertion point for an expression into
a separate function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100845 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-09 02:00:38 +00:00
Chris Lattner
8829cec25f fix a SCCP miscompilation that could happen when a
forced constant is changed to a constant, we would end
up adding the instruction to the wrong worklist, 
preventing it from being properly revisited.  This fixes
rdar://7832370


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100837 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-09 01:14:31 +00:00
Dan Gohman
e60bb15982 Avoid allocating a value of zero in a register if the initial formula
inputs happen to negate each other.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100828 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 23:36:27 +00:00
Dan Gohman
e056781323 Add variants of ult, ule, etc. which take a uint64_t RHS, for convenience.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100824 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 23:03:40 +00:00
Dan Gohman
701a4aef7f When expanding expressions which are using post-inc mode for multiple loops,
ensure that the expansion is dominated by the increments of those loops.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100748 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 05:57:57 +00:00
Dan Gohman
a5ced590c9 Say bitcast instead of bitconvert.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100720 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-07 23:22:42 +00:00
Eric Christopher
71988f1e5b Add support for stpncpy_chk.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100710 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-07 23:00:07 +00:00
Chris Lattner
75361b69f3 rename llvm::llvm_report_error -> llvm::report_fatal_error
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100709 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-07 22:58:41 +00:00
Dan Gohman
448db1cdef Generalize IVUsers to track arbitrary expressions rather than expressions
explicitly split into stride-and-offset pairs. Also, add the
ability to track multiple post-increment loops on the same expression.

This refines the concept of "normalizing" SCEV expressions used for
to post-increment uses, and introduces a dedicated utility routine for
normalizing and denormalizing expressions.

This fixes the expansion of expressions which are post-increment users
of more than one loop at a time. More broadly, this takes LSR another
step closer to being able to reason about more than one loop at a time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100699 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-07 22:27:08 +00:00
Gabor Greif
2723691492 fix 80-col violations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100677 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-07 18:59:26 +00:00
Gabor Greif
8a8a4350db performance: get rid of repeated dereferencing of use_iterator by caching its result
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100550 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-06 19:32:30 +00:00
Gabor Greif
6ce02b5939 make more two predicates constant
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100549 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-06 19:24:18 +00:00
Gabor Greif
a01d6db569 performance: get rid of repeated dereferencing of use_iterator by caching its result
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100547 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-06 19:14:05 +00:00
Gabor Greif
0b520db74d const-ize predicate ValueIsOnlyUsedLocallyOrStoredToOneGlobal
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100546 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-06 18:58:22 +00:00
Gabor Greif
fa1f5c22c5 use CallSite to access calls vs. invokes uniformly
and remove assumptions about operand order

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100544 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-06 18:45:08 +00:00
Chris Lattner
e597f00e1a fix a really nasty bug that Evan was tracking in SCCP. When resolving
undefs in branches/switches, we have two cases: a branch on a literal
undef or a branch on a symbolic value which is undef.  If we have a
literal undef, the code was correct: forcing it to a constant is the
right thing to do.

If we have a branch on a symbolic value that is undef, we should force
the symbolic value to a constant, which then makes the successor block
live.  Forcing the condition of the branch to being a constant isn't 
safe if later paths become live and the value becomes overdefined.  This
is the case that 'forcedconstant' is designed to handle, so just use it.

This fixes rdar://7765019 but there is no good testcase for this, the
one I have is too insane to be useful in the future.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100478 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-05 22:14:48 +00:00
Chris Lattner
9e185800c0 some code cleanups, use SwitchInst::findCaseValue, reduce indentation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100468 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-05 21:18:32 +00:00
Evan Cheng
0f1666b480 Code clean up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100467 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-05 21:16:25 +00:00
Mon P Wang
20adc9dc46 Reapply address space patch after fixing an issue in MemCopyOptimizer.
Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset,
e.g., llvm.memcpy.i32(i8*, i8*, i32, i32) -> llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100304 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-04 03:10:48 +00:00
Chris Lattner
d52c072777 require that the branch being controlled by the IV
exits the loop.  With this information we can guarantee 
the iteration count of the loop is bounded by the 
compare.  I think this xforms is finally safe now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100285 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-03 07:21:39 +00:00