Commit Graph

6469 Commits

Author SHA1 Message Date
Reid Spencer c0999e134e Implement tracking of bytecode instruction size and the number of long
instructions generated.

llvm-svn: 14154
2004-06-11 15:10:38 +00:00
Chris Lattner 5888b5d4b1 Fix fallout from getOffsetOfLocalArea() being negated. Debugging dumps were being
printed incorrectly, and we were reserving 8 extra bytes of stack space for functions
on X86.

llvm-svn: 14152
2004-06-11 06:37:11 +00:00
Chris Lattner 66f313725c llvm.isnan doesn't access memory
llvm-svn: 14151
2004-06-11 06:17:13 +00:00
Chris Lattner ec941f7abb Constant fold the isnan intrinsic
llvm-svn: 14150
2004-06-11 06:16:23 +00:00
Chris Lattner 1c2be0e5a9 By far, one of the most common uses of isnan is to make 'isunordered'
comparisons.  In an 'isunordered' predicate, which looks like this at
the LLVM level:

        %a = call bool %llvm.isnan(double %X)
        %b = call bool %llvm.isnan(double %Y)
        %COM = or bool %a, %b

We used to generate this code:

        fxch %ST(1)
        fucomip %ST(0), %ST(0)
        setp %AL
        fucomip %ST(0), %ST(0)
        setp %AH
        or %AL, %AH

With this patch, we generate this code:

        fucomip %ST(0), %ST(1)
        fstp %ST(0)
        setp %AL

Which should make alkis happy.  Tested as X86/compare_folding.llx:test1

llvm-svn: 14148
2004-06-11 05:33:49 +00:00
Chris Lattner 71186e2fb6 Fix bug in previous checkin
llvm-svn: 14146
2004-06-11 05:22:44 +00:00
Chris Lattner 5ed9113e14 No really, these are dead now
llvm-svn: 14145
2004-06-11 04:50:14 +00:00
Chris Lattner b35f47627d Now that compare instructions aren't lumped in with the other twoargfp instructions,
we can get rid of the FpUCOM/FpUCOMi pseudo instructions, which makes stuff simpler
and faster.

llvm-svn: 14144
2004-06-11 04:49:02 +00:00
Chris Lattner 0876edf122 Introduce a new FP instruction type to separate the compare cases from the
twoarg cases.

llvm-svn: 14143
2004-06-11 04:41:24 +00:00
Chris Lattner 26a964f88e Add direct support for the isnan intrinsic, implementing test/Regression/CodeGen/X86/isnan.llx
testcase

llvm-svn: 14141
2004-06-11 04:31:10 +00:00
Chris Lattner a0cfedef3a Add support for the setp instructions
llvm-svn: 14140
2004-06-11 04:30:06 +00:00
Chris Lattner 94ff2c3210 Split compare instruction handling OUT of handleTwoArgFP into handleCompareFP.
This makes the code much simpler, and the two cases really do belong apart.
Once we do it, it's pretty obvious how flawed the logic was for A != A case,
so I fixed it (fixing PR369).

This also uses freeStackSlotAfter instead of inserting an fxchg then
popStackAfter'ing in the case where there is a dead result (unlikely, but
possible), producing better code.

llvm-svn: 14139
2004-06-11 04:25:06 +00:00
Reid Spencer c22be9f9d5 Revert an unneeded interface change to Instruction.h
llvm-svn: 14137
2004-06-11 03:06:43 +00:00
Chris Lattner 0c6db524d6 Fix lowering to work correctly
llvm-svn: 14134
2004-06-11 02:54:02 +00:00
Chris Lattner 8f69c9e439 I misled Alkis: LLVM should have isnan, not isunordered.
isunordered(X, Y) === isnan(X) | isnan(Y)

Remove isunordered, add isnan.

llvm-svn: 14132
2004-06-11 02:29:43 +00:00
Brian Gaeke 2655aab200 Turn loads of ConstantPointerNulls into loads of zero... don't spill
them into the constant pool.

