oota-llvm.git
17 years agoadd a new node
Chris Lattner [Sun, 4 Mar 2007 20:40:06 +0000 (20:40 +0000)]
add a new node

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34912 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agonew testcase, corresponds to:
Chris Lattner [Sun, 4 Mar 2007 20:39:47 +0000 (20:39 +0000)]
new testcase, corresponds to:

long long test(long long A, unsigned B) {
  return (A + ((long long)B << 32));
}

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34911 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agogeneralize
Chris Lattner [Sun, 4 Mar 2007 20:08:45 +0000 (20:08 +0000)]
generalize

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34910 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agocanonicalize constants to the RHS of addc/adde. If nothing uses the carry out of
Chris Lattner [Sun, 4 Mar 2007 20:03:15 +0000 (20:03 +0000)]
canonicalize constants to the RHS of addc/adde.  If nothing uses the carry out of
addc, turn it into add.

This allows us to compile:

long long test(long long A, unsigned B) {
  return (A + ((long long)B << 32)) & 123;
}

into:

_test:
        movl $123, %eax
        andl 4(%esp), %eax
        xorl %edx, %edx
        ret

instead of:
_test:
        xorl %edx, %edx
        movl %edx, %eax
        addl 4(%esp), %eax   ;; add of zero
        andl $123, %eax
        ret

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34909 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoeliminate some ops if they have an undef RHS
Chris Lattner [Sun, 4 Mar 2007 20:01:46 +0000 (20:01 +0000)]
eliminate some ops if they have an undef RHS

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34908 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agofix typo
Chris Lattner [Sun, 4 Mar 2007 06:36:24 +0000 (06:36 +0000)]
fix typo

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34906 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoadd missing braces
Chris Lattner [Sun, 4 Mar 2007 06:13:52 +0000 (06:13 +0000)]
add missing braces

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34905 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agominor cleanups
Chris Lattner [Sun, 4 Mar 2007 04:50:21 +0000 (04:50 +0000)]
minor cleanups

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34904 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoRemove unneeded header file.
Reid Spencer [Sun, 4 Mar 2007 04:41:04 +0000 (04:41 +0000)]
Remove unneeded header file.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34903 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoSpeed up -instcombine by 20% by avoiding a particularly expensive passmgr call.
Chris Lattner [Sun, 4 Mar 2007 04:27:24 +0000 (04:27 +0000)]
Speed up -instcombine by 20% by avoiding a particularly expensive passmgr call.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34902 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoswitch MarkAliveBlocks over to using SmallPtrSet instead of std::set, speeding
Chris Lattner [Sun, 4 Mar 2007 04:20:48 +0000 (04:20 +0000)]
switch MarkAliveBlocks over to using SmallPtrSet instead of std::set, speeding
up simplifycfg by 20%

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34901 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoSpeed up Loop::isLCSSAForm by using a hash table instead of a sorted vector.
Chris Lattner [Sun, 4 Mar 2007 04:06:39 +0000 (04:06 +0000)]
Speed up Loop::isLCSSAForm by using a hash table instead of a sorted vector.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34900 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoadd iterator range version of ctor.
Chris Lattner [Sun, 4 Mar 2007 04:04:43 +0000 (04:04 +0000)]
add iterator range version of ctor.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34899 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agomake better use of LCSSA information in RewriteLoopExitValues. Before, we
Chris Lattner [Sun, 4 Mar 2007 03:43:23 +0000 (03:43 +0000)]
make better use of LCSSA information in RewriteLoopExitValues.  Before, we
would scan the entire loop body, then scan all users of instructions in the
loop, looking for users outside the loop.  Now, since we know that the
loop is in LCSSA form, we know that any users outside the loop will be LCSSA
phi nodes.  Just scan them.

