oota-llvm.git
20 years agoAdd same value coalescing testcase
Alkis Evlogimenos [Mon, 12 Apr 2004 15:40:25 +0000 (15:40 +0000)]
Add same value coalescing testcase

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

20 years agoAdded initial design for the llvm.readio and llvm.writeio intrinsics.
John Criswell [Mon, 12 Apr 2004 15:02:16 +0000 (15:02 +0000)]
Added initial design for the llvm.readio and llvm.writeio intrinsics.

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

20 years agoAdd a couple more IPO's
Chris Lattner [Mon, 12 Apr 2004 05:38:15 +0000 (05:38 +0000)]
Add a couple more IPO's

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

20 years agofinegrainify namespacification
Chris Lattner [Mon, 12 Apr 2004 05:38:01 +0000 (05:38 +0000)]
finegrainify namespacification

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

20 years agoActually update the call graph as the inliner changes it. This allows us to
Chris Lattner [Mon, 12 Apr 2004 05:37:29 +0000 (05:37 +0000)]
Actually update the call graph as the inliner changes it.  This allows us to
execute other CallGraphSCCPasses after the inliner without crashing.

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

20 years agoChange the call graph class to have TWO external nodes, making call graph
Chris Lattner [Mon, 12 Apr 2004 05:36:32 +0000 (05:36 +0000)]
Change the call graph class to have TWO external nodes, making call graph
SCC passes much more useful.  In particular, this should fix the incredibly
stupid missed inlining opportunities that the inliner suffered from.

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

20 years agoHrm, operator new and new[] do not belong here. We should not CSE them! :)
Chris Lattner [Mon, 12 Apr 2004 05:16:42 +0000 (05:16 +0000)]
Hrm, operator new and new[] do not belong here.  We should not CSE them!  :)

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

20 years agoAdd support for removing invoke instructions
Chris Lattner [Mon, 12 Apr 2004 05:15:13 +0000 (05:15 +0000)]
Add support for removing invoke instructions

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

20 years agoStop printing Function*
Chris Lattner [Mon, 12 Apr 2004 04:06:56 +0000 (04:06 +0000)]
Stop printing Function*

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

20 years agoSimplify code a bit, and be sure to mark the external node as potentially throwing
Chris Lattner [Mon, 12 Apr 2004 04:06:38 +0000 (04:06 +0000)]
Simplify code a bit, and be sure to mark the external node as potentially throwing

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

20 years agoFix issues that the local allocator has dealing with instructions that implicitly...
Chris Lattner [Mon, 12 Apr 2004 03:02:48 +0000 (03:02 +0000)]
Fix issues that the local allocator has dealing with instructions that implicitly use ST(0)

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

20 years agoNo really, fix printing for LLC. I gotta get a way for CVS to whine at me if
Chris Lattner [Mon, 12 Apr 2004 01:52:04 +0000 (01:52 +0000)]
No really, fix printing for LLC.  I gotta get a way for CVS to whine at me if
I have unsaved emacs buffers, geeze...

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

20 years agoCorrect printing for LLC and the encoding for the JIT
Chris Lattner [Mon, 12 Apr 2004 01:50:04 +0000 (01:50 +0000)]
Correct printing for LLC and the encoding for the JIT

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

20 years agoUse the fucomi[p] instructions to perform floating point comparisons instead
Chris Lattner [Mon, 12 Apr 2004 01:43:36 +0000 (01:43 +0000)]
Use the fucomi[p] instructions to perform floating point comparisons instead
of the fucom[p][p] instructions.  This allows us to code generate this function

bool %test(double %X, double %Y) {
        %C = setlt double %Y, %X
        ret bool %C
}

... into:

test:
        fld QWORD PTR [%ESP + 4]
        fld QWORD PTR [%ESP + 12]
        fucomip %ST(1)
        fstp %ST(0)
        setb %AL
        movsx %EAX, %AL
        ret

where before we generated:

test:
        fld QWORD PTR [%ESP + 4]
        fld QWORD PTR [%ESP + 12]
        fucompp
**      fnstsw
**      sahf
        setb %AL
        movsx %EAX, %AL
        ret

The two marked instructions (which are the ones eliminated) are very bad,
because they serialize execution of the processor.  These instructions are
available on the PPRO and later, but since we already use cmov's we aren't
losing any portability.

I retained the old code for the day when we decide we want to support back
to the 386.

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

20 years agoAdd support for the FUCOMIr instruction
Chris Lattner [Mon, 12 Apr 2004 01:39:15 +0000 (01:39 +0000)]
Add support for the FUCOMIr instruction

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

20 years agoAdd two new instructions
Chris Lattner [Mon, 12 Apr 2004 01:38:55 +0000 (01:38 +0000)]
Add two new instructions

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

20 years agoFix a bug in my load/cast folding patch.
Chris Lattner [Mon, 12 Apr 2004 00:23:04 +0000 (00:23 +0000)]
Fix a bug in my load/cast folding patch.

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

20 years agoAdjust some comments, fix a bug in my previous patch
Chris Lattner [Mon, 12 Apr 2004 00:12:04 +0000 (00:12 +0000)]
Adjust some comments, fix a bug in my previous patch

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

20 years agoDisambiguate symbols after loop extraction so that we can diagnose a code
Chris Lattner [Sun, 11 Apr 2004 23:52:35 +0000 (23:52 +0000)]
Disambiguate symbols after loop extraction so that we can diagnose a code
generator bug if multiple loops are extracted from a function.

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

20 years agoOn X86, casting an integer to floating point requires going through memory.
Chris Lattner [Sun, 11 Apr 2004 23:21:26 +0000 (23:21 +0000)]
On X86, casting an integer to floating point requires going through memory.
If the source of the cast is a load, we can just use the source memory location,
without having to create a temporary stack slot entry.

Before we code generated this:

double %int(int* %P) {
        %V = load int* %P
        %V2 = cast int %V to double
        ret double %V2
}

into:

int:
        sub %ESP, 4
        mov %EAX, DWORD PTR [%ESP + 8]
        mov %EAX, DWORD PTR [%EAX]
        mov DWORD PTR [%ESP], %EAX
        fild DWORD PTR [%ESP]
        add %ESP, 4
        ret

Now we produce this:

int:
        mov %EAX, DWORD PTR [%ESP + 4]
        fild DWORD PTR [%EAX]
        ret

... which is nicer.

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

20 years agoNew testcase
Chris Lattner [Sun, 11 Apr 2004 23:18:30 +0000 (23:18 +0000)]
New testcase

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

20 years agoImplement folding of loads into floating point operations. This implements:
Chris Lattner [Sun, 11 Apr 2004 22:05:45 +0000 (22:05 +0000)]
Implement folding of loads into floating point operations.  This implements:
test/Regression/CodeGen/X86/fp_load_fold.llx

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

20 years agoNew testcase
Chris Lattner [Sun, 11 Apr 2004 22:05:16 +0000 (22:05 +0000)]
New testcase

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

20 years agoUnify all of the code for floating point +,-,*,/ into one function
Chris Lattner [Sun, 11 Apr 2004 21:23:56 +0000 (21:23 +0000)]
Unify all of the code for floating point +,-,*,/ into one function

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

20 years agoThis implements folding of constant operands into floating point operations
Chris Lattner [Sun, 11 Apr 2004 21:09:14 +0000 (21:09 +0000)]
This implements folding of constant operands into floating point operations
for mul and div.

Instead of generating this:

test_divr:
        fld QWORD PTR [%ESP + 4]
        fld QWORD PTR [.CPItest_divr_0]
        fdivrp %ST(1)
        ret

We now generate this:

test_divr:
        fld QWORD PTR [%ESP + 4]
        fdivr QWORD PTR [.CPItest_divr_0]
        ret

This code desperately needs refactoring, which will come in the next
patch.

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