llvm-svn: 14128
2004-06-11 02:03:48 +00:00
Alkis Evlogimenos d0b5d0c7cc Add the isunordered intrinsic.
llvm-svn: 14127
2004-06-11 01:08:18 +00:00
Reid Spencer 8395e67fb1 Remove tabs.
llvm-svn: 14123
2004-06-10 22:03:00 +00:00
Reid Spencer 7670bbdfb9 Implement detailed function level data collection and reporting.
llvm-svn: 14122
2004-06-10 22:00:54 +00:00
Reid Spencer 90f0032664 Adjust prototypes to new Handler interface.
llvm-svn: 14121
2004-06-10 22:00:29 +00:00
Reid Spencer 2491b0959e Make the parser deal with functions instead of just function types.
llvm-svn: 14120
2004-06-10 21:59:20 +00:00
Reid Spencer ff35cf92c5 Doxygenize a comment.
llvm-svn: 14115
2004-06-10 08:27:00 +00:00
Reid Spencer 8e5de9cd75 Implemented the bulk of the functionality. Cleaned up the code.
llvm-svn: 14113
2004-06-10 08:09:13 +00:00
Chris Lattner 175532bb1e Fix the prolog epilog code inserter to match the documentation and support
targets whose stack grows up.

Patch contributed by Vladimir Prus

llvm-svn: 14111
2004-06-10 06:23:35 +00:00
Chris Lattner 6d6b3b3ce9 Fix the fixed stack offset, patch contributed by Vladimir Prus
llvm-svn: 14110
2004-06-10 06:19:25 +00:00
Chris Lattner ee59d4bf04 Fix a bug in my checkin from last night that caused miscompilations of
186.crafty, fhourstones and 132.ijpeg.

Bugpoint makes really nasty miscompilations embarassingly easy to find.  It
narrowed it down to the instcombiner and this testcase (from fhourstones):