This speeds up indvars significantly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34898 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoGuard further against APInt operations with operands of unequal bit width.
Reid Spencer [Sun, 4 Mar 2007 01:25:35 +0000 (01:25 +0000)]
Guard further against APInt operations with operands of unequal bit width.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34897 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoImplement PR1179/PR1232 and test/Transforms/IndVarsSimplify/loop_evaluate_[234].ll
Chris Lattner [Sun, 4 Mar 2007 01:00:28 +0000 (01:00 +0000)]
Implement PR1179/PR1232 and test/Transforms/IndVarsSimplify/loop_evaluate_[234].ll

This makes -indvars require and use LCSSA, updating it as appropriate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34896 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoNew testcases for PR1179/PR1232.
Chris Lattner [Sun, 4 Mar 2007 00:54:06 +0000 (00:54 +0000)]
New testcases for PR1179/PR1232.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34895 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoGet the version number for the LLVM from the autoconf/configure.ac file
Reid Spencer [Sun, 4 Mar 2007 00:45:50 +0000 (00:45 +0000)]
Get the version number for the LLVM from the autoconf/configure.ac file
when building the documentation for the web site.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34894 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix CodeGen/Generic/fpowi-promote.ll and PR1239
Chris Lattner [Sat, 3 Mar 2007 23:43:21 +0000 (23:43 +0000)]
Fix CodeGen/Generic/fpowi-promote.ll and PR1239

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34893 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoNew testcase for PR1239
Chris Lattner [Sat, 3 Mar 2007 23:42:50 +0000 (23:42 +0000)]
New testcase for PR1239

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34892 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoMake RewriteLoopExitValues far less nested by using continue in the loop
Chris Lattner [Sat, 3 Mar 2007 22:48:48 +0000 (22:48 +0000)]
Make RewriteLoopExitValues far less nested by using continue in the loop

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34891 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd an expand action for ISD label which just deletes the label.
Chris Lattner [Sat, 3 Mar 2007 19:21:38 +0000 (19:21 +0000)]
Add an expand action for ISD label which just deletes the label.
This "fixes" PR1238.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34890 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoRemove unnecessary #include.
Reid Spencer [Sat, 3 Mar 2007 18:29:16 +0000 (18:29 +0000)]
Remove unnecessary #include.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34889 91177308-0d34-0410-b5e6-96231b3b80d8

17 years ago1. Handle errors around the ModuleProvider. This is necessary since it is
Reid Spencer [Sat, 3 Mar 2007 18:21:44 +0000 (18:21 +0000)]
1. Handle errors around the ModuleProvider. This is necessary since it is
   reading bytecode.
2. The interpreter can delete the ModuleProvider and replace it with
   another so don't depend on it being around after the EE is created.
3. Don't just run llvm_shutdown on exit but actually delete the EE as well.
   This cleans up a vast amount of memory (but not all) that EE retained
   through exit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34888 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoDeal with error handling better.