20 years agoRestructure the mul/div/rem handling code to follow the pattern the other
Chris Lattner [Sun, 11 Apr 2004 20:56:28 +0000 (20:56 +0000)]
Restructure the mul/div/rem handling code to follow the pattern the other
instructions use.  This doesn't change any functionality except that long
constant expressions of these operations will now magically start working.

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

20 years agoCodegen FP adds and subtracts with a constant more efficiently, generating:
Chris Lattner [Sun, 11 Apr 2004 20:26:20 +0000 (20:26 +0000)]
Codegen FP adds and subtracts with a constant more efficiently, generating:

        fld QWORD PTR [%ESP + 4]
        fadd QWORD PTR [.CPItest_add_0]

instead of:

        fld QWORD PTR [%ESP + 4]
        fld QWORD PTR [.CPItest_add_0]
        faddp %ST(1)

I also intend to do this for mul & div, but it appears that I have to
refactor a bit of code before I can do so.

This is tested by: test/Regression/CodeGen/X86/fp_constant_op.llx

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

20 years agoAdd some new instructions
Chris Lattner [Sun, 11 Apr 2004 20:24:15 +0000 (20:24 +0000)]
Add some new instructions

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

20 years agoNew testcase
Chris Lattner [Sun, 11 Apr 2004 20:24:01 +0000 (20:24 +0000)]
New testcase

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

20 years agoRelax assertion to make this function work with a broader class of instructions
Chris Lattner [Sun, 11 Apr 2004 20:21:06 +0000 (20:21 +0000)]
Relax assertion to make this function work with a broader class of instructions

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

20 years agoTwo changes:
Chris Lattner [Sun, 11 Apr 2004 19:21:59 +0000 (19:21 +0000)]
Two changes:
  1. If an incoming argument is dead, don't load it from the stack
  2. Do not code gen noop copies at all (ie, cast int -> uint), not even to
     a move.  This should reduce register pressure for allocators that are
     unable to coallesce away these copies in some cases.

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

20 years agoAdd another variant of the testcase
Chris Lattner [Sun, 11 Apr 2004 19:01:35 +0000 (19:01 +0000)]
Add another variant of the testcase

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

20 years agooperator new & operator new[] do not kill any legal memory locations.
Chris Lattner [Sun, 11 Apr 2004 18:16:34 +0000 (18:16 +0000)]
operator new & operator new[] do not kill any legal memory locations.

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

20 years agonew testcase
Chris Lattner [Sun, 11 Apr 2004 16:47:15 +0000 (16:47 +0000)]
new testcase

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

20 years agoAllow clients to be more efficient.
Chris Lattner [Sun, 11 Apr 2004 16:43:07 +0000 (16:43 +0000)]
Allow clients to be more efficient.

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

20 years agoMake comments above APIs reflect what they should do.
Chris Lattner [Sun, 11 Apr 2004 16:42:50 +0000 (16:42 +0000)]
Make comments above APIs reflect what they should do.

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

20 years agoNew method to allow more efficient clients
Chris Lattner [Sun, 11 Apr 2004 16:35:30 +0000 (16:35 +0000)]
New method to allow more efficient clients

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

20 years agoFix a bug in my select transformation
Chris Lattner [Sun, 11 Apr 2004 01:39:19 +0000 (01:39 +0000)]
Fix a bug in my select transformation

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

20 years agoAdd a missing break, which caused a crash in an obscure situation
Chris Lattner [Sun, 11 Apr 2004 01:29:30 +0000 (01:29 +0000)]
Add a missing break, which caused a crash in an obscure situation

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

20 years agoUpdate the value numbering interface.
Chris Lattner [Sat, 10 Apr 2004 22:33:34 +0000 (22:33 +0000)]
Update the value numbering interface.

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

20 years agoNote to self: SAVE FILES!
Chris Lattner [Sat, 10 Apr 2004 22:32:47 +0000 (22:32 +0000)]
Note to self: SAVE FILES!

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