bool %l7153_l4706_htstat_loopentry_2E_4_no_exit_2E_4(int* %i, [32 x int]* %works, int* %tmp.98.out) {
newFuncRoot:
        %tmp.96 = load int* %i          ; <int> [#uses=1]
        %tmp.97 = getelementptr [32 x int]* %works, long 0, int %tmp.96         ; <int*> [#uses=1]
        %tmp.98 = load int* %tmp.97             ; <int> [#uses=2]
        %tmp.99 = load int* %i          ; <int> [#uses=1]
        %tmp.100 = and int %tmp.99, 7           ; <int> [#uses=1]
        %tmp.101 = seteq int %tmp.100, 7                ; <bool> [#uses=2]
        %tmp.102 = cast bool %tmp.101 to int            ; <int> [#uses=0]
        br bool %tmp.101, label %codeRepl4.exitStub, label %codeRepl3.exitStub

codeRepl4.exitStub:             ; preds = %newFuncRoot
        store int %tmp.98, int* %tmp.98.out
        ret bool true

codeRepl3.exitStub:             ; preds = %newFuncRoot
        store int %tmp.98, int* %tmp.98.out
        ret bool false
}

... which only has one combination performed on it:

$ llvm-as < t.ll | opt -instcombine -debug | llvm-dis
IC: Old =       %tmp.101 = seteq int %tmp.100, 7                ; <bool> [#uses=1]
    New =       setne int %tmp.100, 0           ; <bool>:<badref> [#uses=0]
IC: MOD =       br bool %tmp.101, label %codeRepl3.exitStub, label %codeRepl4.exitStub
IC: MOD =       %tmp.97 = getelementptr [32 x int]* %works, uint 0, int %tmp.96         ; <int*> [#uses=1]

It doesn't get much better than this.  :)

llvm-svn: 14109
2004-06-10 02:33:20 +00:00
Chris Lattner c8e7e298c1 More minor cleanups
llvm-svn: 14108
2004-06-10 02:12:35 +00:00
Chris Lattner df20a4d589 Eliminate many occurrances of Instruction::
llvm-svn: 14107
2004-06-10 02:07:29 +00:00
Chris Lattner 88ba175c1e Share some code
llvm-svn: 14106
2004-06-10 01:57:38 +00:00
Chris Lattner 68a038e6a1 Tolerate more errors
llvm-svn: 14104
2004-06-09 22:22:10 +00:00
Brian Gaeke 5b03a0628f Encode %fsr correctly; don't fail an assertion.
llvm-svn: 14103
2004-06-09 21:54:59 +00:00
Brian Gaeke 87d8878f6d Fix encoding of ST*FSR instructions.
llvm-svn: 14102
2004-06-09 21:54:58 +00:00
Brian Gaeke 87c75632ee Fix assertion failure message to have the right method name.
llvm-svn: 14101
2004-06-09 20:44:42 +00:00
Chris Lattner 757ee0b533 Make the asmwriter much more tolerant of errors (which are common when working
on new front-ends and stuff).  Also get rid of some tabs that snuck in.

llvm-svn: 14100
2004-06-09 19:41:19 +00:00
Reid Spencer 8beac69819 Made it possible for the printInfoComment method to invoke getSlot in
such a way that if the Value being printed is standalone that we don't
assert and abort but just print ":??" for the slot number instead.

llvm-svn: 14097
2004-06-09 15:26:53 +00:00
John Criswell 9095c64147 Fix for PR#366. We use getClassB() so that we can handle cast instructions
that cast to bool.

llvm-svn: 14096
2004-06-09 15:18:51 +00:00
Chris Lattner 35167c3087 Implement InstCombine/select.ll:test15*
llvm-svn: 14095
2004-06-09 07:59:58 +00:00
Reid Spencer 2acee7e4d6 Cleanup alignment of output.
llvm-svn: 14093
2004-06-09 06:22:00 +00:00
Reid Spencer cc4e35a404 Implement analysis output. Don't dump function details unless requested.
llvm-svn: 14091
2004-06-09 06:17:58 +00:00
Reid Spencer 839fa681f6 Implement some rudimentary analysis.
llvm-svn: 14090
2004-06-09 06:16:43 +00:00
Reid Spencer f1598b0efa Clean up indentation of file body output.
Don't dump functions unless "detailedResults" is requested.

llvm-svn: 14089
2004-06-09 06:16:19 +00:00
Reid Spencer fc6f5508aa Move parsing details to Parser.cpp.
llvm-svn: 14088
2004-06-09 06:15:21 +00:00
Reid Spencer 670c26d3af Bring some things out of header files that belong only in this file.
llvm-svn: 14087
2004-06-09 06:14:52 +00:00
Chris Lattner 396dbfe327 Be more careful about the order we put stuff onto the worklist. This allow us to
collapse this:
bool %le(int %A, int %B) {
        %c1 = setgt int %A, %B
        %tmp = select bool %c1, int 1, int 0
        %c2 = setlt int %A, %B
        %result = select bool %c2, int -1, int %tmp
        %c3 = setle int %result, 0
        ret bool %c3
}

into:

bool %le(int %A, int %B) {
        %c3 = setle int %A, %B          ; <bool> [#uses=1]
        ret bool %c3
}

which is handy, because the Java FE makes these sequences all over the place.

This is tested as: test/Regression/Transforms/InstCombine/JavaCompare.ll

llvm-svn: 14086
2004-06-09 05:08:07 +00:00
Reid Spencer e73febc64a Cleaned up a dead header file to prevent duplicate definition warnings
in doxygen.

llvm-svn: 14084
2004-06-09 04:38:34 +00:00
Chris Lattner 2dd017402b Implement select.ll:test14*
llvm-svn: 14083
2004-06-09 04:24:29 +00:00
Chris Lattner 74248512eb Workaround or a VS miscompilation bug
llvm-svn: 14078
2004-06-08 23:21:39 +00:00
Chris Lattner 4c7a24af44 Don't grab the condition of unconditional branches!
This fixes PR363

llvm-svn: 14076
2004-06-08 21:50:30 +00:00
Brian Gaeke c365e7cc99 Fix a minor bug in the map - since this pass adds a global symbol, it must be
accounted for in the map (at least, in its current format).

llvm-svn: 14075
2004-06-08 20:08:30 +00:00
Brian Gaeke 76b6426a8c Add a TmpInstruction ctor that doesn't take a MCFI.
llvm-svn: 14073
2004-06-08 18:52:46 +00:00