Reid Spencer [Sat, 3 Mar 2007 18:19:18 +0000 (18:19 +0000)]
Deal with error handling better.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34887 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoMake the creation functions take an error string. This will help the
Reid Spencer [Sat, 3 Mar 2007 18:18:11 +0000 (18:18 +0000)]
Make the creation functions take an error string. This will help the
ExecutionEngine report errors on creation (like bytecode stuff) and also
help to get rid of exception handling.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34886 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoMake sure that when we store a value it is masked to its correct bit
Reid Spencer [Sat, 3 Mar 2007 16:33:33 +0000 (16:33 +0000)]
Make sure that when we store a value it is masked to its correct bit
width. This helps CBE work with non-standard integer bit widths.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34885 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoComplete the APIntification of the interpreter. All asserts for > 64 bits
Reid Spencer [Sat, 3 Mar 2007 08:38:04 +0000 (08:38 +0000)]
Complete the APIntification of the interpreter. All asserts for > 64 bits
have been removed and dealt with. The interpreter should now be able to
execute any LLVM program using any bit width.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34884 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAvoid memory leakage by having caller construct the APInt for the
Reid Spencer [Sat, 3 Mar 2007 08:36:29 +0000 (08:36 +0000)]
Avoid memory leakage by having caller construct the APInt for the
destination value of LoadValueFromMemory.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34883 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoRequire the destination GlobalValue for LoadValueFromMemory to be passed
Reid Spencer [Sat, 3 Mar 2007 08:35:14 +0000 (08:35 +0000)]
Require the destination GlobalValue for LoadValueFromMemory to be passed
in as a parameter instead of returned.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34882 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoRegularize the interface for conversion functions to/from float/double.
Reid Spencer [Sat, 3 Mar 2007 08:34:02 +0000 (08:34 +0000)]
Regularize the interface for conversion functions to/from float/double.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34881 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix constant folding of fp->int bitcast for vectors.
Reid Spencer [Sat, 3 Mar 2007 08:32:46 +0000 (08:32 +0000)]
Fix constant folding of fp->int bitcast for vectors.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34880 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd APIntVal as a possible GenericeValue.
Reid Spencer [Sat, 3 Mar 2007 07:36:44 +0000 (07:36 +0000)]
Add APIntVal as a possible GenericeValue.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34879 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoOnly propagate IsKill if the last use is a kill.
Evan Cheng [Sat, 3 Mar 2007 06:32:37 +0000 (06:32 +0000)]
Only propagate IsKill if the last use is a kill.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34878 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoImplement APInt support for the binary operators.
Reid Spencer [Sat, 3 Mar 2007 06:22:22 +0000 (06:22 +0000)]
Implement APInt support for the binary operators.
Move the getConstantExpr function towards the end of the file so we don't
need a dozen forward declarations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34877 91177308-0d34-0410-b5e6-96231b3b80d8

17 years ago1. Have the ExecutionContext keep track of the APInt's allocated and
Reid Spencer [Sat, 3 Mar 2007 06:19:55 +0000 (06:19 +0000)]
1. Have the ExecutionContext keep track of the APInt's allocated and
   ensure they are cleaned up when the stack frame exits.
2. Move a function to the Execution.cpp file where it belongs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34876 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agohttp://llvm.org/bugs/show_bug.cgi?id=1237
Nate Begeman [Sat, 3 Mar 2007 06:18:18 +0000 (06:18 +0000)]
http://llvm.org/bugs/show_bug.cgi?id=1237

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34875 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoImplement loading and storing of APInt values from memory.
Reid Spencer [Sat, 3 Mar 2007 06:18:03 +0000 (06:18 +0000)]
Implement loading and storing of APInt values from memory.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34874 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoMake getNumWords public so that those using getRawData stand a chance of
Reid Spencer [Sat, 3 Mar 2007 06:17:23 +0000 (06:17 +0000)]
Make getNumWords public so that those using getRawData stand a chance of
not reading beyond the end of the buffer returned.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34873 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd names for some of the operators. This is needed for the macros in
Reid Spencer [Sat, 3 Mar 2007 05:37:23 +0000 (05:37 +0000)]
Add names for some of the operators. This is needed for the macros in
the Interpreter.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34872 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoEmit low/high immediate loads properly for Linux/PPC.
Nick Lewycky [Sat, 3 Mar 2007 05:29:51 +0000 (05:29 +0000)]
Emit low/high immediate loads properly for Linux/PPC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34871 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agomy recent change caused a failure in a bswap testcase, because it changed
Chris Lattner [Sat, 3 Mar 2007 05:27:34 +0000 (05:27 +0000)]
my recent change caused a failure in a bswap testcase, because it changed
the order that instcombine processed instructions in the testcase.  The end
result is that instcombine finished with:

define i16 @test1(i16 %a) {
        %tmp = zext i16 %a to i32               ; <i32> [#uses=2]
        %tmp21 = lshr i32 %tmp, 8               ; <i32> [#uses=1]
        %tmp5 = shl i32 %tmp, 8         ; <i32> [#uses=1]
        %tmp.upgrd.32 = or i32 %tmp21, %tmp5            ; <i32> [#uses=1]
        %tmp.upgrd.3 = trunc i32 %tmp.upgrd.32 to i16           ; <i16> [#uses=1]
        ret i16 %tmp.upgrd.3
}

which can't get matched as a bswap.

This patch makes instcombine more sophisticated about removing truncating
casts, allowing it to turn this into:

define i16 @test2(i16 %a) {
        %tmp211 = lshr i16 %a, 8
        %tmp52 = shl i16 %a, 8
        %tmp.upgrd.323 = or i16 %tmp211, %tmp52
        ret i16 %tmp.upgrd.323
}

which then matches as bswap.  This fixes bswap.ll and implements
InstCombine/cast2.ll:test[12].  This also implements cast elimination of
add/sub.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34870 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agonew testcase: instcombine should remove all the casts.
Chris Lattner [Sat, 3 Mar 2007 05:24:06 +0000 (05:24 +0000)]
new testcase: instcombine should remove all the casts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34869 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoTranslate bit operations to English.
Nick Lewycky [Sat, 3 Mar 2007 03:14:40 +0000 (03:14 +0000)]
Translate bit operations to English.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34868 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoinstcombine doesn't do CSE, simplify unrelated detail
Chris Lattner [Sat, 3 Mar 2007 02:27:02 +0000 (02:27 +0000)]
instcombine doesn't do CSE, simplify unrelated detail

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34867 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoWatch out for cases like this:
Evan Cheng [Sat, 3 Mar 2007 02:18:00 +0000 (02:18 +0000)]
Watch out for cases like this:

entry (0x8b056f0, LLVM BB @0x8b01b30, ID#0):
Live Ins: %r0 %r1 %r2 %r3
        %reg1032 = tMOVrr %r3<kill>
        %reg1033 = tMOVri8 1
        %reg1034 = tMOVri8 0
        tCMPi8 %reg1029<kill>, 0
        tBcc mbb<entry,0x8b06a10>, 0
    Successors according to CFG: 0x8b06980 0x8b06a10

entry (0x8b06980, LLVM BB @0x8b01b30, ID#12):
    Predecessors according to CFG: 0x8b056f0
        %reg1036 = tMOVrr %reg1034<kill>
    Successors according to CFG: 0x8b06a10

entry (0x8b06a10, LLVM BB @0x8b01b30, ID#13):
    Predecessors according to CFG: 0x8b056f0 0x8b06980
        %reg1024<dead> = tMOVrr %reg1030<kill>
        ...

reg1030 and r1 have already been joined. When reg1024 and reg1030 are joined,
r1 live range from function entry to the tMOVrr instruction are dead. Eliminate
r1 from the livein set of the entry BB, not the BB where the copy is.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34866 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoadd a top-level iteration loop to instcombine. This means that it will never
Chris Lattner [Sat, 3 Mar 2007 02:04:50 +0000 (02:04 +0000)]
add a top-level iteration loop to instcombine.  This means that it will never
finish without combining something it is capable of.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34865 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAPIntify this pass.
Reid Spencer [Sat, 3 Mar 2007 00:48:31 +0000 (00:48 +0000)]
APIntify this pass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34863 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd isPositive for symmetry with isNegative.
Reid Spencer [Sat, 3 Mar 2007 00:24:39 +0000 (00:24 +0000)]
Add isPositive for symmetry with isNegative.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34862 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFinally get this patch right :)
Reid Spencer [Fri, 2 Mar 2007 23:51:25 +0000 (23:51 +0000)]
Finally get this patch right :)
Replace expensive getZExtValue() == 0 calls with isZero() calls.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34861 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoDang, I've done that twice now! Undo previous commit.
Reid Spencer [Fri, 2 Mar 2007 23:37:53 +0000 (23:37 +0000)]
Dang, I've done that twice now! Undo previous commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34860 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoUse more efficient test for one value in a ConstantInt.
Reid Spencer [Fri, 2 Mar 2007 23:35:28 +0000 (23:35 +0000)]
Use more efficient test for one value in a ConstantInt.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34859 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoGuard against huge loop trip counts in an APInt safe way.
Reid Spencer [Fri, 2 Mar 2007 23:31:34 +0000 (23:31 +0000)]
Guard against huge loop trip counts in an APInt safe way.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34858 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoX86-64 VACOPY needs custom expansion. va_list is a struct { i32, i32, i8*, i8* }.
Evan Cheng [Fri, 2 Mar 2007 23:16:35 +0000 (23:16 +0000)]
X86-64 VACOPY needs custom expansion. va_list is a struct { i32, i32, i8*, i8* }.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34857 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoMake sure debug code is not evaluated in non-debug case.
Reid Spencer [Fri, 2 Mar 2007 23:15:21 +0000 (23:15 +0000)]
Make sure debug code is not evaluated in non-debug case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34856 91177308-0d34-0410-b5e6-96231b3b80d8

17 years ago1. Sort switch cases using APInt safe comparison.
Reid Spencer [Fri, 2 Mar 2007 23:05:28 +0000 (23:05 +0000)]
1. Sort switch cases using APInt safe comparison.
2. Make sure debug output of APInt values is safe for all bit widths.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34855 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoUse APInt safe isOne() method on ConstantInt instead of getZExtValue()==1
Reid Spencer [Fri, 2 Mar 2007 23:03:17 +0000 (23:03 +0000)]
Use APInt safe isOne() method on ConstantInt instead of getZExtValue()==1

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34854 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoMake sorting of ConstantInt be APInt clean through use of ult function.
Reid Spencer [Fri, 2 Mar 2007 23:01:14 +0000 (23:01 +0000)]
Make sorting of ConstantInt be APInt clean through use of ult function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34853 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix ashr for bitwidths > 64. This is now validated up to 1024 bits.
Reid Spencer [Fri, 2 Mar 2007 22:39:11 +0000 (22:39 +0000)]
Fix ashr for bitwidths > 64. This is now validated up to 1024 bits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34852 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix uninitialized use of variable. Remove tabs and fix identation.
Anton Korobeynikov [Fri, 2 Mar 2007 22:19:41 +0000 (22:19 +0000)]
Fix uninitialized use of variable. Remove tabs and fix identation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34850 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoSimplify things
Anton Korobeynikov [Fri, 2 Mar 2007 21:50:27 +0000 (21:50 +0000)]
Simplify things

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34849 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix a significant algorithm problem with the instcombine worklist. removing
Chris Lattner [Fri, 2 Mar 2007 21:28:56 +0000 (21:28 +0000)]
Fix a significant algorithm problem with the instcombine worklist.  removing
a value from the worklist required scanning the entire worklist to remove all
entries.  We now use a combination map+vector to prevent duplicates from
happening and prevent the scan.  This speeds up instcombine on a large file
from the llvm-gcc bootstrap from 189.7s to 4.84s in a debug build and from
5.04s to 1.37s in a release build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34848 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agominor cleanup
Chris Lattner [Fri, 2 Mar 2007 19:59:19 +0000 (19:59 +0000)]
minor cleanup

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34846 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix PR1234 by working around a compiler bug.
Chris Lattner [Fri, 2 Mar 2007 18:16:29 +0000 (18:16 +0000)]
Fix PR1234 by working around a compiler bug.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34845 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoMark dead def as unused.
Evan Cheng [Fri, 2 Mar 2007 10:43:16 +0000 (10:43 +0000)]
Mark dead def as unused.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34844 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoDead live-in detection bug.
Evan Cheng [Fri, 2 Mar 2007 10:41:15 +0000 (10:41 +0000)]
Dead live-in detection bug.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34843 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd a new test case.
Evan Cheng [Fri, 2 Mar 2007 10:37:19 +0000 (10:37 +0000)]
Add a new test case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34842 91177308-0d34-0410-b5e6-96231b3b80d8

17 years ago- Keep track all def and uses of stack slot available in register.
Evan Cheng [Fri, 2 Mar 2007 08:52:00 +0000 (08:52 +0000)]
- Keep track all def and uses of stack slot available in register.
- Available value use may be deleted (e.g. noop move).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34841 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agotestcase for PR1233
Chris Lattner [Fri, 2 Mar 2007 07:29:59 +0000 (07:29 +0000)]
testcase for PR1233

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34840 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoInvalidate last use of a reused register if the use is a deleted noop copy.
Evan Cheng [Fri, 2 Mar 2007 05:41:42 +0000 (05:41 +0000)]
Invalidate last use of a reused register if the use is a deleted noop copy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34839 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoargument lowering should copy from the vreg shadows of live-in arguments
Chris Lattner [Fri, 2 Mar 2007 05:12:29 +0000 (05:12 +0000)]
argument lowering should copy from the vreg shadows of live-in arguments
passed in registers, not directly from the pregs themselves.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34838 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoadd a note
Chris Lattner [Fri, 2 Mar 2007 05:04:52 +0000 (05:04 +0000)]
add a note

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34837 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix a typo.
Owen Anderson [Fri, 2 Mar 2007 05:03:07 +0000 (05:03 +0000)]
Fix a typo.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34836 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoUse a better algorithm for rounding sqrt results. Change the FIXME about
Reid Spencer [Fri, 2 Mar 2007 04:21:55 +0000 (04:21 +0000)]
Use a better algorithm for rounding sqrt results. Change the FIXME about
this to a NOTE: because pari/gp results start to get rounded incorrectly
after 192 bits of precision. APInt and pari/gp never differ by more than
1, but APInt is more accurate because it does not lose precision after 192
bits as does pari/gp.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34834 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoImplement unionWith.
Nick Lewycky [Fri, 2 Mar 2007 03:33:05 +0000 (03:33 +0000)]
Implement unionWith.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34833 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoswitch the inliner from being recursive to being iterative.
Chris Lattner [Fri, 2 Mar 2007 03:11:20 +0000 (03:11 +0000)]
switch the inliner from being recursive to being iterative.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34832 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix an unequal bitwidth issue.
Reid Spencer [Fri, 2 Mar 2007 02:59:25 +0000 (02:59 +0000)]
Fix an unequal bitwidth issue.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34831 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agogrammaro
Chris Lattner [Fri, 2 Mar 2007 02:57:34 +0000 (02:57 +0000)]
grammaro

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34830 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoMake it 64-bit safe.
Evan Cheng [Fri, 2 Mar 2007 02:31:37 +0000 (02:31 +0000)]
Make it 64-bit safe.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34829 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd a FIXME
Reid Spencer [Fri, 2 Mar 2007 02:01:34 +0000 (02:01 +0000)]
Add a FIXME

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34828 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix a typo.
Reid Spencer [Fri, 2 Mar 2007 01:31:31 +0000 (01:31 +0000)]
Fix a typo.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34826 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix a problem where shifting by 64-bits leads to incorrect results on PPC
Reid Spencer [Fri, 2 Mar 2007 01:19:42 +0000 (01:19 +0000)]
Fix a problem where shifting by 64-bits leads to incorrect results on PPC
but not on X86 becuase shift by word size is "undefined".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34825 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoeliminate unnecessary reset of SP in epilog on darwin
Dale Johannesen [Fri, 2 Mar 2007 01:17:17 +0000 (01:17 +0000)]
eliminate unnecessary reset of SP in epilog on darwin

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34824 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoReverse a premature commital.
Reid Spencer [Fri, 2 Mar 2007 00:31:39 +0000 (00:31 +0000)]
Reverse a premature commital.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34822 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoPrefer non-virtual calls to ConstantInt::isZero over virtual calls to
Reid Spencer [Fri, 2 Mar 2007 00:28:52 +0000 (00:28 +0000)]
Prefer non-virtual calls to ConstantInt::isZero over virtual calls to
Constant::isNullValue() in situations where it is possible.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34821 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd a non-virtual test for zero, isZero, and rename isUnitValue isOne.
Reid Spencer [Fri, 2 Mar 2007 00:27:06 +0000 (00:27 +0000)]
Add a non-virtual test for zero, isZero, and rename isUnitValue isOne.
These will be used in upcoming patches to avoid virtual function call when
the client knows it is a ConstantInt.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34820 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd an abs() function to get the absolute value.
Reid Spencer [Thu, 1 Mar 2007 23:37:09 +0000 (23:37 +0000)]
Add an abs() function to get the absolute value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34819 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoCombine two lines that can be.
Reid Spencer [Thu, 1 Mar 2007 23:30:25 +0000 (23:30 +0000)]
Combine two lines that can be.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34818 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoRemove virtual keyword from method that doesn't need to be virtual.
Reid Spencer [Thu, 1 Mar 2007 23:20:52 +0000 (23:20 +0000)]
Remove virtual keyword from method that doesn't need to be virtual.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34817 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoMake it possible to create an SCEVUnknown from an APInt as well as an int.
Reid Spencer [Thu, 1 Mar 2007 22:28:51 +0000 (22:28 +0000)]
Make it possible to create an SCEVUnknown from an APInt as well as an int.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34816 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAlthough probably not necessary, guard against a potential assertion by
Reid Spencer [Thu, 1 Mar 2007 21:54:37 +0000 (21:54 +0000)]
Although probably not necessary, guard against a potential assertion by
using isNullValue() instead of getZExtValue() == 0.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34815 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoUse isUnitValue() instead of getZExtValue() == 1 which will prevent an
Reid Spencer [Thu, 1 Mar 2007 21:51:23 +0000 (21:51 +0000)]
Use isUnitValue() instead of getZExtValue() == 1 which will prevent an
assert if the ConstantInt's value is large.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34814 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd an isUnitValue method for comparison against 1. This just follows a
Reid Spencer [Thu, 1 Mar 2007 21:50:41 +0000 (21:50 +0000)]
Add an isUnitValue method for comparison against 1. This just follows a
common pattern with isNullValue, isAllOnesValue, etc. It also helps to
prevent things like getZExtValue() == 1, which could assert for large
bitwidths.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34813 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoUse GCC intrinsics when available, and use smarter fallbacks when not.
Owen Anderson [Thu, 1 Mar 2007 21:16:30 +0000 (21:16 +0000)]
Use GCC intrinsics when available, and use smarter fallbacks when not.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34812 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoClarify the use of getValue/getSExtValue/getZExtValue and add the new
Reid Spencer [Thu, 1 Mar 2007 21:05:33 +0000 (21:05 +0000)]
Clarify the use of getValue/getSExtValue/getZExtValue and add the new
APInt constructor.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34811 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoUse APInt conversion to string so the result is correct regardless of the
Reid Spencer [Thu, 1 Mar 2007 21:00:32 +0000 (21:00 +0000)]
Use APInt conversion to string so the result is correct regardless of the
bit width of the ConstantInt being converted.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34810 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoMake output for ConstantInt construction correct for any bitwidth.
Reid Spencer [Thu, 1 Mar 2007 20:55:43 +0000 (20:55 +0000)]
Make output for ConstantInt construction correct for any bitwidth.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34809 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoUse the APInt versions of the bit-wise conversions of float/double to int
Reid Spencer [Thu, 1 Mar 2007 20:44:23 +0000 (20:44 +0000)]
Use the APInt versions of the bit-wise conversions of float/double to int
and back. While this is not strictly necessary, it does pave the way for
future changes in casting. It should now be possible to improve vector
casting to deal with un-equal fp/int sizes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34808 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd doubleToBits and floatToBits methods.
Reid Spencer [Thu, 1 Mar 2007 20:39:01 +0000 (20:39 +0000)]
Add doubleToBits and floatToBits methods.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34807 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoUse modern variable name. ConstantUnsignedInt is long since dead. No
Reid Spencer [Thu, 1 Mar 2007 20:27:41 +0000 (20:27 +0000)]
Use modern variable name. ConstantUnsignedInt is long since dead. No
functional change with this patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34806 91177308-0d34-0410-b5e6-96231b3b80d8