20 years agoAdd an interface to update value numbering
Chris Lattner [Sat, 10 Apr 2004 22:32:09 +0000 (22:32 +0000)]
Add an interface to update value numbering

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

20 years agoImplement InstCombine/select.ll:test13*
Chris Lattner [Sat, 10 Apr 2004 22:21:27 +0000 (22:21 +0000)]
Implement InstCombine/select.ll:test13*

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

20 years agoNew testcases
Chris Lattner [Sat, 10 Apr 2004 22:21:14 +0000 (22:21 +0000)]
New testcases

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

20 years agoImplement InstCombine/add.ll:test20
Chris Lattner [Sat, 10 Apr 2004 22:01:55 +0000 (22:01 +0000)]
Implement InstCombine/add.ll:test20
Canonicalize add of sign bit constant into a xor

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

20 years agoNew testcase
Chris Lattner [Sat, 10 Apr 2004 22:01:27 +0000 (22:01 +0000)]
New testcase

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

20 years agoRewrite the GCSE pass to be *substantially* simpler, a bit more efficient,
Chris Lattner [Sat, 10 Apr 2004 21:11:11 +0000 (21:11 +0000)]
Rewrite the GCSE pass to be *substantially* simpler, a bit more efficient,
and a bit more powerful

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

20 years agoFix spurious warning in release mode
Chris Lattner [Sat, 10 Apr 2004 19:15:56 +0000 (19:15 +0000)]
Fix spurious warning in release mode

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

20 years agoSilence a spurious warning
Chris Lattner [Sat, 10 Apr 2004 18:32:01 +0000 (18:32 +0000)]
Silence a spurious warning

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

20 years agoSimplify code a bit, and fix a bug that was breaking perlbmk
Chris Lattner [Sat, 10 Apr 2004 18:06:21 +0000 (18:06 +0000)]
Simplify code a bit, and fix a bug that was breaking perlbmk

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

20 years agoFix a bug in my checkin last night that was breaking programs using invoke.
Chris Lattner [Sat, 10 Apr 2004 16:53:29 +0000 (16:53 +0000)]
Fix a bug in my checkin last night that was breaking programs using invoke.

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

20 years agoFix previous patch
Chris Lattner [Sat, 10 Apr 2004 07:27:48 +0000 (07:27 +0000)]
Fix previous patch

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

20 years agoCorrectly update counters
Chris Lattner [Sat, 10 Apr 2004 07:02:02 +0000 (07:02 +0000)]
Correctly update counters

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

20 years agoAdd note
Chris Lattner [Sat, 10 Apr 2004 06:56:53 +0000 (06:56 +0000)]
Add note

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

20 years agoAdd a couple of more functions that cannot access memory (the intrinsics) and
Chris Lattner [Sat, 10 Apr 2004 06:55:27 +0000 (06:55 +0000)]
Add a couple of more functions that cannot access memory (the intrinsics) and
don't write to memory

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

20 years agoSimplify code a bit, and use alias analysis to allow us to delete unused
Chris Lattner [Sat, 10 Apr 2004 06:53:09 +0000 (06:53 +0000)]
Simplify code a bit, and use alias analysis to allow us to delete unused
call and invoke instructions that are known to not write to memory.

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

20 years agoNew testcases
Chris Lattner [Sat, 10 Apr 2004 06:52:20 +0000 (06:52 +0000)]
New testcases

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

20 years agoClarify interface
Chris Lattner [Sat, 10 Apr 2004 06:11:29 +0000 (06:11 +0000)]
Clarify interface

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

20 years agoCreate the output directory if it's not already there
Chris Lattner [Sat, 10 Apr 2004 06:03:22 +0000 (06:03 +0000)]
Create the output directory if it's not already there

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

20 years agoSimplify cfg now eliminates all of the branches in this testcase
Chris Lattner [Fri, 9 Apr 2004 23:50:29 +0000 (23:50 +0000)]
Simplify cfg now eliminates all of the branches in this testcase

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

20 years agoAnother testcase
Chris Lattner [Fri, 9 Apr 2004 23:47:52 +0000 (23:47 +0000)]
Another testcase

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

20 years agoTestcase to make sure we can apply the shift to the operands of the select,
Chris Lattner [Fri, 9 Apr 2004 23:47:24 +0000 (23:47 +0000)]
Testcase to make sure we can apply the shift to the operands of the select,
eliminating the shifts

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

20 years agoImplement select.ll:test12*
Chris Lattner [Fri, 9 Apr 2004 23:46:01 +0000 (23:46 +0000)]
Implement select.ll:test12*

This transforms code like this:

   %C = or %A, %B
   %D = select %cond, %C, %A
into:
   %C = select %cond, %B, 0
   %D = or %A, %C

Since B is often a constant, the select can often be eliminated.  In any case,
this reduces the usage count of A, allowing subsequent optimizations to happen.

This xform applies when the operator is any of:
  add, sub, mul, or, xor, and, shl, shr

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

20 years agoAdd testcases for harder combining cases.
Chris Lattner [Fri, 9 Apr 2004 23:43:48 +0000 (23:43 +0000)]
Add testcases for harder combining cases.

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

20 years agoFold code like:
Chris Lattner [Fri, 9 Apr 2004 22:50:22 +0000 (22:50 +0000)]
Fold code like:
  if (C)
    V1 |= V2;

into:
  Vx = V1 | V2;
  V1 = select C, V1, Vx

when the expression can be evaluated unconditionally and is *cheap* to
execute.  This limited form of if conversion is quite handy in lots of cases.
For example, it turns this testcase into straight-line code:

int in0 ; int in1 ; int in2 ; int in3 ;
int in4 ; int in5 ; int in6 ; int in7 ;
int in8 ; int in9 ; int in10; int in11;
int in12; int in13; int in14; int in15;
long output;

void mux(void) {
  output =
      (in0   ?  0x00000001 : 0) | (in1   ?  0x00000002 : 0) |
      (in2   ?  0x00000004 : 0) | (in3   ?  0x00000008 : 0) |
      (in4   ?  0x00000010 : 0) | (in5   ?  0x00000020 : 0) |
      (in6   ?  0x00000040 : 0) | (in7   ?  0x00000080 : 0) |
      (in8   ?  0x00000100 : 0) | (in9   ?  0x00000200 : 0) |
      (in10  ?  0x00000400 : 0) | (in11  ?  0x00000800 : 0) |
      (in12  ?  0x00001000 : 0) | (in13  ?  0x00002000 : 0) |
      (in14  ?  0x00004000 : 0) | (in15  ?  0x00008000 : 0) ;
}

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

20 years agoFix an obvious bug in the refactoring I did a few days ago
Chris Lattner [Fri, 9 Apr 2004 22:28:33 +0000 (22:28 +0000)]
Fix an obvious bug in the refactoring I did a few days ago

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

20 years agoExpand on adding an intrinsic. Move section to before adding an instruction
Chris Lattner [Fri, 9 Apr 2004 19:24:20 +0000 (19:24 +0000)]
Expand on adding an intrinsic.  Move section to before adding an instruction

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

20 years agoReversed the order of the llvm.writeport() operands so that the value
John Criswell [Fri, 9 Apr 2004 19:09:14 +0000 (19:09 +0000)]
Reversed the order of the llvm.writeport() operands so that the value
is listed first and the address is listed second.

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

20 years agoFold binary operators with a constant operand into select instructions
Chris Lattner [Fri, 9 Apr 2004 19:05:30 +0000 (19:05 +0000)]
Fold binary operators with a constant operand into select instructions
that have a constant operand.  This implements
add.ll:test19, shift.ll:test15*, and others that are not tested

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

20 years agoImplement select.ll:test11
Chris Lattner [Fri, 9 Apr 2004 18:19:44 +0000 (18:19 +0000)]
Implement select.ll:test11

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

20 years agonew testcase
Chris Lattner [Fri, 9 Apr 2004 18:19:29 +0000 (18:19 +0000)]
new testcase

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

20 years agoAdd definition list to each live interval.
Alkis Evlogimenos [Fri, 9 Apr 2004 18:07:57 +0000 (18:07 +0000)]
Add definition list to each live interval.

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

20 years agoFixed some spelling.
John Criswell [Fri, 9 Apr 2004 16:48:45 +0000 (16:48 +0000)]
Fixed some spelling.

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

20 years agoModified the prototypes of the llvm.readport and llvm.writeport intrinsics
John Criswell [Fri, 9 Apr 2004 16:43:20 +0000 (16:43 +0000)]
Modified the prototypes of the llvm.readport and llvm.writeport intrinsics
so that they do not specify specific integer sizes (as those are
constrained by the code generator, not the intrinsic itself).

Also put these intrinsics into their own "Operating System" section.

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

20 years agoAdded the llvm.readport and llvm.writeport intrinsics.
John Criswell [Fri, 9 Apr 2004 15:23:37 +0000 (15:23 +0000)]
Added the llvm.readport and llvm.writeport intrinsics.

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

20 years agoChanged assertions to error messages.
John Criswell [Fri, 9 Apr 2004 15:10:15 +0000 (15:10 +0000)]
Changed assertions to error messages.

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

20 years agoChanges recommended by Chris:
John Criswell [Thu, 8 Apr 2004 22:39:13 +0000 (22:39 +0000)]
Changes recommended by Chris:
InstSelectSimple.cpp:
  Change the checks for proper I/O port address size into an exit() instead
  of an assertion.  Assertions aren't used in Release builds, and handling
  this error should be graceful (not that this counts as graceful, but it's
  more graceful).

  Modified the generation of the IN/OUT instructions to have 0 arguments.
X86InstrInfo.td:
  Added the OpSize attribute to the 16 bit IN and OUT instructions.

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

20 years agoImplement InstCombine/cast-propagate.ll
Chris Lattner [Thu, 8 Apr 2004 20:39:49 +0000 (20:39 +0000)]
Implement InstCombine/cast-propagate.ll

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

20 years agoNew testcase
Chris Lattner [Thu, 8 Apr 2004 20:39:40 +0000 (20:39 +0000)]
New testcase

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

20 years agoAdded the llvm.readport and llvm.writeport intrinsics for x86. These do
John Criswell [Thu, 8 Apr 2004 20:31:47 +0000 (20:31 +0000)]
Added the llvm.readport and llvm.writeport intrinsics for x86.  These do
I/O port instructions on x86.  The specific code sequence is tailored to
the parameters and return value of the intrinsic call.
Added the ability for implicit defintions to be printed in the Instruction
Printer.
Added the ability for RawFrm instruction to print implict uses and
defintions with correct comma output.  This required adjustment to some
methods so that a leading comma would or would not be printed.

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

20 years agoAdded the llvm.readport and llvm.writeport intrinsics.
John Criswell [Thu, 8 Apr 2004 20:27:38 +0000 (20:27 +0000)]
Added the llvm.readport and llvm.writeport intrinsics.
The Verifier ensures that their parameters are of integral types and have
the correct sign, but it does not enforce any size restrictions because
such restrictions are platform dependent.

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

20 years agoAdded the llvm.readport and llvm.writeport intrinsics.
John Criswell [Thu, 8 Apr 2004 20:26:21 +0000 (20:26 +0000)]
Added the llvm.readport and llvm.writeport intrinsics.

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

20 years agoImplement ScalarRepl/select_promote.ll
Chris Lattner [Thu, 8 Apr 2004 19:59:34 +0000 (19:59 +0000)]
Implement ScalarRepl/select_promote.ll

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

20 years agoNew testcase, corresponding to phi_promote.ll
Chris Lattner [Thu, 8 Apr 2004 19:59:22 +0000 (19:59 +0000)]
New testcase, corresponding to phi_promote.ll

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

20 years agoThis file does not appear to be included anywhere.
Brian Gaeke [Thu, 8 Apr 2004 19:36:26 +0000 (19:36 +0000)]
This file does not appear to be included anywhere.

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

20 years agoDisable strict alias analysis in the backend c compiler, as the code we
Chris Lattner [Thu, 8 Apr 2004 15:18:59 +0000 (15:18 +0000)]
Disable strict alias analysis in the backend c compiler, as the code we
generate is not TBAA safe.

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

20 years agoRevert previous patch, I'm a moron :)
Chris Lattner [Thu, 8 Apr 2004 15:18:03 +0000 (15:18 +0000)]
Revert previous patch, I'm a moron :)

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

20 years agoRight, we break strict aliasing requirements. Make sure to disable strict
Chris Lattner [Thu, 8 Apr 2004 15:14:43 +0000 (15:14 +0000)]
Right, we break strict aliasing requirements.  Make sure to disable strict
aliasing in the C compiler.

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

20 years agoRemove the "really gross hacks" that are there to deal with recursive functions.
Chris Lattner [Thu, 8 Apr 2004 06:34:31 +0000 (06:34 +0000)]
Remove the "really gross hacks" that are there to deal with recursive functions.
Now we collect all of the call sites we are interested in inlining, then inline
them.  This entirely avoids issues with trying to inline a call site we got by
inlining another call site.  This also eliminates iterator invalidation issues.

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

20 years agoImplement InstCombine/select.ll:test[7-10]
Chris Lattner [Thu, 8 Apr 2004 04:43:23 +0000 (04:43 +0000)]
Implement InstCombine/select.ll:test[7-10]

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

20 years agoAdd some more cases we should combine
Chris Lattner [Thu, 8 Apr 2004 04:43:04 +0000 (04:43 +0000)]
Add some more cases we should combine

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

20 years agoThis file is no longer used.
Brian Gaeke [Wed, 7 Apr 2004 21:01:22 +0000 (21:01 +0000)]
This file is no longer used.

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

20 years agoDon't include InstrSelectionSupport.h.
Brian Gaeke [Wed, 7 Apr 2004 20:55:32 +0000 (20:55 +0000)]
Don't include InstrSelectionSupport.h.

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

20 years agoMove ChooseRegOrImmed() prototype here, from InstrSelectionSupport.h.
Brian Gaeke [Wed, 7 Apr 2004 20:38:57 +0000 (20:38 +0000)]
Move ChooseRegOrImmed() prototype here, from InstrSelectionSupport.h.

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

20 years agoDon't include InstrSelectionSupport.h.
Brian Gaeke [Wed, 7 Apr 2004 20:38:56 +0000 (20:38 +0000)]
Don't include InstrSelectionSupport.h.

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

20 years agoImplement test/Regression/Transforms/InstCombine/getelementptr_index.ll
Chris Lattner [Wed, 7 Apr 2004 18:38:20 +0000 (18:38 +0000)]
Implement test/Regression/Transforms/InstCombine/getelementptr_index.ll

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

20 years agoNew testcase
Chris Lattner [Wed, 7 Apr 2004 18:38:01 +0000 (18:38 +0000)]
New testcase

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

20 years agoFix insertion of SelectInsts.
Brian Gaeke [Wed, 7 Apr 2004 18:31:47 +0000 (18:31 +0000)]
Fix insertion of SelectInsts.

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

20 years agoDon't print [%reg + 0], just print [%reg]
Brian Gaeke [Wed, 7 Apr 2004 17:33:56 +0000 (17:33 +0000)]
Don't print [%reg + 0], just print [%reg]

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

20 years agoFirst version of code to handle loads. Stub function for handling stores.
Brian Gaeke [Wed, 7 Apr 2004 17:29:37 +0000 (17:29 +0000)]
First version of code to handle loads. Stub function for handling stores.

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